aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'asn1')
-rw-r--r--asn1/h248-package-bcp/BCP.asn16
-rw-r--r--asn1/h248-package-bcp/h248_package_bcp.cnf21
-rw-r--r--asn1/h248-package-bcp/packet-h248_package_bcp-template.c88
-rw-r--r--asn1/h248-package-bcp/packet-h248_package_bcp-template.h32
-rw-r--r--asn1/h248/packet-h248-template.c38
5 files changed, 193 insertions, 2 deletions
diff --git a/asn1/h248-package-bcp/BCP.asn b/asn1/h248-package-bcp/BCP.asn
new file mode 100644
index 0000000000..e48996f597
--- /dev/null
+++ b/asn1/h248-package-bcp/BCP.asn
@@ -0,0 +1,16 @@
+-- This ASN definition is implemented from hand from itu-t documents
+
+MEDIA-GATEWAY-CONTROL-BCP {itu-t(0) recommendation(0) h(8) h248(248)
+modules(0) media-gateway-control(0) version2(2)}
+DEFINITIONS AUTOMATIC TAGS ::=
+BEGIN
+
+BNCChar ::= ENUMERATED {
+ aal1(1),
+ aal2(2),
+ aal1struct(3),
+ ipRtp(4),
+ tdm(5)
+}
+
+END
diff --git a/asn1/h248-package-bcp/h248_package_bcp.cnf b/asn1/h248-package-bcp/h248_package_bcp.cnf
new file mode 100644
index 0000000000..3696c8e69d
--- /dev/null
+++ b/asn1/h248-package-bcp/h248_package_bcp.cnf
@@ -0,0 +1,21 @@
+# h248-package-bcp.cnf
+# H.248-package-bcp conformation file
+
+# $Id: h248_package_bcp.cnf 12205 2004-10-05 09:50:19Z sahlberg $
+
+#.MODULE_IMPORT
+
+#.EXPORTS
+
+#.PDU
+BNCChar
+
+#.NO_EMIT
+
+#.TYPE_RENAME
+
+#.FIELD_RENAME
+
+#.END
+
+
diff --git a/asn1/h248-package-bcp/packet-h248_package_bcp-template.c b/asn1/h248-package-bcp/packet-h248_package_bcp-template.c
new file mode 100644
index 0000000000..139bf452a1
--- /dev/null
+++ b/asn1/h248-package-bcp/packet-h248_package_bcp-template.c
@@ -0,0 +1,88 @@
+/* packet-h248_package_bcp.c
+ * Routines for H.248/MEGACO-Package_bcp packet dissection
+ * Ronnie Sahlberg 2004
+ *
+ * $Id: packet-h248_package_bcp-template.c 12205 2004-10-05 09:50:19Z sahlberg $
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+#include <epan/packet.h>
+#include <epan/conversation.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "packet-ber.h"
+#include "packet-h248_package_bcp.h"
+
+#define PNAME "H.248 MEGACO/BCP"
+#define PSNAME "H248BCP"
+#define PFNAME "h248bcp"
+
+/* Initialize the protocol and registered fields */
+static int proto_h248_package_bcp = -1;
+#include "packet-h248_package_bcp-hf.c"
+
+/* Initialize the subtree pointers */
+static gint ett_h248_package_bcp = -1;
+/*#include "packet-h248_package_bcp-ett.c"*/
+
+
+#include "packet-h248_package_bcp-fn.c"
+
+
+/*--- proto_register_h248_package_bcp ----------------------------------------------*/
+void proto_register_h248_package_bcp(void) {
+
+ /* List of fields */
+ static hf_register_info hf[] = {
+#include "packet-h248_package_bcp-hfarr.c"
+ };
+
+ /* List of subtrees */
+ static gint *ett[] = {
+ &ett_h248_package_bcp,
+ /*#include "packet-h248_package_bcp-ettarr.c"*/
+ };
+
+ /* Register protocol */
+ proto_h248_package_bcp = proto_register_protocol(PNAME, PSNAME, PFNAME);
+
+ /* Register fields and subtrees */
+ proto_register_field_array(proto_h248_package_bcp, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+}
+
+
+/*--- proto_reg_handoff_h248_package_bcp -------------------------------------------*/
+void proto_reg_handoff_h248_package_bcp(void) {
+ dissector_handle_t h248_package_bcp_handle;
+
+
+ h248_package_bcp_handle = create_dissector_handle(dissect_BNCChar_PDU, proto_h248_package_bcp);
+ dissector_add("h248.package.bin", 0x001e0001, h248_package_bcp_handle);
+}
+
diff --git a/asn1/h248-package-bcp/packet-h248_package_bcp-template.h b/asn1/h248-package-bcp/packet-h248_package_bcp-template.h
new file mode 100644
index 0000000000..2457a38699
--- /dev/null
+++ b/asn1/h248-package-bcp/packet-h248_package_bcp-template.h
@@ -0,0 +1,32 @@
+/* packet-h248_package_bcp.h
+ * Routines for H.248/MEGACO-Package-bcp packet dissection
+ * Ronnie Sahlberg 2004
+ *
+ * $Id: packet-h248_package_bcp-template.h 12203 2004-10-05 09:18:55Z guy $
+ *
+ * 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.
+ */
+
+#ifndef PACKET_H248_PACKAGE_BCP_H
+#define PACKET_H248_PACKAGE_BCP_H
+
+/*#include "packet-h248_package_bcp-exp.h"*/
+
+#endif /* PACKET_H248_PACKAGE_BCP_H */
+
diff --git a/asn1/h248/packet-h248-template.c b/asn1/h248/packet-h248-template.c
index 1dc09b73a2..cd2db73564 100644
--- a/asn1/h248/packet-h248-template.c
+++ b/asn1/h248/packet-h248-template.c
@@ -58,6 +58,9 @@ static gint ett_packagename = -1;
#include "packet-h248-ett.c"
+static dissector_table_t h248_package_bin_dissector_table=NULL;
+
+
static const value_string package_name_vals[] = {
{ 0x0000, "Media stream properties H.248.1 Annex C" },
{ 0x0001, "g H.248.1 Annex E" },
@@ -215,6 +218,8 @@ static const value_string package_name_vals[] = {
{0, NULL}
};
+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;
@@ -229,6 +234,7 @@ dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_i
/* 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);
+ packageandid=(name_major<<16)|name_minor;
/* 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);
@@ -243,9 +249,34 @@ dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_i
static int
dissect_h248_PropertyID(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
- offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
+ guint8 class;
+ gboolean pc, ind;
+ guint32 tag;
+ guint32 len;
+ int old_offset, end_offset;
+ tvbuff_t *next_tvb;
- return offset;
+ old_offset=offset;
+ offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
+ offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, &ind);
+ end_offset=offset+len;
+
+ 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 end_offset;
+ }
+
+
+ next_tvb = tvb_new_subset(tvb, offset, len, len);
+
+ if(!dissector_try_port(h248_package_bin_dissector_table, packageandid, next_tvb, pinfo, tree)){
+ proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "H.248: Dissector for Package/ID:0x%08x not implemented (yet).", packageandid);
+
+ offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, old_offset, hf_index, NULL);
+ }
+
+ return end_offset;
}
@@ -337,6 +368,9 @@ void proto_register_h248(void) {
proto_register_field_array(proto_h248, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ /* register a dissector table packages can attach to */
+ h248_package_bin_dissector_table = register_dissector_table("h248.package.bin", "Binary H.248 Package Dissectors", FT_UINT32, BASE_HEX);
+
}