aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/c1222
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-10-06 02:42:14 +0000
committerMichael Mann <mmann78@netscape.net>2013-10-06 02:42:14 +0000
commit94f0e1fe21e0af01f071f81c03d2529895ef4b93 (patch)
tree90d86c123130707ef1de073a245bad329f167098 /asn1/c1222
parentee208c8dcc371ca10986b7e8ea28c933e4bfaae9 (diff)
Fully support relative AP-titles in C12.22. Bug 9196 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9196)
From Ed Beroset svn path=/trunk/; revision=52394
Diffstat (limited to 'asn1/c1222')
-rw-r--r--asn1/c1222/c1222.asn13
-rw-r--r--asn1/c1222/c1222.cnf6
-rw-r--r--asn1/c1222/packet-c1222-template.c35
-rw-r--r--asn1/c1222/packet-c1222-template.h2
4 files changed, 44 insertions, 12 deletions
diff --git a/asn1/c1222/c1222.asn b/asn1/c1222/c1222.asn
index a61105312a..662a61c963 100644
--- a/asn1/c1222/c1222.asn
+++ b/asn1/c1222/c1222.asn
@@ -17,12 +17,15 @@ MESSAGE ::= [APPLICATION 0] IMPLICIT SEQUENCE {
}
ASO-qualifier ::= OBJECT IDENTIFIER
-AP-title ::= CHOICE {
- ap-title-form2 OBJECT IDENTIFIER,
- ap-title-form4 [0] IMPLICIT OBJECT IDENTIFIER -- RELATIVE-OID
+
+Called-AP-title ::= CHOICE {
+ called-ap-title-abs OBJECT IDENTIFIER,
+ called-ap-title-rel [0] IMPLICIT RELATIVE-OID
+}
+Calling-AP-title ::= CHOICE {
+ calling-ap-title-abs OBJECT IDENTIFIER,
+ calling-ap-title-rel [0] IMPLICIT RELATIVE-OID
}
-Called-AP-title ::= AP-title
-Calling-AP-title ::= AP-title
AP-invocation-id ::= INTEGER
Called-AP-invocation-id ::= AP-invocation-id
Calling-AP-invocation-id ::= AP-invocation-id
diff --git a/asn1/c1222/c1222.cnf b/asn1/c1222/c1222.cnf
index 7d1e121f8e..ec0e9b3704 100644
--- a/asn1/c1222/c1222.cnf
+++ b/asn1/c1222/c1222.cnf
@@ -1,6 +1,6 @@
# c1222.cnf
# C1222 conformation file
-# Copyright 2010, Edward J. Beroset, edward.j.beroset@us.elster.com
+# Copyright 2010, Edward J. Beroset, edward.beroset@elster.com
# $Id$
@@ -56,7 +56,7 @@ AE-qualifier TYPE=FT_UINT32
#.FN_BODY Called-AP-title
FILL_START;
%(DEFAULT_BODY)s
- FILL_TABLE(called_AP_title);
+ FILL_TABLE_APTITLE(called_AP_title);
#.FN_BODY Called-AP-invocation-id
FILL_START;
@@ -86,7 +86,7 @@ AE-qualifier TYPE=FT_UINT32
#.FN_BODY Calling-AP-title
FILL_START;
%(DEFAULT_BODY)s
- FILL_TABLE(calling_AP_title);
+ FILL_TABLE_APTITLE(calling_AP_title);
#.FN_BODY Key-id-element
FILL_START;
diff --git a/asn1/c1222/packet-c1222-template.c b/asn1/c1222/packet-c1222-template.c
index 67a3f1c6fc..7b9ee42f77 100644
--- a/asn1/c1222/packet-c1222-template.c
+++ b/asn1/c1222/packet-c1222-template.c
@@ -1,6 +1,6 @@
/* packet-c1222.c
* Routines for ANSI C12.22 packet dissection
- * Copyright 2010, Edward J. Beroset, edward.j.beroset@us.elster.com
+ * Copyright 2010, Edward J. Beroset, edward.beroset@elster.com
*
* $Id$
*
@@ -37,6 +37,7 @@
#include <epan/dissectors/packet-ber.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/uat.h>
+#include <epan/oids.h>
#include <stdio.h>
#include <string.h>
@@ -88,6 +89,9 @@ static int proto_c1222 = -1;
static int global_c1222_port = C1222_PORT;
static gboolean c1222_desegment = TRUE;
static gboolean c1222_decrypt = TRUE;
+static const gchar *c1222_baseoid_str = NULL;
+static guint8 *c1222_baseoid = NULL;
+static guint c1222_baseoid_len = 0;
#include "packet-c1222-hf.c"
/* These are the EPSEM pieces */
@@ -301,15 +305,34 @@ static uat_t *c1222_uat;
#define FILL_START int length, start_offset = offset;
#define FILL_TABLE(fieldname) \
length = offset - start_offset; \
+ if (fieldname != NULL) g_free(fieldname); \
fieldname = (guint8 *)tvb_memdup(NULL, tvb, start_offset, length); \
fieldname##_len = length;
#define FILL_TABLE_TRUNCATE(fieldname, len) \
length = 1 + 2*(offset - start_offset); \
fieldname = (guint8 *)tvb_memdup(NULL, tvb, start_offset, length); \
fieldname##_len = len;
+#define FILL_TABLE_APTITLE(fieldname) \
+ length = offset - start_offset; \
+ switch (tvb_get_guint8(tvb, start_offset)) { \
+ case 0x80: /* relative OID */ \
+ fieldname##_len = length + c1222_baseoid_len; \
+ fieldname = (guint8 *)wmem_alloc(NULL, fieldname##_len); \
+ fieldname[0] = 0x06; /* create absolute OID tag */ \
+ fieldname[1] = (fieldname##_len - 2) & 0xff; \
+ memcpy(&(fieldname[2]), c1222_baseoid, c1222_baseoid_len); \
+ tvb_memcpy(tvb, &(fieldname[c1222_baseoid_len+2]), start_offset+2, length-2); \
+ break; \
+ case 0x06: /* absolute OID */ \
+ default: \
+ fieldname = (guint8 *)tvb_memdup(NULL, tvb, start_offset, length); \
+ fieldname##_len = length; \
+ break; \
+ }
#else /* HAVE_LIBGCRYPT */
#define FILL_TABLE(fieldname)
#define FILL_TABLE_TRUNCATE(fieldname, len)
+#define FILL_TABLE_APTITLE(fieldname)
#define FILL_START
#endif /* HAVE_LIBGCRYPT */
@@ -745,8 +768,10 @@ canonify_unencrypted_header(guchar *buff, guint32 *offset, guint32 buffsize)
}
memcpy(&buff[*offset], *(t->element), len);
(*offset) += len;
- g_free(*(t->element));
- *(t->element) = NULL;
+ if (t->addtag) {
+ g_free(*(t->element));
+ *(t->element) = NULL;
+ }
}
}
return TRUE;
@@ -1349,6 +1374,9 @@ void proto_register_c1222(void) {
"Reassemble all C12.22 messages spanning multiple TCP segments",
"Whether the C12.22 dissector should reassemble all messages spanning multiple TCP segments",
&c1222_desegment);
+ prefs_register_string_preference(c1222_module, "baseoid", "Base OID to use for relative OIDs",
+ "Base object identifier for use in resolving relative object identifiers",
+ &c1222_baseoid_str);
#ifdef HAVE_LIBGCRYPT
prefs_register_bool_preference(c1222_module, "decrypt",
"Verify crypto for all applicable C12.22 messages",
@@ -1390,4 +1418,5 @@ proto_reg_handoff_c1222(void)
dissector_add_uint("udp.port", global_c1222_port, c1222_udp_handle);
initialized = TRUE;
}
+ c1222_baseoid_len = oid_string2encoded(c1222_baseoid_str, &c1222_baseoid);
}
diff --git a/asn1/c1222/packet-c1222-template.h b/asn1/c1222/packet-c1222-template.h
index ab82df914e..17af814014 100644
--- a/asn1/c1222/packet-c1222-template.h
+++ b/asn1/c1222/packet-c1222-template.h
@@ -1,6 +1,6 @@
/* packet-c1222.h
* Routines for ANSI C12.22 packet dissection
- * Copyright 2010, Edward J. Beroset, edward.j.beroset@us.elster.com
+ * Copyright 2010, Edward J. Beroset, edward.beroset@elster.com
*
* $Id$
*