aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorkukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7>2005-09-20 10:56:08 +0000
committerkukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7>2005-09-20 10:56:08 +0000
commitaf538363a85f9b295961169d39276f902701e8e7 (patch)
treeadfcf988eab408f711a60befd92074265e6bab65 /epan/dissectors
parentbc442cf15a3fb14749b0d945d2e2b665cd8fd2bf (diff)
asn2eth
- #.FN_BODY accepts parameters too - single line variant of #.FN_PAR is possible - new parameter FN_VARIANT for OBJECT IDENTIFIER packet-per.c - dissect_per_object_identifier() returns value as tvb - new dissect_per_object_identifier_str() function PER dissectors adapted and regenerated git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15894 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-h225.c22
-rw-r--r--epan/dissectors/packet-h235.c3
-rw-r--r--epan/dissectors/packet-h245.c15
-rw-r--r--epan/dissectors/packet-h450.c7
-rw-r--r--epan/dissectors/packet-per.c54
-rw-r--r--epan/dissectors/packet-per.h3
6 files changed, 61 insertions, 43 deletions
diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c
index 286e6902e6..767b331290 100644
--- a/epan/dissectors/packet-h225.c
+++ b/epan/dissectors/packet-h225.c
@@ -1109,14 +1109,14 @@ guint32 value;
static gboolean contains_faststart = FALSE;
/* NonStandardParameter */
-static char nsiOID[MAX_OID_STR_LEN];
+static char *nsiOID;
static guint32 h221NonStandard;
static guint32 t35CountryCode;
static guint32 t35Extension;
static guint32 manufacturerCode;
/* TunnelledProtocol */
-static char tpOID[MAX_OID_STR_LEN];
+static char *tpOID;
/*--- Included file: packet-h225-fn.c ---*/
@@ -1199,8 +1199,7 @@ static int dissect_authenticationMode(tvbuff_t *tvb, int offset, packet_info *pi
static int
dissect_h225_ProtocolIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- NULL);
+ offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index, NULL);
return offset;
}
@@ -2002,8 +2001,7 @@ static int dissect_h245nsap(tvbuff_t *tvb, int offset, packet_info *pinfo, proto
static int
dissect_h225_T_object(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- nsiOID);
+ offset = dissect_per_object_identifier_str(tvb, offset, pinfo, tree, hf_index, &nsiOID);
return offset;
}
@@ -2094,7 +2092,7 @@ static int
dissect_h225_NonStandardIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
guint32 value;
- nsiOID[0] = '\0';
+ nsiOID = "";
h221NonStandard = 0;
offset = dissect_per_choice(tvb, offset, pinfo, tree, hf_index,
@@ -3043,8 +3041,7 @@ static int dissect_versionId(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
static int
dissect_h225_OBJECT_IDENTIFIER(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- NULL);
+ offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index, NULL);
return offset;
}
@@ -3755,8 +3752,7 @@ static int dissect_set(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
static int
dissect_h225_T_tunnelledProtocolObjectID(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- tpOID);
+ offset = dissect_per_object_identifier_str(tvb, offset, pinfo, tree, hf_index, &tpOID);
return offset;
}
@@ -3835,7 +3831,7 @@ static const per_sequence_t TunnelledProtocol_sequence[] = {
static int
dissect_h225_TunnelledProtocol(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- tpOID[0] = '\0';
+ tpOID = "";
offset = dissect_per_sequence(tvb, offset, pinfo, tree, hf_index,
ett_h225_TunnelledProtocol, TunnelledProtocol_sequence);
@@ -6193,7 +6189,7 @@ dissect_h225_T_h4501SupplementaryService_item(tvbuff_t *tvb, int offset, packet_
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
-1, -1, &h4501_tvb);
- if(tvb_length(h4501_tvb)){
+ if (h4501_tvb && tvb_length(h4501_tvb)) {
call_dissector(h4501_handle, h4501_tvb, pinfo, tree);
}
diff --git a/epan/dissectors/packet-h235.c b/epan/dissectors/packet-h235.c
index 119325833c..95703219e9 100644
--- a/epan/dissectors/packet-h235.c
+++ b/epan/dissectors/packet-h235.c
@@ -251,8 +251,7 @@ static int dissect_secureChannel(tvbuff_t *tvb, int offset, packet_info *pinfo,
static int
dissect_h235_OBJECT_IDENTIFIER(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- NULL);
+ offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c
index d8c5465aa0..88a0881b9c 100644
--- a/epan/dissectors/packet-h245.c
+++ b/epan/dissectors/packet-h245.c
@@ -207,7 +207,7 @@ static const value_string h245_AudioCapability_short_vals[] = {
an OLC is read */
const char* codec_type = NULL;
-static char standard_oid_str[MAX_OID_STR_LEN];
+static char *standard_oid_str;
static guint32 ipv4_address;
static guint32 ipv4_port;
static guint32 rtcp_ipv4_address;
@@ -216,7 +216,7 @@ static gboolean media_channel;
static gboolean media_control_channel;
/* NonStandardParameter */
-static char nsiOID[MAX_OID_STR_LEN];
+static char *nsiOID;
static guint32 h221NonStandard;
static guint32 t35CountryCode;
static guint32 t35Extension;
@@ -2159,8 +2159,7 @@ static int dissect_type(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre
static int
dissect_h245_T_object(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- nsiOID);
+ offset = dissect_per_object_identifier_str(tvb, offset, pinfo, tree, hf_index, &nsiOID);
return offset;
}
@@ -2248,7 +2247,7 @@ static int
dissect_h245_NonStandardIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
guint32 value;
- nsiOID[0] = '\0';
+ nsiOID = "";
h221NonStandard = 0;
offset = dissect_per_choice(tvb, offset, pinfo, tree, hf_index,
@@ -2459,8 +2458,7 @@ static int dissect_h233AlgorithmIdentifier(tvbuff_t *tvb, int offset, packet_inf
static int
dissect_h245_OBJECT_IDENTIFIER(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- NULL);
+ offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index, NULL);
return offset;
}
@@ -5222,8 +5220,7 @@ static int dissect_t38fax(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t
static int
dissect_h245_T_standard(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- standard_oid_str);
+ offset = dissect_per_object_identifier_str(tvb, offset, pinfo, tree, hf_index, &standard_oid_str);
return offset;
}
diff --git a/epan/dissectors/packet-h450.c b/epan/dissectors/packet-h450.c
index dbb8bcbe9e..93b2542fd7 100644
--- a/epan/dissectors/packet-h450.c
+++ b/epan/dissectors/packet-h450.c
@@ -583,7 +583,7 @@ static gint ett_h450_Extension = -1;
/* Global variables */
static guint32 localOpcode;
static guint32 localErrorCode;
-static char globalcode_oid_str[256];
+static char *globalcode_oid_str;
static gboolean is_globalcode;
static const value_string localOpcode_vals[] = {
@@ -1405,8 +1405,7 @@ static int dissect_presentationAllowedIndicator(tvbuff_t *tvb, int offset, packe
static int
dissect_h450_OBJECT_IDENTIFIER(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index,
- NULL);
+ offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index, NULL);
return offset;
}
@@ -4226,7 +4225,7 @@ dissect_h4501_localOpcode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t
static int
dissect_h4501_globalCode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h4501_globalCode, globalcode_oid_str);
+ offset=dissect_per_object_identifier_str(tvb, offset, pinfo, tree, hf_h4501_globalCode, &globalcode_oid_str);
is_globalcode = TRUE;
return offset;
}
diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c
index bdc98a08e6..06f35d3ec4 100644
--- a/epan/dissectors/packet-per.c
+++ b/epan/dissectors/packet-per.c
@@ -203,7 +203,6 @@ dissect_per_GeneralString(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, pro
offset=dissect_per_length_determinant(tvb, offset, pinfo, tree, hf_per_GeneralString_length, &length);
-
proto_tree_add_item(tree, hf_index, tvb, offset>>3, length, FALSE);
offset+=length*8;
@@ -603,19 +602,32 @@ DEBUG_ENTRY("dissect_per_set_of");
/* 23 Encoding the object identifier type */
guint32
-dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index, char *value_string)
+dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index, tvbuff_t **value_tvb)
{
- guint length;
- char *str, *name;
- proto_item *item;
+ guint length;
+ char *str, *name;
+ proto_item *item;
+ header_field_info *hfi;
DEBUG_ENTRY("dissect_per_object_identifier");
- offset = dissect_per_length_determinant(tvb, offset, pinfo, tree, hf_per_object_identifier_length, &length);
+ offset = dissect_per_length_determinant(tvb, offset, pinfo, tree, hf_per_object_identifier_length, &length);
+
+ str = oid_to_str(tvb_get_ptr(tvb, offset>>3, length), length);
+
+ hfi = proto_registrar_get_nth(hf_index);
+ /*if (hfi->type == FT_OID) {
+ item = proto_tree_add_item(tree, hf_index, tvb, offset>>3, length, FALSE);
+ } else*/ if (IS_FT_STRING(hfi->type)) {
+ item = proto_tree_add_string(tree, hf_index, tvb, offset>>3, length, str);
+ } else {
+ DISSECTOR_ASSERT_NOT_REACHED();
+ }
+
+ if (value_tvb)
+ *value_tvb = tvb_new_subset(tvb, offset>>3, length, length);
- str = oid_to_str(tvb_get_ptr(tvb, offset>>3, length), length);
- item = proto_tree_add_string(tree, hf_index, tvb, offset>>3, length, str);
- offset += 8 * length;
+ offset += 8 * length;
/* see if we know the name of this oid */
if(item){
@@ -625,13 +637,27 @@ DEBUG_ENTRY("dissect_per_object_identifier");
}
}
- if (value_string) {
- strcpy(value_string, str);
- }
-
- return offset;
+ return offset;
}
+guint32
+dissect_per_object_identifier_str(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, const char **value_string)
+{
+ tvbuff_t *value_tvb = NULL;
+ guint length;
+
+ offset = dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_index, (value_string) ? &value_tvb : NULL);
+
+ if (value_string) {
+ if (value_tvb && (length = tvb_length(value_tvb))) {
+ *value_string = oid_to_str(tvb_get_ptr(tvb, 0, length), length);
+ } else {
+ *value_string = "";
+ }
+ }
+
+ return offset;
+}
diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h
index ba2a375f8b..93d7f1f23a 100644
--- a/epan/dissectors/packet-per.h
+++ b/epan/dissectors/packet-per.h
@@ -88,7 +88,8 @@ extern guint32 dissect_per_constrained_set_of(tvbuff_t *tvb, guint32 offset, pac
extern guint32 dissect_per_set_of(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *parent_tree, int hf_index, gint ett_index, const per_sequence_t *seq);
-extern guint32 dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, char *value_string);
+extern guint32 dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, tvbuff_t **value_tvb);
+extern guint32 dissect_per_object_identifier_str(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, const char **value_string);
extern guint32 dissect_per_boolean(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, gboolean *bool, proto_item **item);