Implemented state-create, handling of g_hash_table at redesection needs more work.
authorAnders Broman <anders.broman@ericsson.com>
Tue, 16 Nov 2004 22:15:14 +0000 (22:15 -0000)
committerAnders Broman <anders.broman@ericsson.com>
Tue, 16 Nov 2004 22:15:14 +0000 (22:15 -0000)
svn path=/trunk/; revision=12531

epan/sigcomp-udvm.c
epan/sigcomp-udvm.h
epan/sigcomp_state_hdlr.c
epan/sigcomp_state_hdlr.h

index 51f3d87f4eb4bc95f82a0e1dd22f849bf111f02f..bdabb3ace749f89132649faffb07fd36245fc106 100644 (file)
@@ -44,7 +44,8 @@
 # include "snprintf.h"
 #endif
 
-#include "packet.h"
+#include "packet.h"\r
+#include "strutil.h"
 #include "sigcomp-udvm.h"
 #include "sigcomp_state_hdlr.h"
 #include "sha1.h"
@@ -93,7 +94,7 @@ static gboolean print_level_2;
 static gboolean print_level_3;
 
 /* Internal result code values of decompression failures */
-static const value_string result_code_vals[] = {
+const value_string result_code_vals[] = {
        { 0,    "No decomprssion failure" },
        { 1,    "Partial state length less than 6 or greater than 20 bytes long" },
        { 2,    "No state match" },
@@ -170,8 +171,8 @@ decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet
        guint16         state_minimum_access_length_buff[5];
        guint16         state_state_retention_priority_buff[5];
        guint32         used_udvm_cycles = 0;
-       guint16         cycles_per_bit;
-       guint16         maximum_UDVM_cycles;
+       guint           cycles_per_bit;
+       guint           maximum_UDVM_cycles;
        guint8          *sha1buff;
        unsigned char sha1_digest_buf[20];
        sha1_context ctx;
@@ -216,6 +217,8 @@ decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet
        print_level_1 = FALSE;
        print_level_2 = FALSE;
        print_level_3 = FALSE;
+
+
        switch( print_flags ) {
                case 0:
                        break;
@@ -285,22 +288,32 @@ decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet
        /* state_length  */
        buff[8] = 0;
        buff[9] = 0;
-       code_length = tvb_reported_length_remaining(bytecode_tvb, 0);
+       code_length = tvb_reported_length_remaining(bytecode_tvb, 0);\r
+\r
+       cycles_per_bit = buff[2] << 8;\r
+       cycles_per_bit = cycles_per_bit | buff[3];\r
+       /* \r
+        * maximum_UDVM_cycles = (8 * n + 1000) * cycles_per_bit\r
+        */\r
+       maximum_UDVM_cycles = (( 8 * msg_end ) + 1000) * cycles_per_bit;\r
+\r
+       proto_tree_add_text(udvm_tree, bytecode_tvb, offset, 1,"maximum_UDVM_cycles(%u) = (( 8 * msg_end(%u) ) + 1000) * cycles_per_bit(%u)",maximum_UDVM_cycles,msg_end,cycles_per_bit);\r
+       proto_tree_add_text(udvm_tree, bytecode_tvb, offset, 1,"Message Length: %u,Byte code length: %u, Maximum UDVM cycles: %u",msg_end,code_length,maximum_UDVM_cycles);
 
        /* Load bytecode into UDVM starting at "udvm_mem_dest" */
-       i = udvm_mem_dest;
+       i = udvm_mem_dest;\r
+       if ( print_level_3 )\r
+               proto_tree_add_text(udvm_tree, bytecode_tvb, offset, 1,"Load bytecode into UDVM starting at %u",i);
        while ( code_length > offset ) {
-               buff[i] = tvb_get_guint8(bytecode_tvb, offset);
+               buff[i] = tvb_get_guint8(bytecode_tvb, offset);\r
+               if ( print_level_3 )
+                       proto_tree_add_text(udvm_tree, bytecode_tvb, offset, 1,
+                                               "              Addr: %u Instruction code(0x%0x) ", i, buff[i]);
+
                i++;
                offset++;
 
        }
-       cycles_per_bit = buff[2] << 8;
-       cycles_per_bit = cycles_per_bit | buff[3];
-       /* 
-        * maximum_UDVM_cycles = (8 * n + 1000) * cycles_per_bit
-        */
-       maximum_UDVM_cycles = (( 8 * msg_end ) + 1000) * cycles_per_bit;
        /* Start executing code */
        current_address = udvm_mem_dest;
        input_address = 0;
@@ -316,18 +329,17 @@ execute_next_instruction:
                goto decompression_failure;
        }
        current_instruction = buff[current_address];
+
        switch ( current_instruction ) {
        case SIGCOMP_INSTR_DECOMPRESSION_FAILURE:
                used_udvm_cycles++;
                if ( result_code == 0 )
                        result_code = 9;
-               if (print_level_1 ){
-                       proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,
-                               "Addr: %u ## DECOMPRESSION-FAILURE(0)",
-                               current_address);
-                       proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Ethereal UDVM diagnostic: %s.",
-                                           val_to_str(result_code, result_code_vals,"Unknown (%u)"));
-               }
+               proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,
+                       "Addr: %u ## DECOMPRESSION-FAILURE(0)",
+                       current_address);
+               proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Ethereal UDVM diagnostic: %s.",
+                                   val_to_str(result_code, result_code_vals,"Unknown (%u)"));
                if ( output_address > 0 ){
                        /* At least something got decompressed, show it */
                        decomp_tvb = tvb_new_real_data(out_buff,output_address,output_address);
@@ -1918,8 +1930,8 @@ execute_next_instruction:
                                        "               byte_copy_right = %u, byte_copy_left = %u", byte_copy_right,byte_copy_left);
                }
 
-               result_code = udvm_state_access(buff, p_id_start, p_id_length, state_begin, state_length, 
-                       state_address, state_instruction);
+               result_code = udvm_state_access(message_tvb, udvm_tree, buff, p_id_start, p_id_length, state_begin, &state_length, 
+                       &state_address, state_instruction, TRUE);
                if ( result_code != 0 ){
                        goto decompression_failure; 
                }
@@ -2073,12 +2085,16 @@ execute_next_instruction:
                if (print_level_1 ){
                        proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Addr: %u       partial_identifier_length %u",
                                operand_address, p_id_length);
-               }
+               }\r
+               current_address = next_operand_address;\r
+
                /* Execute the instruction:
                 * TODO implement it
-                */
-               used_udvm_cycles++;
-               proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Execution of this instruction is NOT implemented");
+                */\r
+               udvm_state_free(buff,p_id_start,p_id_length);\r
+               used_udvm_cycles++;\r
+
+               goto execute_next_instruction;\r
                break;
        case SIGCOMP_INSTR_OUTPUT: /* 34 OUTPUT (%output_start, %output_length) */
                if (print_level_1 ){
@@ -2231,7 +2247,6 @@ execute_next_instruction:
                                operand_address, state_retention_priority);
                }
                current_address = next_operand_address;
-               proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Execution of this instruction is NOT FULLY implemented( STATES NOT SAVED)");
                /* TODO: This isn't currently totaly correct as END_INSTRUCTION might not create state */
                no_of_state_create++;
                if ( no_of_state_create > 4 ){
@@ -2246,7 +2261,6 @@ execute_next_instruction:
                state_state_retention_priority_buff[no_of_state_create] = state_retention_priority;
                
                /* Execute the instruction
-                * TODO Implement the instruction
                 */
                proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"no_of_state_create %u",no_of_state_create);
                if ( no_of_state_create != 0 ){
@@ -2293,7 +2307,7 @@ execute_next_instruction:
                                                        x,sha1_digest_buf[x]);
                                        }
                                }
-                               udvm_state_create(sha1buff, sha1_digest_buf);
+                               udvm_state_create(sha1buff, sha1_digest_buf, state_minimum_access_length_buff[n]);
                                n++;
 
                        }
@@ -2315,15 +2329,15 @@ execute_next_instruction:
                break;
 
        default:
+           proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1," ### Addr %u Invalid instruction: %u (0x%x)",
+                       current_address,current_instruction,current_instruction);
                break;
                }
        return NULL;
 decompression_failure:
                
-       if (print_level_1 ){
                        proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"DECOMPRESSION FAILURE: %s",
                                            val_to_str(result_code, result_code_vals,"Unknown (%u)"));
-               }
        return NULL;
 
 
index ae839ce499279ac17cb2179e4d17911897497da1..7527db1a29ed3cd63a2d7205d870db754e36a1b0 100644 (file)
@@ -1,41 +1,43 @@
-/* udvm.h
- * Routines making up the Univerasl Decompressor Virtual Machine (UDVM) used for
- * Signaling Compression (SigComp) dissection.
- * Copyright 2004, Anders Broman <anders.broman@ericsson.com>
- *
- * $Id: udvm.c 11445 2004-07-20 19:04:48Z etxrab $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * References:
- * http://www.ietf.org/rfc/rfc3320.txt?number=3320
- * http://www.ietf.org/rfc/rfc3321.txt?number=3321
- * Useful links :
- * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-impl-guide-02.txt
- * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-sip-01.txt
- */
-
-#ifndef SIGCOMP_UDVM_H
-#define SIGCOMP_UDVM_H
-
-extern tvbuff_t* decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet_info *pinfo,
-                                                  proto_tree *tree, gint destination, gint print_flags);
-
-/* example: extern const value_string q931_cause_location_vals[]; */
-#endif 
+/* udvm.h\r
+ * Routines making up the Univerasl Decompressor Virtual Machine (UDVM) used for\r
+ * Signaling Compression (SigComp) dissection.\r
+ * Copyright 2004, Anders Broman <anders.broman@ericsson.com>\r
+ *\r
+ * $Id: udvm.c 11445 2004-07-20 19:04:48Z etxrab $\r
+ *\r
+ * Ethereal - Network traffic analyzer\r
+ * By Gerald Combs <gerald@ethereal.com>\r
+ * Copyright 1998 Gerald Combs\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * \r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+ * References:\r
+ * http://www.ietf.org/rfc/rfc3320.txt?number=3320\r
+ * http://www.ietf.org/rfc/rfc3321.txt?number=3321\r
+ * Useful links :\r
+ * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-impl-guide-02.txt\r
+ * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-sip-01.txt\r
+ */\r
+\r
+#ifndef SIGCOMP_UDVM_H\r
+#define SIGCOMP_UDVM_H\r
+\r
+extern tvbuff_t* decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet_info *pinfo,\r
+                                                  proto_tree *tree, gint destination, gint print_flags);\r
+\r
+\r
+\r
+/* example: extern const value_string q931_cause_location_vals[]; */\r
+#endif \r
 /* SIGCOMP_UDVM_H */
\ No newline at end of file
index 1b46b7ebc374a501dd8af5d764ff962fd3d4505e..70f6c467d2fb678aadef43040af976c4443fda85 100644 (file)
@@ -43,6 +43,7 @@
 #include <string.h>
 #include <math.h>
 #include <glib.h>
+#include "strutil.h"
 
 #ifdef NEED_SNPRINTF_H
 # include "snprintf.h"
@@ -56,7 +57,7 @@
  *    (SDP) Static Dictionary for Signaling Compression (SigComp)
  * http://www.ietf.org/rfc/rfc3485.txt?number=3485 
  */
-guint16 sip_sdp_state_length = 0x12e4;
+guint16 sip_sdp_state_length = 0x12e4;\r
 
 static const guint8 sip_sdp_state_identifier[20] =
 {
@@ -372,15 +373,57 @@ static const guint8 sip_sdp_static_dictionaty_for_sigcomp[0x12e4] =
    /* -12E0, */  0x46, 0x04, 0x0c, 0xe1
 
 }; 
+static GHashTable *state_buffer_table=NULL;
+
+void
+sigcomp_init_udvm(void){
+
+       gchar *partial_state_str;
+       guint i;
+       guint8 *sip_sdp_buff;
+       
+
+       state_buffer_table = g_hash_table_new(g_str_hash, g_str_equal);
+       /*
+        * Store static dictionaries in hash table
+        */
+       sip_sdp_buff = g_malloc(0x12e4+8);
+
+       partial_state_str = bytes_to_str(sip_sdp_state_identifier, 6);
+       
+       /*
+        * Debug        g_warning("Sigcomp init: Storing partial state =%s",partial_state_str);
+        */
+       i = 0;
+       while ( i < sip_sdp_state_length ){
+               sip_sdp_buff[i+8] = sip_sdp_static_dictionaty_for_sigcomp[i];
+               /* Debug
+                * g_warning(" Loading 0x%x at address %u",sip_sdp_buff[i] , i);
+                */
+               i++;
+
+       }
+
+       g_hash_table_insert(state_buffer_table, g_strdup(partial_state_str), sip_sdp_buff);
+       /*      Debug
+        *      g_warning("g_hash_table_insert = 0x%x",sip_sdp_buff);\r
+        *  g_warning("g_hash_table_insert = 0x%x",sip_sdp_buff);
+        */
+
+}
+
                           
-int udvm_state_access(guint8 buff[],guint16 p_id_start, guint16 p_id_length, guint16 state_begin, guint16 state_length, 
-                                          guint16 state_address, guint16 state_instruction)
+int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 buff[],guint16 p_id_start, guint16 p_id_length, guint16 state_begin, guint16 *state_length, 
+                                          guint16 *state_address, guint16 state_instruction, gboolean state_vars_valid)
 {
        int                     result_code = 0;
-       guint           n;
+       guint16         n;
        guint16         k;
        guint16         byte_copy_right;
        guint16         byte_copy_left;
+       char            partial_state[20]; /* Size is 6 - 20 */
+       guint8          *state_buff;
+       gchar           *partial_state_str;
 
        /* 
         * Perform initial checks on validity of data
@@ -400,15 +443,24 @@ int udvm_state_access(guint8 buff[],guint16 p_id_start, guint16 p_id_length, gui
                result_code = 1;
                return result_code;
        }
-       /* 
-        * Is this a static library known to us ?
-        */
+\r
        n = 0;
-       while (n < p_id_length ) {
-               if ( buff[p_id_start + n] != sip_sdp_state_identifier[n] )
-                       goto not_static_dictionary;
+       while ( n < p_id_length ){
+               partial_state[n] = buff[p_id_start + n];
                n++;
        }
+       partial_state_str = bytes_to_str(partial_state, p_id_length);\r
+       proto_tree_add_text(tree,tvb, 0, -1,"Accessing state: %s",partial_state_str);
+       /*  Debug
+        *      g_warning("State Access: partial state =%s",partial_state_str);
+        *      g_warning("g_hash_table_lookup = 0x%x",state_buff);
+        * g_warning("State Access: partial state =%s",partial_state_str);
+        */\r
+       state_buff = g_hash_table_lookup(state_buffer_table, g_strdup(partial_state_str));
+       if ( state_buff == NULL ){
+               result_code = 2; /* No state match */
+               return result_code;
+       }
        /* 
         * sip_sdp_static_dictionaty
         *
@@ -423,20 +475,52 @@ int udvm_state_access(guint8 buff[],guint16 p_id_start, guint16 p_id_length, gui
         * If k = byte_copy_right then set n := byte_copy_left, else set n := k
         *
         */ 
+       /*
        if ( ( state_begin + state_length ) > sip_sdp_state_length )
                return 3;
+               */
+       /*
+        * buff                                 = Where "state" will be stored
+        * p_id_start                   = Partial state identifier start pos in the buffer(buff)
+        * p-id_length                  = Partial state identifier length
+        * state_begin                  = Where to start to read state from
+        * state_length                 = Lenght of state
+        * state_adress                 = Address where to store the state in the buffer(buff)
+        * state_instruction    =
+        * FALSE                                = Indicates that state_* is in the stored state 
+        */
+
+       /*\r
+        * The value of\r
+        * state_length MUST be taken from the returned item of state in the\r
+        * case that the state_length operand is set to 0.\r
+        */
+       if ( *state_length == 0 ){\r
+               *state_length = state_buff[0] << 8;\r
+               *state_length = *state_length ^ state_buff[1];\r
+       }
+       if ( state_vars_valid == FALSE ){
+               *state_length = state_buff[0] << 8;
+               *state_length = *state_length ^ state_buff[1];
+
+               *state_address = state_buff[2] << 8;
+               *state_address = *state_address ^ state_buff[3];
 
-       n = state_begin;
-       k = state_address; 
+               state_instruction = state_buff[4] << 8;
+               state_instruction = state_instruction ^ state_buff[5];
+       }\r
+
+       n = state_begin + 8;
+       k = *state_address; 
        byte_copy_right = buff[66] << 8;
        byte_copy_right = byte_copy_right ^ buff[67];
        byte_copy_left = buff[64] << 8;
        byte_copy_left = byte_copy_left ^ buff[65];
        /* debug 
-        *g_warning(" state_begin %u state_address %u",state_begin , state_address);
+        *g_warning(" state_begin %u state_address %u",state_begin , *state_address);
         */
-       while ( n < state_length ){
-               buff[k] = sip_sdp_static_dictionaty_for_sigcomp[n];
+       while ( n < (*state_length + 8)){
+               buff[k] = state_buff[n];
                /*  debug 
                 *      g_warning(" Loading 0x%x at address %u",buff[k] , k);
                 */
@@ -447,22 +531,117 @@ int udvm_state_access(guint8 buff[],guint16 p_id_start, guint16 p_id_length, gui
                        k = byte_copy_left;
                }
                n++;
-       }
+       }\r
+       /* 
+        * If a state item is successfully accessed then the state_value byte\r
+        * string is copied into the UDVM memory beginning at state_address.\r
+        * \r
+        * The first 32 bytes of UDVM memory are then initialized to special\r
+        * values as illustrated in Figure 5.\r
+        * \r
+        *                      0             7 8            15\r
+        *               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
+        *               |       UDVM_memory_size        |  0 - 1\r
+        *               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
+        *               |        cycles_per_bit         |  2 - 3\r
+        *               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
+        *               |        SigComp_version        |  4 - 5\r
+        *               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
+        *               |    partial_state_ID_length    |  6 - 7\r
+        *               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
+        *               |         state_length          |  8 - 9\r
+        *               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
+        *               |                               |\r
+        *               :           reserved            :  10 - 31\r
+        *               |                               |\r
+        *               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
+        *\r
+        *      Figure 5: Initializing Useful Values in UDVM memory\r
+        *\r
+        * The first five 2-byte words are initialized to contain some values\r
+        * that might be useful to the UDVM bytecode (Useful Values).  Note that\r
+        * these values are for information only and can be overwritten when\r
+        * executing the UDVM bytecode without any effect on the endpoint.  The\r
+        * MSBs of each 2-byte word are stored preceding the LSBs.\r
+        */\r
+\r
+       /* state_length  */\r
+       buff[8] = state_buff[0];\r
+       buff[9] = state_buff[1];\r
+       /* UDVM_memory_size  */\r
+       buff[0] = 0;\r
+       buff[1] = 0;\r
+       /* cycles_per_bit */\r
+       buff[2] = 0;\r
+       buff[3] = 16;\r
+       /* SigComp_version */\r
+       buff[4] = 0;\r
+       buff[5] = 1;\r
+       /* partial_state_ID_length */\r
+       buff[6] = p_id_length >> 8;\r
+       buff[7] = p_id_length & 0xff;\r
 
        return 0;
        /*
         * End SIP
         */
-not_static_dictionary:
-       return 255;
+
 }
 
-void udvm_state_create(guint8 state_buff[],guint8 state_identifier[]){
+void udvm_state_create(guint8 *state_buff,guint8 *state_identifier,guint16 p_id_length){
+
+       char partial_state[20];
+       guint8 i;
+       gchar *partial_state_str;
+       gchar *dummy_buff;
        /*
         * Debug
        g_warning("Received items of state,state_length_buff[0]= %u, state_length_buff[1]= %u",
                state_length_buff[0],state_length_buff[1]);
 
         */
+       i = 0;
+       while ( i < p_id_length ){
+               partial_state[i] = state_identifier[i];
+               i++;
+       }
+       partial_state_str = bytes_to_str(partial_state, p_id_length);
+\r
+       dummy_buff = g_hash_table_lookup(state_buffer_table, partial_state_str);
+       if ( dummy_buff == NULL ){
+               g_hash_table_insert(state_buffer_table, g_strdup(partial_state_str), state_buff);
+       }else{\r
+               /* The buffer allocated by sigcomp-udvm.c wasen't needed so free it\r
+                */\r
+               g_free(partial_state_str);\r
+       }
 
 }
+
+void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length){\r
+\r
+       char partial_state[20];\r
+       guint8 i;\r
+       gchar *partial_state_str;\r
+       /*\r
+       gchar *dummy_buff;\r
+       */\r
+\r
+       i = 0;\r
+       while ( i < p_id_length ){\r
+               partial_state[i] = buff[p_id_start + i];\r
+               i++;\r
+       }\r
+       partial_state_str = bytes_to_str(partial_state, p_id_length);\r
+       /* TODO Implement a state create counter before actually freeing states \r
+        * Hmm is it a good idea to free the buffer at all?\r
+       g_warning("State-free on  %s ",partial_state_str);\r
+       dummy_buff = g_hash_table_lookup(state_buffer_table, partial_state_str);\r
+       if ( dummy_buff == NULL ){\r
+               g_warning("State-free, state not found  %s",partial_state_str);\r
+       }else{\r
+               g_hash_table_remove (state_buffer_table, partial_state_str);\r
+               g_free(dummy_buff);\r
+       }\r
+       */\r
+}
\ No newline at end of file
index a49250f20fd2b7129011808c3ad0d13e58e51966..b77c4cc7b487a76acfe4dbc626d7001664d2ebf2 100644 (file)
@@ -1,42 +1,45 @@
-/* sigcomp_state_hdlr.c
- * Routines making up the State handler of the Univerasl Decompressor Virtual Machine (UDVM) 
- * used for Signaling Compression (SigComp) dissection.
- * Copyright 2004, Anders Broman <anders.broman@ericsson.com>
- *
- * $Id: udvm.c 11445 2004-07-20 19:04:48Z etxrab $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * References:
- * http://www.ietf.org/rfc/rfc3320.txt?number=3320
- * http://www.ietf.org/rfc/rfc3321.txt?number=3321
- * Useful links :
- * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-impl-guide-03.txt
- * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-sip-01.txt
- */
-
-#ifndef SIGCOMP_STATE_HDLR_H
-#define SIGCOMP_STATE_HDLR_H
-
-extern int udvm_state_access(guint8 buff[],guint16 p_id_start, guint16 p_id_length, guint16 state_begin, guint16 state_length, 
-                                                               guint16 state_address, guint16 state_instruction);
-
-extern void udvm_state_create(guint8 state_buff[],guint8 state_identifier_buff[]);
-
-#endif 
-/* SIGCOMP_STATE_HDLR_H */
+/* sigcomp_state_hdlr.c\r
+ * Routines making up the State handler of the Univerasl Decompressor Virtual Machine (UDVM) \r
+ * used for Signaling Compression (SigComp) dissection.\r
+ * Copyright 2004, Anders Broman <anders.broman@ericsson.com>\r
+ *\r
+ * $Id: udvm.c 11445 2004-07-20 19:04:48Z etxrab $\r
+ *\r
+ * Ethereal - Network traffic analyzer\r
+ * By Gerald Combs <gerald@ethereal.com>\r
+ * Copyright 1998 Gerald Combs\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * \r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+ * References:\r
+ * http://www.ietf.org/rfc/rfc3320.txt?number=3320\r
+ * http://www.ietf.org/rfc/rfc3321.txt?number=3321\r
+ * Useful links :\r
+ * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-impl-guide-03.txt\r
+ * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-sip-01.txt\r
+ */\r
+\r
+#ifndef SIGCOMP_STATE_HDLR_H\r
+#define SIGCOMP_STATE_HDLR_H\r
+\r
+extern const value_string result_code_vals[];\r
+extern int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 buff[],guint16 p_id_start, guint16 p_id_length, guint16 state_begin, guint16 *state_length, \r
+                                                               guint16 *state_address, guint16 state_instruction, gboolean state_vars_valid);\r
+\r
+extern void udvm_state_create(guint8 *state_buff,guint8 *state_identifier_buff,guint16 p_id_length);\r
+extern void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length);\r
+\r
+extern void sigcomp_init_udvm(void);\r
+#endif \r
+/* SIGCOMP_STATE_HDLR_H */\r