Regenerate a few more of the ASN.1 dissectors
[obnox/wireshark/wip.git] / epan / h225-persistentdata.c
index 4cb1d6f3bce92db67da32527d21d1342b94e0ae5..487113b810ddb550008512b4e7d8e7770e684566 100644 (file)
@@ -1,14 +1,14 @@
 /*
  * h225-persistentdata.c
- * Source for lists and hash tables used in ethereal's h225 dissector
+ * Source for lists and hash tables used in wireshark's h225 dissector
  * for calculation of delays in h225-calls
  *
  * Copyright 2003 Lars Roland
  *
  * $Id$
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
  * This program is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@
 
 #include <glib.h>
 #include <epan/packet.h>
-#include <epan/conversation.h>
+#include <epan/emem.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -41,9 +41,6 @@
 
 /* Global Memory Chunks for lists and Global hash tables*/
 
-static GMemChunk *h225ras_call_info_key_chunk = NULL;
-static GMemChunk *h225ras_call_info_value_chunk = NULL;
-
 static GHashTable *ras_calls[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
 
 /*
@@ -77,7 +74,7 @@ h225ras_call_t * find_h225ras_call(h225ras_call_info_key *h225ras_call_key ,int
        return h225ras_call;
 }
 
-h225ras_call_t * new_h225ras_call(h225ras_call_info_key *h225ras_call_key, packet_info *pinfo, guint8 *guid, int category)
+h225ras_call_t * new_h225ras_call(h225ras_call_info_key *h225ras_call_key, packet_info *pinfo, e_guid_t *guid, int category)
 {
        h225ras_call_info_key *new_h225ras_call_key;
        h225ras_call_t *h225ras_call = NULL;
@@ -88,25 +85,24 @@ h225ras_call_t * new_h225ras_call(h225ras_call_info_key *h225ras_call_key, packe
           frame numbers are 1-origin, so we use 0
           to mean "we don't yet know in which frame
           the reply for this call appears". */
-       new_h225ras_call_key = (h225ras_call_info_key *)g_mem_chunk_alloc(h225ras_call_info_key_chunk);
+       new_h225ras_call_key = se_alloc(sizeof(h225ras_call_info_key));
        new_h225ras_call_key->reqSeqNum = h225ras_call_key->reqSeqNum;
        new_h225ras_call_key->conversation = h225ras_call_key->conversation;
-       h225ras_call = (h225ras_call_t *)g_mem_chunk_alloc(h225ras_call_info_value_chunk);
+       h225ras_call = se_alloc(sizeof(h225ras_call_t));
        h225ras_call->req_num = pinfo->fd->num;
        h225ras_call->rsp_num = 0;
        h225ras_call->requestSeqNum = h225ras_call_key->reqSeqNum;
        h225ras_call->responded = FALSE;
        h225ras_call->next_call = NULL;
-       h225ras_call->req_time.secs=pinfo->fd->abs_secs;
-       h225ras_call->req_time.nsecs=pinfo->fd->abs_usecs*1000;
-       memcpy(h225ras_call->guid, guid,16);
+       h225ras_call->req_time=pinfo->fd->abs_ts;
+       h225ras_call->guid=*guid;
        /* store it */
        g_hash_table_insert(ras_calls[category], new_h225ras_call_key, h225ras_call);
 
        return h225ras_call;
 }
 
-h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pinfo, guint8 *guid, int category _U_)
+h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pinfo, e_guid_t *guid, int category _U_)
 {
        h225ras_call_t *h225ras_call = NULL;
 
@@ -115,15 +111,14 @@ h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pin
           frame numbers are 1-origin, so we use 0
           to mean "we don't yet know in which frame
           the reply for this call appears". */
-       h225ras_call = (h225ras_call_t *)g_mem_chunk_alloc(h225ras_call_info_value_chunk);
+       h225ras_call = se_alloc(sizeof(h225ras_call_t));
        h225ras_call->req_num = pinfo->fd->num;
        h225ras_call->rsp_num = 0;
        h225ras_call->requestSeqNum = prev_call->requestSeqNum;
        h225ras_call->responded = FALSE;
        h225ras_call->next_call = NULL;
-       h225ras_call->req_time.secs=pinfo->fd->abs_secs;
-       h225ras_call->req_time.nsecs=pinfo->fd->abs_usecs*1000;
-       memcpy(h225ras_call->guid, guid,16);
+       h225ras_call->req_time=pinfo->fd->abs_ts;
+       h225ras_call->guid=*guid;
 
        prev_call->next_call = h225ras_call;
        return h225ras_call;
@@ -131,7 +126,7 @@ h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pin
 
 
 /* Init routine for hash tables and delay calculation
-   This routine will be called by Ethereal, before it
+   This routine will be called by Wireshark, before it
    is (re-)dissecting a trace file from beginning.
    We need to discard and init any state we've saved */
 
@@ -140,7 +135,7 @@ h225_init_routine(void)
 {
        int i;
 
-       /* free hash-tables and mem_chunks for RAS SRT */
+       /* free hash-tables for RAS SRT */
        for(i=0;i<7;i++) {
                if (ras_calls[i] != NULL) {
                        g_hash_table_destroy(ras_calls[i]);
@@ -148,27 +143,10 @@ h225_init_routine(void)
                }
        }
 
-       if (h225ras_call_info_key_chunk != NULL) {
-               g_mem_chunk_destroy(h225ras_call_info_key_chunk);
-               h225ras_call_info_key_chunk = NULL;
-       }
-       if (h225ras_call_info_value_chunk != NULL) {
-               g_mem_chunk_destroy(h225ras_call_info_value_chunk);
-               h225ras_call_info_value_chunk = NULL;
-       }
-
-       /* create new hash-tables and mem_chunks for RAS SRT */
+       /* create new hash-tables for RAS SRT */
 
        for(i=0;i<7;i++) {
                ras_calls[i] = g_hash_table_new(h225ras_call_hash, h225ras_call_equal);
        }
 
-       h225ras_call_info_key_chunk = g_mem_chunk_new("call_info_key_chunk",
-           sizeof(h225ras_call_info_key),
-           400 * sizeof(h225ras_call_info_key),
-           G_ALLOC_ONLY);
-       h225ras_call_info_value_chunk = g_mem_chunk_new("call_info_value_chunk",
-           sizeof(h225ras_call_t),
-           400 * sizeof(h225ras_call_t),
-           G_ALLOC_ONLY);
 }