From dbcabb19384fd736453f4fac8fe20216dbcdcb9f Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Thu, 1 Nov 2007 22:07:43 +0000 Subject: [PATCH] Get rid of most of the legacy oid stuff. svn path=/trunk/; revision=23333 --- asn1/ldap/ldap.cnf | 2 +- epan/dissectors/packet-ber.c | 4 ++-- epan/dissectors/packet-ldap.c | 2 +- epan/dissectors/packet-per.c | 4 ++-- epan/oids.h | 13 ------------- epan/proto.c | 6 +++--- plugins/agentx/packet-agentx.c | 2 +- 7 files changed, 10 insertions(+), 23 deletions(-) diff --git a/asn1/ldap/ldap.cnf b/asn1/ldap/ldap.cnf index 5e55a0d6ab..847161714f 100644 --- a/asn1/ldap/ldap.cnf +++ b/asn1/ldap/ldap.cnf @@ -53,7 +53,7 @@ ReplControlValue B "1.2.840.113556.1.4.841" "replControlValue" return offset; object_identifier_id = tvb_get_ephemeral_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0)); - name = get_oid_str_name(object_identifier_id); + name = oid_resolved_from_string(object_identifier_id); if(name){ item = get_ber_last_created_item(); diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 17f3039039..fa30a856cb 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -3140,7 +3140,7 @@ printf("OBJECT IDENTIFIER dissect_ber_object_identifier(%s) entered\n",name); if (hfi->type == FT_OID) { actx->created_item = proto_tree_add_item(tree, hf_id, tvb, offset, len, FALSE); } else if (IS_FT_STRING(hfi->type)) { - str = oid_to_str(tvb_get_ptr(tvb, offset, len), len); + str = oid_encoded2string(tvb_get_ptr(tvb, offset, len), len); actx->created_item = proto_tree_add_string(tree, hf_id, tvb, offset, len, str); if(actx->created_item){ /* see if we know the name of this oid */ @@ -3168,7 +3168,7 @@ int dissect_ber_object_identifier_str(gboolean implicit_tag, asn1_ctx_t *actx, p if (value_string) { if (value_tvb && (length = tvb_length(value_tvb))) { - *value_string = oid_to_str(tvb_get_ptr(value_tvb, 0, length), length); + *value_string = oid_encoded2string(tvb_get_ptr(value_tvb, 0, length), length); } else { *value_string = ""; } diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index 83251126dc..1d74fb293f 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -2359,7 +2359,7 @@ dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U return offset; object_identifier_id = tvb_get_ephemeral_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0)); - name = get_oid_str_name(object_identifier_id); + name = oid_resolved_from_string(object_identifier_id); if(name){ item = get_ber_last_created_item(); diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 89d9bf5912..9b05f127bb 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -881,7 +881,7 @@ DEBUG_ENTRY("dissect_per_object_identifier"); if (hfi->type == FT_OID) { item = proto_tree_add_item(tree, hf_index, val_tvb, 0, length, FALSE); } else if (IS_FT_STRING(hfi->type)) { - str = oid_to_str(tvb_get_ptr(val_tvb, 0, length), length); + str = oid_encoded2string(tvb_get_ptr(val_tvb, 0, length), length); item = proto_tree_add_string(tree, hf_index, val_tvb, 0, length, str); } else { DISSECTOR_ASSERT_NOT_REACHED(); @@ -904,7 +904,7 @@ dissect_per_object_identifier_str(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *act if (value_string) { if (value_tvb && (length = tvb_length(value_tvb))) { - *value_string = oid_to_str(tvb_get_ptr(value_tvb, 0, length), length); + *value_string = oid_encoded2string(tvb_get_ptr(value_tvb, 0, length), length); } else { *value_string = ""; } diff --git a/epan/oids.h b/epan/oids.h index 3b835c3e0c..8ba3959e76 100644 --- a/epan/oids.h +++ b/epan/oids.h @@ -155,20 +155,7 @@ extern void oid_add_from_string(const char* name, const gchar *oid_str); /* macros for legacy oid functions */ -/* from former oid_resolv.h */ -#define add_oid_name(oid, oid_len, name) oid_add_from_encoded(name,oid,oid_len) -#define get_oid_str_name(oidstr) oid_resolved_from_string(oidstr) -#define get_oid_name(encoid, encoid_len) oid_resolved_from_encoded(encoid, encoid_len) -#define oid_resolv_enabled() (1) #define oid_resolv_cleanup() ((void)0) - -/* from to_str.h */ -#define oid_to_str(encoid, encoid_len) oid_encoded2string(encoid, encoid_len) - -/* from former dissectors/format_oid.h */ -#define format_oid(oid, oid_length) ((void*)oid_resolved(oid_length,oid)) -#define new_format_oid(oid, oid_length, non_decoded, decoded) oid_both(oid_length, oid, non_decoded, decoded) - #define subid_t guint32 diff --git a/epan/proto.c b/epan/proto.c index 72c9aa837f..bef84ee8b8 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -4075,15 +4075,15 @@ proto_item_fill_label(field_info *fi, gchar *label_str) case FT_OID: bytes = fvalue_get(&fi->value); - name = (oid_resolv_enabled()) ? oid_resolved_from_encoded(bytes, fvalue_length(&fi->value)) : NULL; + name = oid_resolved_from_encoded(bytes, fvalue_length(&fi->value)); if (name) { ret = g_snprintf(label_str, ITEM_LABEL_LENGTH, "%s: %s (%s)", hfinfo->name, - oid_to_str(bytes, fvalue_length(&fi->value)), name); + oid_encoded2string(bytes, fvalue_length(&fi->value)), name); } else { ret = g_snprintf(label_str, ITEM_LABEL_LENGTH, "%s: %s", hfinfo->name, - oid_to_str(bytes, fvalue_length(&fi->value))); + oid_encoded2string(bytes, fvalue_length(&fi->value))); } if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH)) label_str[ITEM_LABEL_LENGTH - 1] = '\0'; diff --git a/plugins/agentx/packet-agentx.c b/plugins/agentx/packet-agentx.c index f7b6b2c49c..255e8ed2f2 100644 --- a/plugins/agentx/packet-agentx.c +++ b/plugins/agentx/packet-agentx.c @@ -315,7 +315,7 @@ static int dissect_octet_string(tvbuff_t *tvb, proto_tree *tree, int offset, cha } -/* XXX - Is there a particular reason we're not using oid_to_str() here? */ +/* XXX - Is there a particular reason we're not using oid_encoded2string() here? */ static int convert_oid_to_str(guint32 *oid, int len, char* str, int slen, char prefix) { int i, tlen = 0;