aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2007-03-03 16:36:19 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2007-03-03 16:36:19 +0000
commit76518e6d1b34a2e52731b6f662fbde463541066a (patch)
treed3d975fb6c435a105b1a442fd82f0fc465b80f97 /epan
parentebf5874d29bb913c13faf8b196a42af75ba52203 (diff)
+ improve dissection of PkdName
+ complete H.248.1 E.1 Generic Package svn path=/trunk/; revision=20965
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-h248.c129
-rw-r--r--epan/dissectors/packet-h248.h4
-rw-r--r--epan/dissectors/packet-h248_annex_e.c52
3 files changed, 163 insertions, 22 deletions
diff --git a/epan/dissectors/packet-h248.c b/epan/dissectors/packet-h248.c
index b3ab84339d..ff6776575b 100644
--- a/epan/dissectors/packet-h248.c
+++ b/epan/dissectors/packet-h248.c
@@ -1,6 +1,6 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
-/* ./packet-h248.c */
+/* .\packet-h248.c */
/* ../../tools/asn2wrs.py -b -e -p h248 -c h248.cnf -s packet-h248-template h248v3.asn */
/* Input file: packet-h248-template.c */
@@ -49,6 +49,8 @@ static int hf_h248_pkg_name = -1;
static int hf_248_pkg_param = -1;
static int hf_h248_event_name = -1;
static int hf_h248_signal_name = -1;
+static int hf_h248_signal_code = -1;
+static int hf_h248_event_code = -1;
static int hf_h248_pkg_bcp_BNCChar_PDU = -1;
@@ -383,7 +385,7 @@ static int hf_h248_NotifyCompletion_otherReason = -1;
static int hf_h248_NotifyCompletion_onIteration = -1;
/*--- End of included file: packet-h248-hf.c ---*/
-#line 70 "packet-h248-template.c"
+#line 72 "packet-h248-template.c"
/* Initialize the subtree pointers */
static gint ett_h248 = -1;
@@ -546,7 +548,7 @@ static gint ett_h248_TimeNotation = -1;
static gint ett_h248_Value = -1;
/*--- End of included file: packet-h248-ett.c ---*/
-#line 89 "packet-h248-template.c"
+#line 91 "packet-h248-template.c"
static dissector_handle_t h248_term_handle;
@@ -1052,6 +1054,76 @@ static const h248_pkg_sig_t no_signal = { 0, &hf_h248_no_sig, &ett_h248_no_sig,
static const h248_pkg_param_t no_param = { 0, &hf_h248_param, h248_param_item, NULL };
static const h248_pkg_evt_t no_event = { 0, &hf_h248_no_evt, &ett_h248_no_evt, NULL, NULL };
+static GPtrArray* packages = NULL;
+
+extern void h248_param_PkgdName(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo , int hfid _U_, h248_curr_info_t* u _U_, void* dissector_hdl) {
+ tvbuff_t *new_tvb = NULL;
+ proto_tree *package_tree=NULL;
+ guint16 name_major, name_minor;
+ int old_offset;
+ const h248_package_t* pkg = NULL;
+ guint i;
+ gint8 class;
+ gboolean pc, ind;
+ gint32 tag;
+ guint32 len;
+ int offset = 0;
+
+ old_offset=offset;
+ offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
+ offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, &ind);
+
+ if( (class!=BER_CLASS_UNI)
+ ||(tag!=BER_UNI_TAG_OCTETSTRING) ){
+ proto_tree_add_text(tree, tvb, offset-2, 2, "H.248 BER Error: OctetString expected but Class:%d PC:%d Tag:%d was unexpected", class, pc, tag);
+ return;
+ }
+
+ new_tvb = tvb_new_subset(tvb,offset,len,len);
+
+ if (new_tvb) {
+ /* this field is always 4 bytes so just read it into two integers */
+ name_major=tvb_get_ntohs(new_tvb, 0);
+ name_minor=tvb_get_ntohs(new_tvb, 2);
+
+ /* do the prettification */
+ proto_item_append_text(ber_last_created_item, " %s (%04x)", val_to_str(name_major, package_name_vals, "Unknown Package"), name_major);
+
+ if(tree){
+ proto_item* pi;
+ const gchar* strval;
+
+ package_tree = proto_item_add_subtree(ber_last_created_item, ett_packagename);
+ proto_tree_add_uint(package_tree, hf_h248_pkg_name, tvb, offset-4, 2, name_major);
+
+ for(i=0; i < packages->len; i++) {
+ pkg = g_ptr_array_index(packages,i);
+
+ if (name_major == pkg->id) {
+ break;
+ } else {
+ pkg = NULL;
+ }
+ }
+
+ if (! pkg ) pkg = &no_package;
+
+
+ pi = proto_tree_add_uint(package_tree, hf_248_pkg_param, tvb, offset-2, 2, name_minor);
+
+ if (pkg->signal_names && ( strval = match_strval(name_minor, pkg->signal_names) )) {
+ strval = ep_strdup_printf("%s (%d)",strval,name_minor);
+ } else {
+ strval = ep_strdup_printf("Unknown (%d)",name_minor);
+ }
+
+ proto_item_set_text(pi,"Parameter: %s", strval);
+ }
+
+ }
+}
+
+
static int dissect_h248_trx_id(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, guint32* trx_id_p) {
guint64 trx_id = 0;
gint8 class;
@@ -1139,8 +1211,6 @@ static int dissect_h248_ctx_id(gboolean implicit_tag, packet_info *pinfo, proto_
return offset;
}
-static GPtrArray* packages = NULL;
-
void h248_register_package(const h248_package_t* pkg) {
if (! packages) packages = g_ptr_array_new();
@@ -1209,7 +1279,6 @@ static int dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offse
return offset;
}
-
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;
@@ -1233,7 +1302,7 @@ static int dissect_h248_EventName(gboolean implicit_tag, tvbuff_t *tvb, int offs
if(tree){
package_tree = proto_item_add_subtree(ber_last_created_item, ett_packagename);
}
- proto_tree_add_uint(package_tree, hf_h248_event_name, tvb, offset-4, 4, packageandid);
+ proto_tree_add_uint(package_tree, hf_h248_pkg_name, tvb, offset-4, 2, name_major);
for(i=0; i < packages->len; i++) {
@@ -1264,6 +1333,19 @@ static int dissect_h248_EventName(gboolean implicit_tag, tvbuff_t *tvb, int offs
curr_info.evt = evt;
+ {
+ proto_item* pi = proto_tree_add_uint(package_tree, hf_h248_event_code, tvb, offset-2, 2, name_minor);
+ const gchar* strval;
+
+ if (pkg->signal_names && ( strval = match_strval(name_minor, pkg->signal_names) )) {
+ strval = ep_strdup_printf("%s (%d)",strval,name_minor);
+ } else {
+ strval = ep_strdup_printf("Unknown (%d)",name_minor);
+ }
+
+ proto_item_set_text(pi,"Event ID: %s", strval);
+ }
+
} else {
curr_info.pkg = &no_package;
curr_info.evt = &no_event;
@@ -1297,7 +1379,7 @@ static int dissect_h248_SignalName(gboolean implicit_tag , tvbuff_t *tvb, int of
if(tree){
package_tree = proto_item_add_subtree(ber_last_created_item, ett_packagename);
}
- proto_tree_add_uint(package_tree, hf_h248_signal_name, tvb, offset-4, 4, packageandid);
+ proto_tree_add_uint(package_tree, hf_h248_pkg_name, tvb, offset-4, 2, name_major);
for(i=0; i < packages->len; i++) {
pkg = g_ptr_array_index(packages,i);
@@ -1327,6 +1409,19 @@ static int dissect_h248_SignalName(gboolean implicit_tag , tvbuff_t *tvb, int of
curr_info.sig = &no_signal;
}
+ {
+ proto_item* pi = proto_tree_add_uint(package_tree, hf_h248_signal_code, tvb, offset-2, 2, name_minor);
+ const gchar* strval;
+
+ if (pkg->signal_names && ( strval = match_strval(name_minor, pkg->signal_names) )) {
+ strval = ep_strdup_printf("%s (%d)",strval,name_minor);
+ } else {
+ strval = ep_strdup_printf("Unknown (%d)",name_minor);
+ }
+
+ proto_item_set_text(pi,"Signal ID: %s", strval);
+ }
+
} else {
curr_info.pkg = &no_package;
curr_info.sig = &no_signal;
@@ -6350,7 +6445,7 @@ dissect_h248_ServiceChangeReasonStr(gboolean implicit_tag _U_, tvbuff_t *tvb, in
/*--- End of included file: packet-h248-fn.c ---*/
-#line 1763 "packet-h248-template.c"
+#line 1858 "packet-h248-template.c"
static void
dissect_h248(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -6436,6 +6531,12 @@ void proto_register_h248(void) {
{ &hf_248_pkg_param, {
"Parameter ID", "h248.package_paramid", FT_UINT16, BASE_HEX,
NULL, 0, "Parameter ID", HFILL }},
+ { &hf_h248_signal_code, {
+ "Signal ID", "h248.package_signalid", FT_UINT16, BASE_HEX,
+ NULL, 0, "Parameter ID", HFILL }},
+ { &hf_h248_event_code, {
+ "Event ID", "h248.package_eventid", FT_UINT16, BASE_HEX,
+ NULL, 0, "Parameter ID", HFILL }},
{ &hf_h248_event_name, {
"Package and Event name", "h248.event_name", FT_UINT32, BASE_HEX,
VALS(event_name_vals), 0, "Package", HFILL }},
@@ -7706,7 +7807,7 @@ void proto_register_h248(void) {
"", HFILL }},
/*--- End of included file: packet-h248-hfarr.c ---*/
-#line 1902 "packet-h248-template.c"
+#line 2003 "packet-h248-template.c"
{ &hf_h248_ctx, { "Context", "h248.ctx", FT_UINT32, BASE_HEX, NULL, 0, "", HFILL }},
{ &hf_h248_ctx_term, { "Termination", "h248.ctx.term", FT_STRING, BASE_NONE, NULL, 0, "", HFILL }},
@@ -7728,9 +7829,9 @@ void proto_register_h248(void) {
&ett_ctx_cmds,
&ett_ctx_terms,
&ett_ctx_term,
- &ett_h248_no_pkg,
- &ett_h248_no_sig,
- &ett_h248_no_evt,
+ &ett_h248_no_pkg,
+ &ett_h248_no_sig,
+ &ett_h248_no_evt,
/*--- Included file: packet-h248-ettarr.c ---*/
#line 1 "packet-h248-ettarr.c"
@@ -7875,7 +7976,7 @@ void proto_register_h248(void) {
&ett_h248_Value,
/*--- End of included file: packet-h248-ettarr.c ---*/
-#line 1927 "packet-h248-template.c"
+#line 2028 "packet-h248-template.c"
};
module_t *h248_module;
diff --git a/epan/dissectors/packet-h248.h b/epan/dissectors/packet-h248.h
index 9e7815994c..c9e526ac99 100644
--- a/epan/dissectors/packet-h248.h
+++ b/epan/dissectors/packet-h248.h
@@ -1,6 +1,6 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
-/* ./packet-h248.h */
+/* .\packet-h248.h */
/* ../../tools/asn2wrs.py -b -e -p h248 -c h248.cnf -s packet-h248-template h248v3.asn */
/* Input file: packet-h248-template.h */
@@ -195,7 +195,7 @@ extern void h248_param_ber_integer(proto_tree*, tvbuff_t*, packet_info* , int, h
extern void h248_param_ber_octetstring(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* ignored);
extern void h248_param_ber_boolean(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* ignored);
extern void external_dissector(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* dissector_handle);
-
+extern void h248_param_PkgdName(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo , int hfid _U_, h248_curr_info_t* u _U_, void* dissector_hdl);
typedef struct _h248_pkg_param_t {
guint32 id;
diff --git a/epan/dissectors/packet-h248_annex_e.c b/epan/dissectors/packet-h248_annex_e.c
index 3dd4b940be..b062f664e8 100644
--- a/epan/dissectors/packet-h248_annex_e.c
+++ b/epan/dissectors/packet-h248_annex_e.c
@@ -41,10 +41,15 @@ static int hf_h248_pkg_generic = -1;
static int hf_h248_pkg_generic_cause_evt = -1;
static int hf_h248_pkg_generic_cause_gencause = -1;
static int hf_h248_pkg_generic_cause_failurecause = -1;
+static int hf_h248_pkg_generic_sc_evt = -1;
+static int hf_h248_pkg_generic_sc_sig_id = -1;
+static int hf_h248_pkg_generic_sc_meth = -1;
+static int hf_h248_pkg_generic_sc_slid = -1;
+static int hf_h248_pkg_generic_sc_rid = -1;
static gint ett_h248_pkg_generic_cause_evt = -1;
-static gint ett_tdmc = -1;
static gint ett_h248_pkg_generic = -1;
+static int ett_h248_pkg_generic_sc_evt = -1;
static const value_string h248_pkg_generic_cause_vals[] = {
{1, "gencause"},
@@ -53,7 +58,8 @@ static const value_string h248_pkg_generic_cause_vals[] = {
};
static const value_string h248_pkg_generic_evt_vals[] = {
- {1, "generic_cause"},
+ {1, "Cause"},
+ {2, "Signal Completion"},
{ 0, NULL }
};
@@ -73,12 +79,37 @@ static h248_pkg_param_t h248_pkg_generic_cause_evt_params[] = {
{ 0, NULL, NULL, NULL}
};
+static const value_string h248_pkg_generic_sc_meth_vals[] = {
+ {0x0001,"SigID"},
+ {0x0002,"Meth"},
+ {0x0003,"SLID"},
+ {0x0004,"RID"},
+ {0,NULL}
+};
+
+static const value_string h248_pkg_generic_sc_vals[] = {
+ {0x0001,"TO - Signal timed out or otherwise completed on its own"},
+ {0x0002,"EV - Interrupted by event"},
+ {0x0003,"SD - Halted by new Signals Descriptor"},
+ {0x0004,"NC - Not completed, other cause"},
+ {0x0005,"PI - First to penultimate iteration"},
+ {0,NULL}
+};
+
+static h248_pkg_param_t h248_pkg_generic_sc_evt_params[] = {
+ { 0x0001, &hf_h248_pkg_generic_sc_sig_id, h248_param_PkgdName, NULL },
+ { 0x0002, &hf_h248_pkg_generic_sc_meth, h248_param_ber_integer, NULL },
+ { 0x0003, &hf_h248_pkg_generic_sc_slid, h248_param_ber_integer, NULL },
+ { 0x0004, &hf_h248_pkg_generic_sc_rid, h248_param_ber_integer, NULL },
+ { 0, NULL, NULL, NULL}
+};
+
static h248_pkg_evt_t h248_pkg_generic_cause_evts[] = {
{ 0x0001, &hf_h248_pkg_generic_cause_evt, &ett_h248_pkg_generic_cause_evt, h248_pkg_generic_cause_evt_params, h248_pkg_generic_cause_gencause_vals},
+ { 0x0002, &hf_h248_pkg_generic_sc_evt, &ett_h248_pkg_generic_sc_evt, h248_pkg_generic_sc_evt_params, h248_pkg_generic_sc_vals},
{ 0, NULL, NULL, NULL, NULL}
};
-
static h248_package_t h248_pkg_generic = {
0x0001,
&hf_h248_pkg_generic,
@@ -94,7 +125,7 @@ static h248_package_t h248_pkg_generic = {
};
-/* H.248.1 E.2 Base Root Package
+/* H.248.1 E.2 Base Root Package
static int hf_h248_pkg_root = -1;
static int hf_h248_pkg_root_params = -1;
static int hf_h248_pkg_root_maxnrofctx = -1;
@@ -119,13 +150,17 @@ static h248_package_t h248_pkg_root = {
&hf_h248_pkg_root,
&hf_h248_pkg_root_params,
&ett_h248_pkg_root,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
h248_pkg_root_properties,
NULL,
NULL,
NULL,
NULL
};
-*/
+/**/
/* H.248.1 E.3 Tone Generator Package
static int hf_h248_pkg_tonegen = -1;
@@ -209,6 +244,7 @@ static h248_package_t h248_pkg_dg = {
NULL /* statistics */
};
+
/* H.248.1 E.9 Analog Line Supervision Package */
static int hf_h248_pkg_al = -1;
static int hf_h248_pkg_al_evt_onhook = -1;
@@ -402,6 +438,11 @@ void proto_register_h248_annex_e(void) {
{ &hf_h248_pkg_generic_cause_evt, { "Cause Event", "h248.pkg.generic.cause", FT_BYTES, BASE_HEX, NULL, 0, "", HFILL }},
{ &hf_h248_pkg_generic_cause_gencause, { "Generic Cause", "h248.pkg.generic.cause.gencause", FT_UINT32, BASE_HEX, VALS(h248_pkg_generic_cause_gencause_vals), 0, "", HFILL }},
{ &hf_h248_pkg_generic_cause_failurecause, { "Generic Cause", "h248.pkg.generic.cause.failurecause", FT_STRING, BASE_HEX, NULL, 0, "", HFILL }},
+ {&hf_h248_pkg_generic_sc_evt, {"Signal Completion","h248.pkg.generic.sc",FT_BYTES, BASE_HEX, NULL, 0, "", HFILL}},
+ { &hf_h248_pkg_generic_sc_sig_id, { "Signal Identity", "h248.pkg.generic.sc.sig_id", FT_BYTES, BASE_HEX, NULL , 0, "", HFILL }},
+ { &hf_h248_pkg_generic_sc_meth, { "Termination Method", "h248.pkg.generic.sc.meth", FT_UINT32, BASE_DEC, VALS(h248_pkg_generic_sc_vals) , 0, "", HFILL }},
+ { &hf_h248_pkg_generic_sc_slid, { "Signal List ID", "h248.pkg.generic.sc.slid", FT_UINT32, BASE_DEC, NULL , 0, "", HFILL }},
+ { &hf_h248_pkg_generic_sc_rid, { "Request ID", "h248.pkg.generic.sc.rid", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }},
/* H.248.1 E.9 Analog Line Supervision Package */
{ &hf_h248_pkg_al, { "Analog Line Supervision Package", "h248.pkg.al", FT_BYTES, BASE_HEX, NULL, 0, "", HFILL }},
{ &hf_h248_pkg_al_evt_onhook, { "onhook", "h248.pkg.al.onhook", FT_BYTES, BASE_HEX, NULL, 0, "", HFILL }},
@@ -435,7 +476,6 @@ void proto_register_h248_annex_e(void) {
&ett_h248_pkg_al_evt_onhook,
&ett_h248_pkg_rtp,
- &ett_tdmc
};
proto_h248_annex_E = proto_register_protocol(PNAME, PSNAME, PFNAME);