aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2004-07-23 07:08:14 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2004-07-23 07:08:14 +0000
commit73f560c866156a061354d75a76f43ce74608449b (patch)
tree9717b1e23e8a35f28311e42373729a9808074de8
parent267b501cae8bfa5e614ed05179422dd5acae86d0 (diff)
register ber oid functions through a special function in packet-ber.c which also takes (still unused) the name of the oid
so that sometime later it will be easy to add code to add the name of the oid to the dissection. svn path=/trunk/; revision=11478
-rw-r--r--asn1/cms/packet-cms-template.c6
-rw-r--r--asn1/x509sat/packet-x509sat-template.c5
-rw-r--r--epan/dissectors/packet-ber.c12
-rw-r--r--epan/dissectors/packet-ber.h1
-rw-r--r--epan/dissectors/packet-cms.c6
-rw-r--r--epan/dissectors/packet-x509sat.c5
6 files changed, 17 insertions, 18 deletions
diff --git a/asn1/cms/packet-cms-template.c b/asn1/cms/packet-cms-template.c
index 0a5e6869c8..eae4c3ada9 100644
--- a/asn1/cms/packet-cms-template.c
+++ b/asn1/cms/packet-cms-template.c
@@ -82,10 +82,6 @@ void proto_register_cms(void) {
/*--- proto_reg_handoff_cms -------------------------------------------*/
void proto_reg_handoff_cms(void) {
- dissector_handle_t SignedData_handle;
-
- SignedData_handle=create_dissector_handle(dissect_cms_SignedData_callback, proto_cms);
-
- dissector_add_string("ber.oid", "1.2.840.113549.1.7.2", SignedData_handle);
+ register_ber_oid_dissector("1.2.840.113549.1.7.2", dissect_cms_SignedData_callback, proto_cms, "id-signedData");
}
diff --git a/asn1/x509sat/packet-x509sat-template.c b/asn1/x509sat/packet-x509sat-template.c
index 8722808daf..5307af48cb 100644
--- a/asn1/x509sat/packet-x509sat-template.c
+++ b/asn1/x509sat/packet-x509sat-template.c
@@ -87,9 +87,6 @@ void proto_register_x509sat(void) {
/*--- proto_reg_handoff_x509sat -------------------------------------------*/
void proto_reg_handoff_x509sat(void) {
- dissector_handle_t dissector_handle;
-
- dissector_handle=create_dissector_handle(dissect_x509sat_countryName_callback, proto_x509sat);
- dissector_add_string("ber.oid", "2.5.4.6", dissector_handle);
+ register_ber_oid_dissector("2.5.4.6", dissect_x509sat_countryName_callback, proto_x509sat, "id-at-countryName");
}
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index 6715af7e5b..882dadfc3d 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -115,6 +115,18 @@ proto_item *get_ber_last_created_item(void) {
}
+void
+register_ber_oid_dissector(char *oid, dissector_t dissector, int proto, char *name _U_)
+{
+ /* XXX we should sometime later add tracking of the name of the OID
+ * so we can print that together with the OID.
+ */
+ dissector_handle_t dissector_handle;
+
+ dissector_handle=create_dissector_handle(dissector, proto);
+ dissector_add_string("ber.oid", oid, dissector_handle);
+}
+
int
call_ber_oid_callback(char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
diff --git a/epan/dissectors/packet-ber.h b/epan/dissectors/packet-ber.h
index f10f33cd94..45b707046e 100644
--- a/epan/dissectors/packet-ber.h
+++ b/epan/dissectors/packet-ber.h
@@ -159,5 +159,6 @@ extern proto_item *ber_last_created_item;
extern proto_item *get_ber_last_created_item(void);
int call_ber_oid_callback(char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
+void register_ber_oid_dissector(char *oid, dissector_t dissector, int proto, char *name);
#endif /* __PACKET_BER_H__ */
diff --git a/epan/dissectors/packet-cms.c b/epan/dissectors/packet-cms.c
index 3c27851318..07d7cb3d9a 100644
--- a/epan/dissectors/packet-cms.c
+++ b/epan/dissectors/packet-cms.c
@@ -839,10 +839,6 @@ void proto_register_cms(void) {
/*--- proto_reg_handoff_cms -------------------------------------------*/
void proto_reg_handoff_cms(void) {
- dissector_handle_t SignedData_handle;
-
- SignedData_handle=create_dissector_handle(dissect_cms_SignedData_callback, proto_cms);
-
- dissector_add_string("ber.oid", "1.2.840.113549.1.7.2", SignedData_handle);
+ register_ber_oid_dissector("1.2.840.113549.1.7.2", dissect_cms_SignedData_callback, proto_cms, "id-signedData");
}
diff --git a/epan/dissectors/packet-x509sat.c b/epan/dissectors/packet-x509sat.c
index 87b40f870e..fc13129f7b 100644
--- a/epan/dissectors/packet-x509sat.c
+++ b/epan/dissectors/packet-x509sat.c
@@ -234,9 +234,6 @@ void proto_register_x509sat(void) {
/*--- proto_reg_handoff_x509sat -------------------------------------------*/
void proto_reg_handoff_x509sat(void) {
- dissector_handle_t dissector_handle;
-
- dissector_handle=create_dissector_handle(dissect_x509sat_countryName_callback, proto_x509sat);
- dissector_add_string("ber.oid", "2.5.4.6", dissector_handle);
+ register_ber_oid_dissector("2.5.4.6", dissect_x509sat_countryName_callback, proto_x509sat, "id-at-countryName");
}