Implemented state-create, handling of g_hash_table at redesection needs more work.

svn path=/trunk/; revision=12531
This commit is contained in:
Anders Broman 2004-11-16 22:15:14 +00:00
parent 097877f306
commit ca2b359041
4 changed files with 330 additions and 132 deletions

View File

@ -44,7 +44,8 @@
# include "snprintf.h" # include "snprintf.h"
#endif #endif
#include "packet.h" #include "packet.h"
#include "strutil.h"
#include "sigcomp-udvm.h" #include "sigcomp-udvm.h"
#include "sigcomp_state_hdlr.h" #include "sigcomp_state_hdlr.h"
#include "sha1.h" #include "sha1.h"
@ -93,7 +94,7 @@ static gboolean print_level_2;
static gboolean print_level_3; static gboolean print_level_3;
/* Internal result code values of decompression failures */ /* Internal result code values of decompression failures */
static const value_string result_code_vals[] = { const value_string result_code_vals[] = {
{ 0, "No decomprssion failure" }, { 0, "No decomprssion failure" },
{ 1, "Partial state length less than 6 or greater than 20 bytes long" }, { 1, "Partial state length less than 6 or greater than 20 bytes long" },
{ 2, "No state match" }, { 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_minimum_access_length_buff[5];
guint16 state_state_retention_priority_buff[5]; guint16 state_state_retention_priority_buff[5];
guint32 used_udvm_cycles = 0; guint32 used_udvm_cycles = 0;
guint16 cycles_per_bit; guint cycles_per_bit;
guint16 maximum_UDVM_cycles; guint maximum_UDVM_cycles;
guint8 *sha1buff; guint8 *sha1buff;
unsigned char sha1_digest_buf[20]; unsigned char sha1_digest_buf[20];
sha1_context ctx; 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_1 = FALSE;
print_level_2 = FALSE; print_level_2 = FALSE;
print_level_3 = FALSE; print_level_3 = FALSE;
switch( print_flags ) { switch( print_flags ) {
case 0: case 0:
break; break;
@ -285,22 +288,32 @@ decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet
/* state_length */ /* state_length */
buff[8] = 0; buff[8] = 0;
buff[9] = 0; buff[9] = 0;
code_length = tvb_reported_length_remaining(bytecode_tvb, 0); code_length = tvb_reported_length_remaining(bytecode_tvb, 0);
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;
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);
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" */ /* Load bytecode into UDVM starting at "udvm_mem_dest" */
i = udvm_mem_dest; i = udvm_mem_dest;
if ( print_level_3 )
proto_tree_add_text(udvm_tree, bytecode_tvb, offset, 1,"Load bytecode into UDVM starting at %u",i);
while ( code_length > offset ) { while ( code_length > offset ) {
buff[i] = tvb_get_guint8(bytecode_tvb, offset); buff[i] = tvb_get_guint8(bytecode_tvb, offset);
if ( print_level_3 )
proto_tree_add_text(udvm_tree, bytecode_tvb, offset, 1,
" Addr: %u Instruction code(0x%0x) ", i, buff[i]);
i++; i++;
offset++; 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 */ /* Start executing code */
current_address = udvm_mem_dest; current_address = udvm_mem_dest;
input_address = 0; input_address = 0;
@ -316,18 +329,17 @@ execute_next_instruction:
goto decompression_failure; goto decompression_failure;
} }
current_instruction = buff[current_address]; current_instruction = buff[current_address];
switch ( current_instruction ) { switch ( current_instruction ) {
case SIGCOMP_INSTR_DECOMPRESSION_FAILURE: case SIGCOMP_INSTR_DECOMPRESSION_FAILURE:
used_udvm_cycles++; used_udvm_cycles++;
if ( result_code == 0 ) if ( result_code == 0 )
result_code = 9; result_code = 9;
if (print_level_1 ){ proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,
proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1, "Addr: %u ## DECOMPRESSION-FAILURE(0)",
"Addr: %u ## DECOMPRESSION-FAILURE(0)", current_address);
current_address); proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Ethereal UDVM diagnostic: %s.",
proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Ethereal UDVM diagnostic: %s.", val_to_str(result_code, result_code_vals,"Unknown (%u)"));
val_to_str(result_code, result_code_vals,"Unknown (%u)"));
}
if ( output_address > 0 ){ if ( output_address > 0 ){
/* At least something got decompressed, show it */ /* At least something got decompressed, show it */
decomp_tvb = tvb_new_real_data(out_buff,output_address,output_address); 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); " 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, result_code = udvm_state_access(message_tvb, udvm_tree, buff, p_id_start, p_id_length, state_begin, &state_length,
state_address, state_instruction); &state_address, state_instruction, TRUE);
if ( result_code != 0 ){ if ( result_code != 0 ){
goto decompression_failure; goto decompression_failure;
} }
@ -2073,12 +2085,16 @@ execute_next_instruction:
if (print_level_1 ){ if (print_level_1 ){
proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Addr: %u partial_identifier_length %u", proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Addr: %u partial_identifier_length %u",
operand_address, p_id_length); operand_address, p_id_length);
} }
current_address = next_operand_address;
/* Execute the instruction: /* Execute the instruction:
* TODO implement it * TODO implement it
*/ */
used_udvm_cycles++; udvm_state_free(buff,p_id_start,p_id_length);
proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"Execution of this instruction is NOT implemented"); used_udvm_cycles++;
goto execute_next_instruction;
break; break;
case SIGCOMP_INSTR_OUTPUT: /* 34 OUTPUT (%output_start, %output_length) */ case SIGCOMP_INSTR_OUTPUT: /* 34 OUTPUT (%output_start, %output_length) */
if (print_level_1 ){ if (print_level_1 ){
@ -2231,7 +2247,6 @@ execute_next_instruction:
operand_address, state_retention_priority); operand_address, state_retention_priority);
} }
current_address = next_operand_address; 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 */ /* TODO: This isn't currently totaly correct as END_INSTRUCTION might not create state */
no_of_state_create++; no_of_state_create++;
if ( no_of_state_create > 4 ){ 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; state_state_retention_priority_buff[no_of_state_create] = state_retention_priority;
/* Execute the instruction /* 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); 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 ){ if ( no_of_state_create != 0 ){
@ -2293,7 +2307,7 @@ execute_next_instruction:
x,sha1_digest_buf[x]); 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++; n++;
} }
@ -2315,15 +2329,15 @@ execute_next_instruction:
break; break;
default: 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; break;
} }
return NULL; return NULL;
decompression_failure: decompression_failure:
if (print_level_1 ){
proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"DECOMPRESSION FAILURE: %s", proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1,"DECOMPRESSION FAILURE: %s",
val_to_str(result_code, result_code_vals,"Unknown (%u)")); val_to_str(result_code, result_code_vals,"Unknown (%u)"));
}
return NULL; return NULL;

View File

@ -1,41 +1,43 @@
/* udvm.h /* udvm.h
* Routines making up the Univerasl Decompressor Virtual Machine (UDVM) used for * Routines making up the Univerasl Decompressor Virtual Machine (UDVM) used for
* Signaling Compression (SigComp) dissection. * Signaling Compression (SigComp) dissection.
* Copyright 2004, Anders Broman <anders.broman@ericsson.com> * Copyright 2004, Anders Broman <anders.broman@ericsson.com>
* *
* $Id: udvm.c 11445 2004-07-20 19:04:48Z etxrab $ * $Id: udvm.c 11445 2004-07-20 19:04:48Z etxrab $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs * Copyright 1998 Gerald Combs
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* References: * References:
* http://www.ietf.org/rfc/rfc3320.txt?number=3320 * http://www.ietf.org/rfc/rfc3320.txt?number=3320
* http://www.ietf.org/rfc/rfc3321.txt?number=3321 * http://www.ietf.org/rfc/rfc3321.txt?number=3321
* Useful links : * 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-impl-guide-02.txt
* http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-sip-01.txt * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-sip-01.txt
*/ */
#ifndef SIGCOMP_UDVM_H #ifndef SIGCOMP_UDVM_H
#define SIGCOMP_UDVM_H #define SIGCOMP_UDVM_H
extern tvbuff_t* decompress_sigcomp_message(tvbuff_t *bytecode_tvb, tvbuff_t *message_tvb, packet_info *pinfo, 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); proto_tree *tree, gint destination, gint print_flags);
/* example: extern const value_string q931_cause_location_vals[]; */
#endif
/* example: extern const value_string q931_cause_location_vals[]; */
#endif
/* SIGCOMP_UDVM_H */ /* SIGCOMP_UDVM_H */

View File

@ -43,6 +43,7 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <glib.h> #include <glib.h>
#include "strutil.h"
#ifdef NEED_SNPRINTF_H #ifdef NEED_SNPRINTF_H
# include "snprintf.h" # include "snprintf.h"
@ -56,7 +57,7 @@
* (SDP) Static Dictionary for Signaling Compression (SigComp) * (SDP) Static Dictionary for Signaling Compression (SigComp)
* http://www.ietf.org/rfc/rfc3485.txt?number=3485 * http://www.ietf.org/rfc/rfc3485.txt?number=3485
*/ */
guint16 sip_sdp_state_length = 0x12e4; guint16 sip_sdp_state_length = 0x12e4;
static const guint8 sip_sdp_state_identifier[20] = 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 /* -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);
* 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, 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) guint16 *state_address, guint16 state_instruction, gboolean state_vars_valid)
{ {
int result_code = 0; int result_code = 0;
guint n; guint16 n;
guint16 k; guint16 k;
guint16 byte_copy_right; guint16 byte_copy_right;
guint16 byte_copy_left; 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 * 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; result_code = 1;
return result_code; return result_code;
} }
/*
* Is this a static library known to us ?
*/
n = 0; n = 0;
while (n < p_id_length ) { while ( n < p_id_length ){
if ( buff[p_id_start + n] != sip_sdp_state_identifier[n] ) partial_state[n] = buff[p_id_start + n];
goto not_static_dictionary;
n++; n++;
} }
partial_state_str = bytes_to_str(partial_state, p_id_length);
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);
*/
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 * 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 k = byte_copy_right then set n := byte_copy_left, else set n := k
* *
*/ */
/*
if ( ( state_begin + state_length ) > sip_sdp_state_length ) if ( ( state_begin + state_length ) > sip_sdp_state_length )
return 3; 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
*/
n = state_begin; /*
k = state_address; * The value of
* state_length MUST be taken from the returned item of state in the
* case that the state_length operand is set to 0.
*/
if ( *state_length == 0 ){
*state_length = state_buff[0] << 8;
*state_length = *state_length ^ state_buff[1];
}
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];
state_instruction = state_buff[4] << 8;
state_instruction = state_instruction ^ state_buff[5];
}
n = state_begin + 8;
k = *state_address;
byte_copy_right = buff[66] << 8; byte_copy_right = buff[66] << 8;
byte_copy_right = byte_copy_right ^ buff[67]; byte_copy_right = byte_copy_right ^ buff[67];
byte_copy_left = buff[64] << 8; byte_copy_left = buff[64] << 8;
byte_copy_left = byte_copy_left ^ buff[65]; byte_copy_left = byte_copy_left ^ buff[65];
/* debug /* 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 ){ while ( n < (*state_length + 8)){
buff[k] = sip_sdp_static_dictionaty_for_sigcomp[n]; buff[k] = state_buff[n];
/* debug /* debug
* g_warning(" Loading 0x%x at address %u",buff[k] , k); * 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; k = byte_copy_left;
} }
n++; n++;
} }
/*
* If a state item is successfully accessed then the state_value byte
* string is copied into the UDVM memory beginning at state_address.
*
* The first 32 bytes of UDVM memory are then initialized to special
* values as illustrated in Figure 5.
*
* 0 7 8 15
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | UDVM_memory_size | 0 - 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | cycles_per_bit | 2 - 3
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | SigComp_version | 4 - 5
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | partial_state_ID_length | 6 - 7
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | state_length | 8 - 9
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* : reserved : 10 - 31
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* Figure 5: Initializing Useful Values in UDVM memory
*
* The first five 2-byte words are initialized to contain some values
* that might be useful to the UDVM bytecode (Useful Values). Note that
* these values are for information only and can be overwritten when
* executing the UDVM bytecode without any effect on the endpoint. The
* MSBs of each 2-byte word are stored preceding the LSBs.
*/
/* state_length */
buff[8] = state_buff[0];
buff[9] = state_buff[1];
/* UDVM_memory_size */
buff[0] = 0;
buff[1] = 0;
/* cycles_per_bit */
buff[2] = 0;
buff[3] = 16;
/* SigComp_version */
buff[4] = 0;
buff[5] = 1;
/* partial_state_ID_length */
buff[6] = p_id_length >> 8;
buff[7] = p_id_length & 0xff;
return 0; return 0;
/* /*
* End SIP * 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 * Debug
g_warning("Received items of state,state_length_buff[0]= %u, state_length_buff[1]= %u", g_warning("Received items of state,state_length_buff[0]= %u, state_length_buff[1]= %u",
state_length_buff[0],state_length_buff[1]); 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);
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{
/* The buffer allocated by sigcomp-udvm.c wasen't needed so free it
*/
g_free(partial_state_str);
}
} }
void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length){
char partial_state[20];
guint8 i;
gchar *partial_state_str;
/*
gchar *dummy_buff;
*/
i = 0;
while ( i < p_id_length ){
partial_state[i] = buff[p_id_start + i];
i++;
}
partial_state_str = bytes_to_str(partial_state, p_id_length);
/* TODO Implement a state create counter before actually freeing states
* Hmm is it a good idea to free the buffer at all?
g_warning("State-free on %s ",partial_state_str);
dummy_buff = g_hash_table_lookup(state_buffer_table, partial_state_str);
if ( dummy_buff == NULL ){
g_warning("State-free, state not found %s",partial_state_str);
}else{
g_hash_table_remove (state_buffer_table, partial_state_str);
g_free(dummy_buff);
}
*/
}

View File

@ -1,42 +1,45 @@
/* sigcomp_state_hdlr.c /* sigcomp_state_hdlr.c
* Routines making up the State handler of the Univerasl Decompressor Virtual Machine (UDVM) * Routines making up the State handler of the Univerasl Decompressor Virtual Machine (UDVM)
* used for Signaling Compression (SigComp) dissection. * used for Signaling Compression (SigComp) dissection.
* Copyright 2004, Anders Broman <anders.broman@ericsson.com> * Copyright 2004, Anders Broman <anders.broman@ericsson.com>
* *
* $Id: udvm.c 11445 2004-07-20 19:04:48Z etxrab $ * $Id: udvm.c 11445 2004-07-20 19:04:48Z etxrab $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs * Copyright 1998 Gerald Combs
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* References: * References:
* http://www.ietf.org/rfc/rfc3320.txt?number=3320 * http://www.ietf.org/rfc/rfc3320.txt?number=3320
* http://www.ietf.org/rfc/rfc3321.txt?number=3321 * http://www.ietf.org/rfc/rfc3321.txt?number=3321
* Useful links : * 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-impl-guide-03.txt
* http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-sip-01.txt * http://www.ietf.org/internet-drafts/draft-ietf-rohc-sigcomp-sip-01.txt
*/ */
#ifndef SIGCOMP_STATE_HDLR_H #ifndef SIGCOMP_STATE_HDLR_H
#define 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, extern const value_string result_code_vals[];
guint16 state_address, guint16 state_instruction); 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,
guint16 *state_address, guint16 state_instruction, gboolean state_vars_valid);
extern void udvm_state_create(guint8 state_buff[],guint8 state_identifier_buff[]);
extern void udvm_state_create(guint8 *state_buff,guint8 *state_identifier_buff,guint16 p_id_length);
#endif extern void udvm_state_free(guint8 buff[],guint16 p_id_start,guint16 p_id_length);
/* SIGCOMP_STATE_HDLR_H */
extern void sigcomp_init_udvm(void);
#endif
/* SIGCOMP_STATE_HDLR_H */