aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2006-01-12 02:06:34 +0000
committerGerald Combs <gerald@wireshark.org>2006-01-12 02:06:34 +0000
commitfaef737b316775cbc6bba8271814b71486e67a7a (patch)
treed4c18e48eeb64e94c1a3c7d0f364709b2de6a5b4 /asn1
parent92c7c0524297ecd41a7d185687743f573c68f8f6 (diff)
Before we begin dissection, NULLify some global variables that might
contain ep_alloc()ed data from a previous dissection. Correctly fixes bug 651 (the previous fix was incorrect). svn path=/trunk/; revision=17015
Diffstat (limited to 'asn1')
-rw-r--r--asn1/h248/packet-h248-template.c325
1 files changed, 164 insertions, 161 deletions
diff --git a/asn1/h248/packet-h248-template.c b/asn1/h248/packet-h248-template.c
index 18da5ffbc0..189d9d2bbc 100644
--- a/asn1/h248/packet-h248-template.c
+++ b/asn1/h248/packet-h248-template.c
@@ -170,10 +170,10 @@ static const value_string package_name_vals[] = {
{ 0x0004, "tonedet H.248.1 Annex E" },
{ 0x0005, "dg H.248.1 Annex E" },
{ 0x0006, "dd H.248.1 Annex E" },
- { 0x0007, "cg H.248.1 Annex E" },
+ { 0x0007, "cg H.248.1 Annex E" },
{ 0x0008, "cd H.248.1 Annex E" },
{ 0x0009, "al H.248.1 Annex E" },
- { 0x000a, "ct H.248.1 Annex E" },
+ { 0x000a, "ct H.248.1 Annex E" },
{ 0x000b, "nt H.248.1 Annex E" },
{ 0x000c, "rtp H.248.1 Annex E" },
{ 0x000d, "tdmc H.248.1 Annex E" },
@@ -186,17 +186,17 @@ static const value_string package_name_vals[] = {
{ 0x0014, "dis H.248.3" }, /* H.248.3 */
{ 0x0015, "key H.248.3" },
{ 0x0016, "kp H.248.3" },
- { 0x0017, "labelkey H.248.3" },
+ { 0x0017, "labelkey H.248.3" },
{ 0x0018, "kf H.248.3" },
{ 0x0019, "ind H.248.3" },
{ 0x001a, "ks H.248.3" },
{ 0x001b, "anci H.248.3" },
{ 0x001c, "dtd H.248.6" }, /* H.248.6 */
{ 0x001d, "an H.248.7" }, /* H.248.7 */
- { 0x001e, "Bearer Characteristics Q.1950 Annex A" }, /* Q.1950 Annex A */
+ { 0x001e, "Bearer Characteristics Q.1950 Annex A" }, /* Q.1950 Annex A */
{ 0x001f, "Bearer Network Connection Cut Q.1950 Annex A" },
{ 0x0020, "Reuse Idle Q.1950 Annex A" },
- { 0x0021, "Generic Bearer Connection Q.1950 Annex A" },
+ { 0x0021, "Generic Bearer Connection Q.1950 Annex A" },
{ 0x0022, "Bearer Control Tunnelling Q.1950 Annex A" },
{ 0x0023, "Basic Call Progress Tones Q.1950 Annex A" },
{ 0x0024, "Expanded Call Progress Tones Q.1950 Annex A" },
@@ -217,23 +217,23 @@ static const value_string package_name_vals[] = {
{ 0x0033, "Advanced Audio Server (AAS Base)" }, /* H.248.9 */
{ 0x0034, "AAS Digit Collection" }, /* H.248.9 */
{ 0x0035, "AAS Recording" }, /* H.248.9 */
- { 0x0036, "AAS Segment Management" }, /* H.248.9 */
+ { 0x0036, "AAS Segment Management" }, /* H.248.9 */
{ 0x0037, "Quality Alert Ceasing" }, /* H.248.13 */
{ 0x0038, "Conferencing Tones Generation" }, /* H.248.27 */
{ 0x0039, "Diagnostic Tones Generation" }, /* H.248.27 */
{ 0x003a, "Carrier Tones Generation Package H.248.23" }, /* H.248.27 */
{ 0x003b, "Enhanced Alerting Package H.248.23" }, /* H.248.23 */
{ 0x003c, "Analog Display Signalling Package H.248.23" }, /* H.248.23 */
- { 0x003d, "Multi-Frequency Tone Generation Package H.248.24" }, /* H.248.24 */
+ { 0x003d, "Multi-Frequency Tone Generation Package H.248.24" }, /* H.248.24 */
{ 0x003e, "H.248.23Multi-Frequency Tone Detection Package H.248.24" }, /* H.248.24 */
- { 0x003f, "Basic CAS Package H.248.25" }, /* H.248.25 */
+ { 0x003f, "Basic CAS Package H.248.25" }, /* H.248.25 */
{ 0x0040, "Robbed Bit Signalling Package H.248.25" }, /* H.248.25 */
- { 0x0041, "Operator Services and Emgergency Services Package H.248.25" },
+ { 0x0041, "Operator Services and Emgergency Services Package H.248.25" },
{ 0x0042, "Operator Services Extension Package H.248.25" },
{ 0x0043, "Extended Analog Line Supervision Package H.248.26" },
- { 0x0044, "Automatic Metering Package H.248.26" },
- { 0x0045, "Inactivity Timer Package H.248.14" },
- { 0x0046, "3G Modification of Link Characteristics Bearer Capability" }, /* 3GPP TS 29.232 v4.4.0 */
+ { 0x0044, "Automatic Metering Package H.248.26" },
+ { 0x0045, "Inactivity Timer Package H.248.14" },
+ { 0x0046, "3G Modification of Link Characteristics Bearer Capability" }, /* 3GPP TS 29.232 v4.4.0 */
{ 0x0047, "Base Announcement Syntax H.248.9" },
{ 0x0048, "Voice Variable Syntax H.248.9" },
{ 0x0049, "Announcement Set Syntax H.248.9" },
@@ -243,8 +243,8 @@ static const value_string package_name_vals[] = {
{ 0x004d, "NAS outgoing package" },
{ 0x004e, "NAS control package" },
{ 0x004f, "NAS root package" },
- { 0x0050, "Profile Handling Package H.248.18" },
- { 0x0051, "Media Gateway Overload Control Package H.248.11" },
+ { 0x0050, "Profile Handling Package H.248.18" },
+ { 0x0051, "Media Gateway Overload Control Package H.248.11" },
{ 0x0052, "Extended DTMF Detection Package H.248.16" },
{ 0x0053, "Quiet Termination Line Test" },
{ 0x0054, "Loopback Line Test Response" }, /* H.248.17 */
@@ -265,9 +265,9 @@ static const value_string package_name_vals[] = {
{ 0x0063, "Extended H.324 Packages H.248.12 Annex A" },
{ 0x0064, "Extended H.245 Command Package H.248.12 Annex A" },
{ 0x0065, "Extended H.245 Indication Package H.248.12 Annex A" },
- { 0x0066, "Enhanced DTMF Detection Package H.248.16" },
- { 0x0067, "Connection Group Identity Package Q.1950 Annex E" },
- { 0x0068, "CTM Text Transport 3GPP TS 29.232 v5.2.0" },
+ { 0x0066, "Enhanced DTMF Detection Package H.248.16" },
+ { 0x0067, "Connection Group Identity Package Q.1950 Annex E" },
+ { 0x0068, "CTM Text Transport 3GPP TS 29.232 v5.2.0" },
{ 0x0069, "SPNE Control Package Q.115.0" },
{ 0x006a, "Semi-permanent Connection Package H.248.21" },
{ 0x006b, "Shared Risk Group Package H.248.22" },
@@ -295,7 +295,7 @@ static const value_string package_name_vals[] = {
{ 0x0081, "RTCP XR Burst Metrics Package H.248.30" },
{ 0x0082, "threegcsden 3G Circuit Switched Data" }, /* 3GPP TS 29.232 v5.6.0 */
{ 0x0083, "threegiptra 3G Circuit Switched Data" }, /* 3GPP TS 29.232 v5.6.0 */
- { 0x0084, "threegflex 3G Circuit Switched Data" }, /* 3GPP TS 29.232 v5.6.0 */
+ { 0x0084, "threegflex 3G Circuit Switched Data" }, /* 3GPP TS 29.232 v5.6.0 */
{ 0x0085, "H.248 PCMSB" },
{ 0x008a, "TIPHON Extended H.248/MEGACO Package" }, /* ETSI specification TS 101 3 */
{ 0x008b, "Differentiated Services Package" }, /* Annex A of ETSI TS 102 333 */
@@ -305,7 +305,7 @@ static const value_string package_name_vals[] = {
{ 0x008f, "NAT Traversal Package" }, /* Annex E of ETSI TS 102 333 */
{ 0x0090, "MPLS Package" }, /* Annex F of ETSI TS 102 333 */
{ 0x0091, "VLAN Package" }, /* Annex G of ETSI TS 102 333 */
- { 0x8000, "Ericsson IU" },
+ { 0x8000, "Ericsson IU" },
{ 0x8001, "Ericsson UMTS and GSM Circuit" },
{ 0x8002, "Ericsson Tone Generator Package" },
{ 0x8003, "Ericsson Line Test Package" },
@@ -318,31 +318,31 @@ static const value_string package_name_vals[] = {
{ 0x800a, "Nokia Bearer Characteristics Package" },
{0, NULL}
};
-/*
- * This table consist of PackageName + EventName and its's corresponding string
- *
+/*
+ * This table consist of PackageName + EventName and its's corresponding string
+ *
*/
static const value_string event_name_vals[] = {
{ 0x00000000, "Media stream properties H.248.1 Annex C" },
{ 0x00010000, "g H.248.1 Annex E" },
{ 0x00010001, "g, Cause" },
{ 0x00010002, "g, Signal Completion" },
- { 0x00210000, "Generic Bearer Connection Q.1950 Annex A" },
- { 0x00210001, "GB BNC change" },
+ { 0x00210000, "Generic Bearer Connection Q.1950 Annex A" },
+ { 0x00210001, "GB BNC change" },
{ 0x800a0000, "Nokia Bearer Characteristics Package" },
{0, NULL}
};
-/*
- * This table consist of PackageName + SignalName and its's corresponding string
+/*
+ * This table consist of PackageName + SignalName and its's corresponding string
*/
static const value_string signal_name_vals[] = {
{ 0x00000000, "Media stream properties H.248.1 Annex C" },
{ 0x00010000, "g H.248.1 Annex E" },
- { 0x00210000, "GB Generic Bearer Connection Q.1950 Annex A" },
- { 0x00210001, "GB Establish BNC" },
- { 0x00210002, "GB Modify BNC" },
- { 0x00210003, "GB Release BNC" },
+ { 0x00210000, "GB Generic Bearer Connection Q.1950 Annex A" },
+ { 0x00210001, "GB Establish BNC" },
+ { 0x00210002, "GB Modify BNC" },
+ { 0x00210003, "GB Release BNC" },
{ 0x800a0000, "Nokia Bearer Characteristics Package" },
{0, NULL}
};
@@ -591,15 +591,15 @@ static int dissect_h248_trx_id(gboolean implicit_tag, packet_info *pinfo, proto_
gint32 tag;
guint32 len;
guint32 i;
-
+
if(!implicit_tag){
offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL);
} else {
len=tvb_length_remaining(tvb, offset);
}
-
-
+
+
if (len > 8 || len < 1) {
THROW(BoundsError);
} else {
@@ -617,7 +617,7 @@ static int dissect_h248_trx_id(gboolean implicit_tag, packet_info *pinfo, proto_
proto_tree_add_uint(tree, hf_h248_transactionId, tvb, offset-len, len, (guint32)trx_id);
*trx_id_p = (guint32)trx_id;
}
- }
+ }
return offset;
}
@@ -629,15 +629,15 @@ static int dissect_h248_ctx_id(gboolean implicit_tag, packet_info *pinfo, proto_
guint32 len;
guint64 ctx_id = 0;
guint32 i;
-
+
if(!implicit_tag){
offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL);
} else {
len=tvb_length_remaining(tvb, offset);
}
-
-
+
+
if (len > 8 || len < 1) {
THROW(BoundsError);
} else {
@@ -645,14 +645,14 @@ static int dissect_h248_ctx_id(gboolean implicit_tag, packet_info *pinfo, proto_
ctx_id=(ctx_id<<8)|tvb_get_guint8(tvb, offset);
offset++;
}
-
+
if (ctx_id > 0xffffffff) {
proto_item* pi = proto_tree_add_text(tree, tvb, offset-len, len,
"contextId: %" PRIu64, ctx_id);
proto_item_set_expert_flags(pi, PI_MALFORMED, PI_WARN);
*ctx_id_p = 0xfffffffd;
-
+
} else {
proto_item* pi = proto_tree_add_uint(tree, hf_h248_context_id, tvb, offset-len, len, (guint32)ctx_id);
@@ -663,22 +663,22 @@ static int dissect_h248_ctx_id(gboolean implicit_tag, packet_info *pinfo, proto_
} else if ( ctx_id == ALL_CONTEXTS ) {
proto_item_set_text(pi,"contextId: * (All Contexts = 0xffffffff)");
}
-
+
*ctx_id_p = (guint32) ctx_id;
}
- }
-
+ }
+
return offset;
}
-static void
+static void
dissect_h248_annex_C_PDU(gboolean implicit_tag, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 name_minor) {
int offset = 0;
tvbuff_t *new_tvb;
int len;
-
+
switch ( name_minor ){
-
+
/*
* C.1 General Media Attributes
*/
@@ -746,8 +746,8 @@ dissect_h248_annex_C_PDU(gboolean implicit_tag, tvbuff_t *tvb, packet_info *pinf
/* RTPpayload */
offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_h248_package_annex_C_rtp_payload, NULL);
break;
-
-
+
+
/*
* C.2 MUX Properties
*/
@@ -767,8 +767,8 @@ dissect_h248_annex_C_PDU(gboolean implicit_tag, tvbuff_t *tvb, packet_info *pinf
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_h248_package_annex_C_h2250, &new_tvb);
/* XXX H.223 */
break;
-
-
+
+
/*
* C.3 General Bearer Properties
*/
@@ -791,12 +791,12 @@ dissect_h248_annex_C_PDU(gboolean implicit_tag, tvbuff_t *tvb, packet_info *pinf
}
}
break;
-
-
+
+
/*
* C.4 General ATM Properties
*/
-
+
case 0x4001:
/* AESA */
proto_tree_add_item(tree,hf_h248_package_annex_C_aesa,tvb,0,20,FALSE);
@@ -828,9 +828,9 @@ dissect_h248_annex_C_PDU(gboolean implicit_tag, tvbuff_t *tvb, packet_info *pinf
proto_tree_add_item(tree,hf_h248_package_annex_C_uppc,tvb,offset,1,FALSE);
offset++;
break;
-
-
-
+
+
+
case 0x9001: /* TMR */
offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_h248_package_annex_C_TMR, NULL);
break;
@@ -915,7 +915,7 @@ dissect_3G_User_Plane_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb, packet_info
break;
}
-
+
}
static const value_string BNCChar_vals[] = {
{ H248_TERM_TYPE_AAL1, "aal1" },
@@ -974,7 +974,7 @@ guint offset=0;
}
static guint32 packageandid;
-
+
static int dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
tvbuff_t *new_tvb;
proto_tree *package_tree=NULL;
@@ -983,7 +983,7 @@ static int dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offse
old_offset=offset;
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, &new_tvb);
-
+
if (new_tvb) {
/* this field is always 4 bytes so just read it into two integers */
name_major=tvb_get_ntohs(new_tvb, 0);
@@ -1001,7 +1001,7 @@ static int dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offse
}
-static int
+static int
dissect_h248_EventName(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
tvbuff_t *new_tvb;
proto_tree *package_tree=NULL;
@@ -1089,13 +1089,13 @@ dissect_h248_PropertyID(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet
}
*/
dissect_h248_package_data(implicit_tag, next_tvb, pinfo, tree, name_major, name_minor);
-
+
return end_offset;
}
-static int
+static int
dissect_h248_MtpAddress(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
tvbuff_t *new_tvb;
proto_tree *mtp_tree=NULL;
@@ -1121,7 +1121,7 @@ dissect_h248_MtpAddress(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet
proto_tree_add_uint(mtp_tree, hf_h248_mtpaddress_ni, tvb, old_offset, offset-old_offset, val&0x03);
proto_tree_add_uint(mtp_tree, hf_h248_mtpaddress_pc, tvb, old_offset, offset-old_offset, val>>2);
}
-
+
return offset;
}
@@ -1139,7 +1139,7 @@ static h248_msg_t* h248_msg(packet_info* pinfo, int offset) {
if (keep_persistent_data) {
gchar* key = ep_strdup_printf("%u-%i",framenum,offset);
-
+
if (( m = g_hash_table_lookup(msgs,key) )) {
m->commited = TRUE;
} else {
@@ -1147,7 +1147,7 @@ static h248_msg_t* h248_msg(packet_info* pinfo, int offset) {
m->framenum = framenum;
m->trxs = NULL;
m->commited = FALSE;
-
+
g_hash_table_insert(msgs,se_strdup(key),m);
}
} else {
@@ -1156,7 +1156,7 @@ static h248_msg_t* h248_msg(packet_info* pinfo, int offset) {
m->trxs = NULL;
m->commited = FALSE;
}
-
+
if (pinfo->net_src.type == AT_NONE) {
m->addr_label = "";
} else {
@@ -1164,7 +1164,7 @@ static h248_msg_t* h248_msg(packet_info* pinfo, int offset) {
address* dst = &(pinfo->net_dst);
address* lo_addr;
address* hi_addr;
-
+
if (CMP_ADDRESS(src, dst) < 0) {
lo_addr = src;
hi_addr = dst;
@@ -1172,10 +1172,10 @@ static h248_msg_t* h248_msg(packet_info* pinfo, int offset) {
lo_addr = dst;
hi_addr = src;
}
-
+
m->addr_label = ep_strdup_printf("%s<->%s",address_to_str(lo_addr),address_to_str(hi_addr));
}
-
+
return m;
}
@@ -1184,23 +1184,23 @@ static h248_trx_t* h248_trx(h248_msg_t* m ,guint32 t_id , h248_trx_type_t type)
h248_trx_msg_t* trxmsg;
if ( !m ) return NULL;
-
+
if (keep_persistent_data) {
if (m->commited) {
-
+
for ( trxmsg = m->trxs; trxmsg; trxmsg = trxmsg->next) {
if (trxmsg->trx && trxmsg->trx->id == t_id) {
return trxmsg->trx;
}
}
-
+
DISSECTOR_ASSERT(! "a trx that should exist does not!" );
-
+
} else {
gchar* key = ep_strdup_printf("T%s:%.8x",m->addr_label,t_id);
trxmsg = se_alloc(sizeof(h248_trx_msg_t));
t = g_hash_table_lookup(trxs,key);
-
+
if (!t) {
t = se_alloc(sizeof(h248_trx_t));
t->key = se_strdup(key);
@@ -1209,10 +1209,10 @@ static h248_trx_t* h248_trx(h248_msg_t* m ,guint32 t_id , h248_trx_type_t type)
t->pendings = 0;
t->error = 0;
t->cmds = NULL;
-
+
g_hash_table_insert(trxs,t->key,t);
}
-
+
/* XXX: request, reply and ack + point to frames where they are */
switch ( type ) {
case H248_TRX_PENDING:
@@ -1221,7 +1221,7 @@ static h248_trx_t* h248_trx(h248_msg_t* m ,guint32 t_id , h248_trx_type_t type)
default:
break;
}
-
+
}
} else {
t = ep_new(h248_trx_t);
@@ -1237,32 +1237,32 @@ static h248_trx_t* h248_trx(h248_msg_t* m ,guint32 t_id , h248_trx_type_t type)
trxmsg->trx = t;
trxmsg->next = NULL;
trxmsg->last = trxmsg;
-
+
if (m->trxs) {
m->trxs->last = m->trxs->last->next = trxmsg;
} else {
m->trxs = trxmsg;
}
-
- return t;
+
+ return t;
}
static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
h248_ctx_t* context = NULL;
h248_ctx_t** context_p = NULL;
-
+
if ( !m || !t ) return NULL;
if (keep_persistent_data) {
if (m->commited) {
gchar* key = ep_strdup_printf("%s:%.8x",m->addr_label,c_id);
-
+
if (( context = g_hash_table_lookup(ctxs_by_trx,t->key) )) {
return context;
} if ((context_p = g_hash_table_lookup(ctxs,key))) {
context = *context_p;
-
+
do {
if (context->first_frame <= m->framenum) {
return context;
@@ -1282,13 +1282,13 @@ static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
context->terms.last = &(context->terms);
context->terms.next = NULL;
context->terms.term = NULL;
-
+
g_hash_table_insert(ctxs_by_trx,t->key,context);
}
} else {
gchar* key = ep_strdup_printf("C%s:%.8x",m->addr_label,c_id);
-
+
if (( context = g_hash_table_lookup(ctxs_by_trx,t->key) )) {
if (( context_p = g_hash_table_lookup(ctxs,key) )) {
if (context != *context_p) {
@@ -1300,7 +1300,7 @@ static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
context->terms.last = &(context->terms);
context->terms.next = NULL;
context->terms.term = NULL;
-
+
context->prev = *context_p;
*context_p = context;
}
@@ -1309,7 +1309,7 @@ static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
*context_p = context;
context->key = se_strdup(key);
context->id = c_id;
- g_hash_table_insert(ctxs,context->key,context_p);
+ g_hash_table_insert(ctxs,context->key,context_p);
}
} else if (! ( context_p = g_hash_table_lookup(ctxs,key) )) {
context = se_alloc(sizeof(h248_ctx_t));
@@ -1320,10 +1320,10 @@ static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
context->terms.last = &(context->terms);
context->terms.next = NULL;
context->terms.term = NULL;
-
+
context_p = se_alloc(sizeof(void*));
*context_p = context;
- g_hash_table_insert(ctxs,context->key,context_p);
+ g_hash_table_insert(ctxs,context->key,context_p);
} else {
context = *context_p;
}
@@ -1346,22 +1346,22 @@ static h248_cmd_t* h248_cmd(h248_msg_t* m, h248_trx_t* t, h248_ctx_t* c, h248_cm
h248_cmd_t* cmd;
h248_cmd_msg_t* cmdtrx;
h248_cmd_msg_t* cmdctx;
-
+
if ( !m || !t || !c) return NULL;
if (keep_persistent_data) {
if (m->commited) {
DISSECTOR_ASSERT(t->cmds != NULL);
-
+
for (cmdctx = t->cmds; cmdctx; cmdctx = cmdctx->next) {
cmd = cmdctx->cmd;
if (cmd->msg == m && cmd->offset == offset) {
return cmd;
}
}
-
+
DISSECTOR_ASSERT(!"called for a command that does not exist!");
-
+
return NULL;
} else {
cmd = se_alloc(sizeof(h248_cmd_t));
@@ -1374,7 +1374,6 @@ static h248_cmd_t* h248_cmd(h248_msg_t* m, h248_trx_t* t, h248_ctx_t* c, h248_cm
cmdctx = ep_new(h248_cmd_msg_t);
}
-
cmd->type = type;
cmd->offset = offset;
cmd->terms.term = NULL;
@@ -1388,9 +1387,8 @@ static h248_cmd_t* h248_cmd(h248_msg_t* m, h248_trx_t* t, h248_ctx_t* c, h248_cm
cmdctx->cmd = cmdtrx->cmd = cmd;
cmdctx->next = cmdtrx->next = NULL;
cmdctx->last = cmdtrx->last = NULL;
-
+
if (t->cmds) {
- DISSECTOR_ASSERT(t->cmds->last != NULL);
t->cmds->last->next = cmdtrx;
t->cmds->last = cmdtrx;
} else {
@@ -1399,14 +1397,13 @@ static h248_cmd_t* h248_cmd(h248_msg_t* m, h248_trx_t* t, h248_ctx_t* c, h248_cm
}
if (c->cmds) {
- DISSECTOR_ASSERT(c->cmds->last != NULL);
c->cmds->last->next = cmdctx;
c->cmds->last = cmdctx;
} else {
c->cmds = cmdctx;
c->cmds->last = cmdctx;
}
-
+
return cmd;
}
@@ -1416,13 +1413,13 @@ static h248_term_t* h248_cmd_add_term(h248_msg_t* m, h248_trx_t* tr, h248_cmd_t*
h248_terms_t* ct2;
static h248_term_t all_terms = {"$",(guint8*)"",1,H248_TERM_TYPE_UNKNOWN,NULL,NULL,NULL};
-
+
if ( !c ) return NULL;
if ( wildcard == H248_WILDCARD_CHOOSE) {
return &all_terms;
}
-
+
if (keep_persistent_data) {
if ( c->msg->commited ) {
if (wildcard == H248_WILDCARD_ALL) {
@@ -1448,24 +1445,24 @@ static h248_term_t* h248_cmd_add_term(h248_msg_t* m, h248_trx_t* tr, h248_cmd_t*
break;
}
}
-
+
if ( ! ct ) {
-
+
if (wildcard == H248_WILDCARD_ALL) {
ct = se_alloc(sizeof(h248_terms_t));
ct->next = NULL;
ct->term = se_alloc0(sizeof(h248_term_t));
-
+
ct->term->start = m;
ct->term->str = "*";
ct->term->buffer = NULL;
ct->term->len = 0;
-
+
c->terms.last = c->terms.last->next = ct;
-
+
ct2 = se_alloc0(sizeof(h248_terms_t));
ct2->term = ct->term;
-
+
c->ctx->terms.last->next = ct2;
c->ctx->terms.last = ct2;
@@ -1477,7 +1474,7 @@ static h248_term_t* h248_cmd_add_term(h248_msg_t* m, h248_trx_t* tr, h248_cmd_t*
ct->term->str = se_strdup(t->str);
ct->term->buffer = se_memdup(t->buffer,t->len);
ct->term->len = t->len;
-
+
ct2 = se_alloc0(sizeof(h248_terms_t));
ct2->term = ct->term;
@@ -1485,13 +1482,13 @@ static h248_term_t* h248_cmd_add_term(h248_msg_t* m, h248_trx_t* tr, h248_cmd_t*
return ct->term;
}
-
+
if ( g_str_equal(ct->term->str,t->str) ) {
ct2 = se_alloc0(sizeof(h248_terms_t));
ct2->term = ct->term;
-
+
c->terms.last = c->terms.last->next = ct2;
-
+
return ct->term;
}
}
@@ -1499,32 +1496,32 @@ static h248_term_t* h248_cmd_add_term(h248_msg_t* m, h248_trx_t* tr, h248_cmd_t*
ct = se_alloc(sizeof(h248_terms_t));
ct->next = NULL;
ct->term = se_alloc0(sizeof(h248_term_t));
-
+
ct->term->start = m;
ct->term->str = se_strdup(t->str);
ct->term->buffer = se_memdup(t->buffer,t->len);
ct->term->len = t->len;
-
+
ct2 = se_alloc0(sizeof(h248_terms_t));
ct2->term = ct->term;
-
+
c->terms.last = c->terms.last->next = ct2;
-
+
ct2 = se_alloc0(sizeof(h248_terms_t));
ct2->term = ct->term;
-
+
c->ctx->terms.last = c->ctx->terms.last->next = ct2;
-
+
return ct->term;
}
} else {
ct2 = se_alloc0(sizeof(h248_terms_t));
ct2->term = ct->term;
-
- c->terms.last = c->terms.last->next = ct2;
+
+ c->terms.last = c->terms.last->next = ct2;
return ct->term;
}
-
+
DISSECTOR_ASSERT_NOT_REACHED();
return NULL;
}
@@ -1533,7 +1530,7 @@ static h248_term_t* h248_cmd_add_term(h248_msg_t* m, h248_trx_t* tr, h248_cmd_t*
ct->term = t;
ct->next = NULL;
c->terms.last = c->terms.last->next = ct;
-
+
return t;
}
@@ -1542,7 +1539,7 @@ static h248_term_t* h248_cmd_add_term(h248_msg_t* m, h248_trx_t* tr, h248_cmd_t*
static gchar* h248_cmd_to_str(h248_cmd_t* c) {
gchar* s = "-";
h248_terms_t* term;
-
+
if ( !c ) return "-";
switch (c->type) {
@@ -1610,16 +1607,16 @@ static gchar* h248_cmd_to_str(h248_cmd_t* c) {
s = "ActionReply {";
break;
}
-
+
for (term = c->terms.next; term; term = term->next) {
s = ep_strdup_printf("%s %s",s,term->term->str);
};
-
+
if (c->error) {
s = ep_strdup_printf("%s Error=%i",s,c->error);
}
-
-
+
+
return ep_strdup_printf("%s }", s);
}
@@ -1629,20 +1626,20 @@ static gchar* h248_trx_to_str(h248_msg_t* m, h248_trx_t* t) {
if ( !m || !t ) return "-";
-
+
if (t->cmds) {
if (t->cmds->cmd->ctx) {
- s = ep_strdup_printf("%s C %x {",s,t->cmds->cmd->ctx->id);
-
+ s = ep_strdup_printf("%s C %x {",s,t->cmds->cmd->ctx->id);
+
for (c = t->cmds; c; c = c->next) {
if (c->cmd->msg == m)
s = ep_strdup_printf("%s %s",s,h248_cmd_to_str(c->cmd));
}
-
+
s = ep_strdup_printf("%s %s",s,"}");
}
}
-
+
if (t->error) {
s = ep_strdup_printf("%s Error=%i",s,t->error);
}
@@ -1650,10 +1647,10 @@ static gchar* h248_trx_to_str(h248_msg_t* m, h248_trx_t* t) {
return ep_strdup_printf("%s %s",s,"}");
}
-static gchar* h248_msg_to_str(h248_msg_t* m) {
+static gchar* h248_msg_to_str(h248_msg_t* m) {
h248_trx_msg_t* t;
gchar* s = "";
-
+
if ( !m ) return "-";
for (t = m->trxs; t; t = t->next) {
@@ -1675,8 +1672,8 @@ static void analyze_h248_msg(h248_msg_t* m) {
h248_ctxs_t contexts = {NULL,NULL};
h248_ctxs_t* ctx_node;
h248_cmd_msg_t* c;
-
-
+
+
for (t = m->trxs; t; t = t->next) {
for (c = t->trx->cmds; c; c = c->next) {
h248_ctx_t* ctx = c->cmd->ctx;
@@ -1686,7 +1683,7 @@ static void analyze_h248_msg(h248_msg_t* m) {
break;
}
}
-
+
if (! ctx_node) {
ctx_node = ep_new(h248_ctxs_t);
ctx_node->ctx = ctx;
@@ -1718,7 +1715,7 @@ static void analyze_h248_msg(h248_msg_t* m) {
}
}
}
-
+
if (( ctx_term = ctx->terms.next )) {
proto_item* terms_item = proto_tree_add_text(ctx_tree,h248_tvb,0,0,"[ Terminations Used ]");
proto_tree* terms_tree = proto_item_add_subtree(terms_item,ett_ctx_terms);
@@ -1727,24 +1724,24 @@ static void analyze_h248_msg(h248_msg_t* m) {
if ( ctx_term->term && ctx_term->term->str) {
proto_item* pi = proto_tree_add_string(terms_tree,hf_h248_ctx_term,h248_tvb,0,0,ctx_term->term->str);
proto_tree* term_tree = proto_item_add_subtree(pi,ett_ctx_term);
-
+
PROTO_ITEM_SET_GENERATED(pi);
-
+
if (ctx_term->term->type) {
pi = proto_tree_add_uint(term_tree,hf_h248_ctx_term_type,h248_tvb,0,0,ctx_term->term->type);
PROTO_ITEM_SET_GENERATED(pi);
}
-
+
if (ctx_term->term->bir) {
pi = proto_tree_add_string(term_tree,hf_h248_ctx_term_bir,h248_tvb,0,0,ctx_term->term->bir);
PROTO_ITEM_SET_GENERATED(pi);
}
-
+
if (ctx_term->term->nsap) {
pi = proto_tree_add_string(term_tree,hf_h248_ctx_term_nsap,h248_tvb,0,0,ctx_term->term->nsap);
PROTO_ITEM_SET_GENERATED(pi);
}
-
+
if (ctx_term->term->bir && ctx_term->term->nsap) {
gchar* key = ep_strdup_printf("%s:%s",ctx_term->term->nsap,ctx_term->term->bir);
g_strdown(key);
@@ -1765,10 +1762,16 @@ static void
dissect_h248(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *h248_item;
-
+
h248_tree = NULL;
h248_tvb = NULL;
-
+
+ msg = NULL;
+ trx = NULL;
+ ctx = NULL;
+ cmd = NULL;
+ term = NULL;
+
/* Check if it is actually a text based h248 encoding, which we call
megaco in ehtereal.
*/
@@ -1784,35 +1787,35 @@ dissect_h248(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
-
+
/* Make entry in the Protocol column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "H.248");
-
+
if (tree) {
h248_item = proto_tree_add_item(tree, proto_h248, tvb, 0, -1, FALSE);
h248_tree = proto_item_add_subtree(h248_item, ett_h248);
}
-
+
dissect_h248_MegacoMessage(FALSE, tvb, 0, pinfo, h248_tree, -1);
-
+
}
static void h248_init(void) {
-
+
if (msgs) g_hash_table_destroy(msgs);
msgs = g_hash_table_new(g_str_hash,g_str_equal);
-
+
if (trxs) g_hash_table_destroy(trxs);
trxs = g_hash_table_new(g_str_hash,g_str_equal);
-
+
if (ctxs_by_trx) g_hash_table_destroy(ctxs_by_trx);
ctxs_by_trx = g_hash_table_new(g_str_hash,g_str_equal);
if (ctxs) g_hash_table_destroy(ctxs);
ctxs = g_hash_table_new(g_str_hash,g_str_equal);
-
+
}
/*--- proto_register_h248 ----------------------------------------------*/
@@ -1839,7 +1842,7 @@ void proto_register_h248(void) {
{ "BNCChar", "h248.package_bcp.BNCChar",
FT_UINT32, BASE_DEC, VALS(BNCChar_vals), 0,
"BNCChar", HFILL }},
-
+
{ &hf_h248_package_annex_C_media,
{ "Media", "h248.package_annex_C.media",
FT_UINT32, BASE_HEX, VALS(h248_annex_C_media_vals), 0,
@@ -1971,7 +1974,7 @@ void proto_register_h248(void) {
{ &hf_h248_package_annex_C_sc,
{ "Service Class", "h248.package_annex_C.sc",
FT_UINT32, BASE_DEC, NULL, 0,
- "Service Class", HFILL }},
+ "Service Class", HFILL }},
{ &hf_h248_package_annex_C_bcob,
{ "BCOB", "h248.package_annex_C.bcob",
FT_UINT8, BASE_DEC, NULL, 0x1F,
@@ -1979,7 +1982,7 @@ void proto_register_h248(void) {
{ &hf_h248_package_annex_C_bbtc,
{ "BBTC", "h248.package_annex_C.bbtc",
FT_UINT8, BASE_DEC, NULL, 0x3F,
- "Broadband Transfer Capability", HFILL }},
+ "Broadband Transfer Capability", HFILL }},
{ &hf_h248_package_annex_C_atc,
{ "ATC", "h248.package_annex_C.atc",
FT_UINT32, BASE_DEC, VALS(h248_package_annex_C_atc_values), 0x0,
@@ -1987,15 +1990,15 @@ void proto_register_h248(void) {
{ &hf_h248_package_annex_C_stc,
{ "STC", "h248.package_annex_C.stc",
FT_UINT8, BASE_DEC, VALS(h248_package_annex_C_stc_values), 0x03,
- "Susceptibility to Clipping", HFILL }},
+ "Susceptibility to Clipping", HFILL }},
{ &hf_h248_package_annex_C_uppc,
{ "UPPC", "h248.package_annex_C.uppc",
FT_UINT8, BASE_DEC, VALS(h248_package_annex_C_uppc_values), 0x03,
- "User Plane Connection Configuration", HFILL }},
+ "User Plane Connection Configuration", HFILL }},
+
+
+
-
-
-
{ &hf_h248_error_code,
{ "errorCode", "h248.errorCode",
FT_UINT32, BASE_DEC, VALS(h248_reasons), 0,
@@ -2041,7 +2044,7 @@ void proto_register_h248(void) {
&ett_ctx_term,
#include "packet-h248-ettarr.c"
};
-
+
module_t *h248_module;
@@ -2059,7 +2062,7 @@ void proto_register_h248(void) {
h248_package_events = g_hash_table_new(g_hash_direct,g_direct_equal);
h248_package_properties = g_hash_table_new(g_hash_direct,g_direct_equal);
#endif
-
+
#if 1
h248_module = prefs_register_protocol(proto_h248, h248_init);
prefs_register_bool_preference(h248_module, "ctx_info",
@@ -2067,7 +2070,7 @@ void proto_register_h248(void) {
"Whether persistent context information is to be kept",
&keep_persistent_data);
#endif
-
+
register_init_routine( &h248_init );
}