- #.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

svn path=/trunk/; revision=15894
This commit is contained in:
Tomas Kukosa 2005-09-20 10:56:08 +00:00
parent dce67e2bbe
commit d3492e684a
12 changed files with 136 additions and 161 deletions

View File

@ -137,9 +137,7 @@ RegistrationRejectReason/securityError reg_securityError
CallIdentifier/guid guid
#----------------------------------------------------------------------------------------
#.FN_PARS H323-UU-PDU/h323-message-body
VAL_PTR = &message_body_val
#.FN_BODY H323-UU-PDU/h323-message-body
#.FN_BODY H323-UU-PDU/h323-message-body VAL_PTR = &message_body_val
guint32 message_body_val;
contains_faststart = FALSE;
@ -166,9 +164,7 @@ CallIdentifier/guid guid
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS FastStart/_item
VAL_PTR = &value_tvb
#.FN_BODY FastStart/_item
#.FN_BODY FastStart/_item VAL_PTR = &value_tvb
tvbuff_t *value_tvb = NULL;
char codec_str[50];
@ -184,9 +180,7 @@ CallIdentifier/guid guid
h225_pi->is_faststart = TRUE;
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS RasMessage
VAL_PTR = &rasmessage_value
#.FN_BODY RasMessage
#.FN_BODY RasMessage VAL_PTR = &rasmessage_value
guint32 rasmessage_value;
%(DEFAULT_BODY)s
@ -203,9 +197,7 @@ CallIdentifier/guid guid
h225_pi->is_destinationInfo = TRUE;
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS DialedDigits
VAL_PTR = &value_tvb
#.FN_BODY DialedDigits
#.FN_BODY DialedDigits VAL_PTR = &value_tvb
tvbuff_t *value_tvb = NULL;
guint len = 0;
@ -223,9 +215,7 @@ CallIdentifier/guid guid
}
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS H245TransportAddress/h245ipAddress/h245ipv4
VAL_PTR = &value_tvb
#.FN_BODY H245TransportAddress/h245ipAddress/h245ipv4
#.FN_BODY H245TransportAddress/h245ipAddress/h245ipv4 VAL_PTR = &value_tvb
tvbuff_t *value_tvb;
ipv4_address = 0;
@ -234,13 +224,9 @@ CallIdentifier/guid guid
ipv4_address = tvb_get_ipv4(value_tvb, 0);
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS H245TransportAddress/h245ipAddress/h245ipv4port
VAL_PTR = &ipv4_port
#.END
#.FN_PARS H245TransportAddress/h245ipAddress/h245ipv4port VAL_PTR = &ipv4_port
#----------------------------------------------------------------------------------------
#.FN_PARS ParallelH245Control/_item
VAL_PTR = &h245_tvb
#.FN_BODY ParallelH245Control/_item
#.FN_BODY ParallelH245Control/_item VAL_PTR = &h245_tvb
tvbuff_t *h245_tvb = NULL;
%(DEFAULT_BODY)s
@ -249,9 +235,7 @@ CallIdentifier/guid guid
}
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS H245Control/_item
VAL_PTR = &h245_tvb
#.FN_BODY H245Control/_item
#.FN_BODY H245Control/_item VAL_PTR = &h245_tvb
tvbuff_t *h245_tvb = NULL;
%(DEFAULT_BODY)s
@ -291,9 +275,7 @@ CallIdentifier/guid guid
g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"));
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS H323-UU-PDU/h245Tunneling
VAL_PTR = &(h225_pi->is_h245Tunneling)
#.END
#.FN_PARS H323-UU-PDU/h245Tunneling VAL_PTR = &(h225_pi->is_h245Tunneling)
#----------------------------------------------------------------------------------------
#.FN_HDR Setup-UUIE
contains_faststart = FALSE;
@ -475,17 +457,13 @@ ReleaseCompleteReason VAL_PTR = &value
tvb_memcpy(guid_tvb,h225_pi->guid,0,tvb_length(guid_tvb));
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS RequestSeqNum
VAL_PTR = &(h225_pi->requestSeqNum)
#.END
#.FN_PARS RequestSeqNum VAL_PTR = &(h225_pi->requestSeqNum)
#----------------------------------------------------------------------------------------
#.FN_PARS H323-UU-PDU/h4501SupplementaryService/_item
VAL_PTR = &h4501_tvb
#.FN_BODY H323-UU-PDU/h4501SupplementaryService/_item
#.FN_BODY H323-UU-PDU/h4501SupplementaryService/_item VAL_PTR = &h4501_tvb
tvbuff_t *h4501_tvb = NULL;
%(DEFAULT_BODY)s
if(tvb_length(h4501_tvb)){
if (h4501_tvb && tvb_length(h4501_tvb)) {
call_dissector(h4501_handle, h4501_tvb, pinfo, tree);
}
#.END
@ -494,18 +472,16 @@ ReleaseCompleteReason VAL_PTR = &value
#--- TunnelledProtocol ------------------------------------------------------------------
#.FN_HDR TunnelledProtocol
tpOID[0] = '\0';
tpOID = "";
#.FN_FTR TunnelledProtocol
tp_handle = dissector_get_string_handle(tp_dissector_table, tpOID);
#.FN_PARS TunnelledProtocol/id/tunnelledProtocolObjectID
VAL_PTR = tpOID
FN_VARIANT = _str VAL_PTR = &tpOID
#.END
#.FN_HDR H323-UU-PDU/tunnelledSignallingMessage
tp_handle = NULL;
#.FN_PARS H323-UU-PDU/tunnelledSignallingMessage/messageContent/_item
VAL_PTR = &next_tvb
#.FN_BODY H323-UU-PDU/tunnelledSignallingMessage/messageContent/_item
#.FN_BODY H323-UU-PDU/tunnelledSignallingMessage/messageContent/_item VAL_PTR = &next_tvb
tvbuff_t *next_tvb = NULL;
%(DEFAULT_BODY)s
@ -517,14 +493,13 @@ ReleaseCompleteReason VAL_PTR = &value
#--- NonStandardParameter ---------------------------------------------------------------
#.FN_PARS
NonStandardIdentifier VAL_PTR = &value
NonStandardIdentifier/object VAL_PTR = nsiOID
NonStandardIdentifier/object FN_VARIANT = _str VAL_PTR = &nsiOID
#.END
#.FN_BODY NonStandardIdentifier
#.FN_BODY NonStandardIdentifier VAL_PTR = &value
guint32 value;
nsiOID[0] = '\0';
nsiOID = "";
h221NonStandard = 0;
%(DEFAULT_BODY)s
@ -555,9 +530,7 @@ H221NonStandard/manufacturerCode VAL_PTR = &manufacturerCode
#.FN_HDR NonStandardParameter
nsp_handle = NULL;
#.FN_PARS NonStandardParameter/data
VAL_PTR = &next_tvb
#.FN_BODY NonStandardParameter/data
#.FN_BODY NonStandardParameter/data VAL_PTR = &next_tvb
tvbuff_t *next_tvb = NULL;
%(DEFAULT_BODY)s
@ -581,3 +554,4 @@ FastStart/_item TYPE = FT_UINT32 DISPLAY = BASE_DEC
ParallelH245Control/_item TYPE = FT_UINT32 DISPLAY = BASE_DEC
H245Control/_item TYPE = FT_UINT32 DISPLAY = BASE_DEC
GloballyUniqueID TYPE = FT_GUID DISPLAY = BASE_NONE
#.END

View File

@ -115,14 +115,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;
#include "packet-h225-fn.c"

View File

@ -12,9 +12,7 @@ OpenLogicalChannel
OpenLogicalChannel
#----------------------------------------------------------------------------------------
#.FN_PARS RequestMessage
VAL_PTR = &value
#.FN_BODY RequestMessage
#.FN_BODY RequestMessage VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -52,9 +50,7 @@ OpenLogicalChannel
g_snprintf(h245_pi->frame_label, 50, "%%s (%%s) ", h245_pi->frame_label, codec_type);
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS ResponseMessage
VAL_PTR = &value
#.FN_BODY ResponseMessage
#.FN_BODY ResponseMessage VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -78,9 +74,7 @@ OpenLogicalChannel
g_snprintf(h245_pi->comment, 50, "%%s %%s ", h245_pi->comment, val_to_str(value, h245_ResponseMessage_vals, "<unknown>"));
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS IndicationMessage
VAL_PTR = &value
#.FN_BODY IndicationMessage
#.FN_BODY IndicationMessage VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -103,9 +97,7 @@ OpenLogicalChannel
g_snprintf(h245_pi->comment, 50, "%%s %%s ", h245_pi->comment, val_to_str(value, h245_IndicationMessage_vals, "<unknown>"));
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS CommandMessage
VAL_PTR = &value
#.FN_BODY CommandMessage
#.FN_BODY CommandMessage VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -129,9 +121,7 @@ OpenLogicalChannel
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS AudioCapability
VAL_PTR = &value
#.FN_BODY AudioCapability
#.FN_BODY AudioCapability VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -140,9 +130,7 @@ OpenLogicalChannel
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS VideoCapability
VAL_PTR = &value
#.FN_BODY VideoCapability
#.FN_BODY VideoCapability VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -151,9 +139,7 @@ OpenLogicalChannel
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS Application
VAL_PTR = &value
#.FN_BODY Application
#.FN_BODY Application VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -161,9 +147,7 @@ OpenLogicalChannel
if (h245_pi != NULL) g_snprintf(h245_pi->frame_label, 50, "%%s %%s", h245_pi->frame_label, codec_type);
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS AudioMode
VAL_PTR = &value
#.FN_BODY AudioMode
#.FN_BODY AudioMode VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -171,9 +155,7 @@ OpenLogicalChannel
if (h245_pi != NULL) g_snprintf(h245_pi->frame_label, 50, "%%s %%s", h245_pi->frame_label, val_to_str(value, h245_AudioMode_vals, "ukn"));
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS VideoMode
VAL_PTR = &value
#.FN_BODY VideoMode
#.FN_BODY VideoMode VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -181,9 +163,7 @@ OpenLogicalChannel
if (h245_pi != NULL) g_snprintf(h245_pi->frame_label, 50, "%%s %%s", h245_pi->frame_label, val_to_str(value, h245_VideoMode_vals, "ukn"));
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS DataModeApplication
VAL_PTR = &value
#.FN_BODY DataModeApplication
#.FN_BODY DataModeApplication VAL_PTR = &value
guint32 value;
%(DEFAULT_BODY)s
@ -262,7 +242,7 @@ OpenLogicalChannel
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS CapabilityIdentifier/standard
VAL_PTR = standard_oid_str
FN_VARIANT = _str VAL_PTR = &standard_oid_str
#.END
#----------------------------------------------------------------------------------------
#.FN_HDR GenericMessage/subMessageIdentifer
@ -272,9 +252,7 @@ OpenLogicalChannel
VAL_PTR = &subMessageIdentifer
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS UnicastAddress/iPAddress/network
VAL_PTR = &value_tvb
#.FN_BODY UnicastAddress/iPAddress/network
#.FN_BODY UnicastAddress/iPAddress/network VAL_PTR = &value_tvb
tvbuff_t *value_tvb;
@ -287,9 +265,7 @@ OpenLogicalChannel
#.END
#----------------------------------------------------------------------------------------
#.FN_PARS UnicastAddress/iPAddress/tsapIdentifier
VAL_PTR = &tsapIdentifier
#.FN_BODY UnicastAddress/iPAddress/tsapIdentifier
#.FN_BODY UnicastAddress/iPAddress/tsapIdentifier VAL_PTR = &tsapIdentifier
guint32 tsapIdentifier;
%(DEFAULT_BODY)s
@ -413,13 +389,12 @@ OpenLogicalChannel
#--- NonStandardParameter ---------------------------------------------------------------
#.FN_PARS
NonStandardIdentifier VAL_PTR = &value
NonStandardIdentifier/object VAL_PTR = nsiOID
NonStandardIdentifier/object FN_VARIANT = _str VAL_PTR = &nsiOID
#.END
#.FN_BODY NonStandardIdentifier
#.FN_BODY NonStandardIdentifier VAL_PTR = &value
guint32 value;
nsiOID[0] = '\0';
nsiOID = "";
h221NonStandard = 0;
%(DEFAULT_BODY)s
@ -450,9 +425,7 @@ NonStandardIdentifier/h221NonStandard/manufacturerCode VAL_PTR = &manufacturerC
#.FN_HDR NonStandardParameter
nsp_handle = NULL;
#.FN_PARS NonStandardParameter/data
VAL_PTR = &next_tvb
#.FN_BODY NonStandardParameter/data
#.FN_BODY NonStandardParameter/data VAL_PTR = &next_tvb
tvbuff_t *next_tvb = NULL;
%(DEFAULT_BODY)s

View File

@ -200,7 +200,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;
@ -209,7 +209,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;

View File

@ -218,7 +218,7 @@ static gint ett_h4501_ROS = -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[] = {
@ -423,7 +423,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;
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
item = proto_tree_add_string(tree, hf_index, tvb, offset>>3, length, str);
offset += 8 * 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);
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;
}

View File

@ -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);

View File

@ -1340,20 +1340,20 @@ class EthCnf:
return par[0:pmax]
return par
def get_par_nm(line, pnum, fn, lineno):
if pnum:
par = line.split(None, pnum)
def get_par_nm(line, pmin, pmax, fn, lineno):
if pmax:
par = line.split(None, pmax)
else:
par = [line,]
for i in range(len(par)):
if par[i][0] == '#':
par[i:] = []
break
if len(par) < pnum:
warnings.warn_explicit("Too few parameters.", UserWarning, fn, lineno)
if len(par) < pmin:
warnings.warn_explicit("Too few parameters. At least %d parameters are required" % (pmin), UserWarning, fn, lineno)
return None
if len(par) > pnum:
nmpar = par[pnum]
if len(par) > pmax:
nmpar = par[pmax]
else:
nmpar = ''
nmpars = {}
@ -1373,8 +1373,8 @@ class EthCnf:
p2 = nmpar_end.search(nmpar, pos).start()
v = nmpar[p1:p2]
nmpars[k] = v
if len(par) > pnum:
par[pnum] = nmpars
if len(par) > pmax:
par[pmax] = nmpars
return par
f = open(fn, "r")
@ -1404,18 +1404,29 @@ class EthCnf:
'TYPE_RENAME', 'FIELD_RENAME', 'IMPORT_TAG',
'TYPE_ATTR', 'ETYPE_ATTR', 'FIELD_ATTR', 'EFIELD_ATTR'):
ctx = result.group('name')
elif result.group('name') in ('FN_HDR', 'FN_FTR', 'FN_BODY'):
elif result.group('name') in ('FN_HDR', 'FN_FTR'):
par = get_par(line[result.end():], 1, 1, fn=fn, lineno=lineno)
if not par: continue
ctx = result.group('name')
name = par[0]
elif result.group('name') == 'FN_BODY':
par = get_par_nm(line[result.end():], 1, 1, fn=fn, lineno=lineno)
if not par: continue
ctx = result.group('name')
name = par[0]
if len(par) > 1:
self.add_item('FN_PARS', name, pars=par[1], fn=fn, lineno=lineno)
elif result.group('name') == 'FN_PARS':
par = get_par(line[result.end():], 0, 1, fn=fn, lineno=lineno)
par = get_par_nm(line[result.end():], 0, 1, fn=fn, lineno=lineno)
ctx = result.group('name')
if not par:
name = None
else:
name = par[0]
if len(par) > 1:
self.add_item(ctx, name, pars=par[1], fn=fn, lineno=lineno)
ctx = None
name = None
elif result.group('name') == 'INCLUDE':
par = get_par(line[result.end():], 1, 1, fn=fn, lineno=lineno)
if not par:
@ -1506,15 +1517,15 @@ class EthCnf:
UserWarning, fn, lineno)
elif ctx in ('TYPE_ATTR', 'ETYPE_ATTR', 'FIELD_ATTR', 'EFIELD_ATTR'):
if empty.match(line): continue
par = get_par_nm(line, 1, fn=fn, lineno=lineno)
par = get_par_nm(line, 1, 1, fn=fn, lineno=lineno)
if not par: continue
self.add_item(ctx, par[0], attr=par[1], fn=fn, lineno=lineno)
elif ctx == 'FN_PARS':
if empty.match(line): continue
if name:
par = get_par_nm(line, 0, fn=fn, lineno=lineno)
par = get_par_nm(line, 0, 0, fn=fn, lineno=lineno)
else:
par = get_par_nm(line, 1, fn=fn, lineno=lineno)
par = get_par_nm(line, 1, 1, fn=fn, lineno=lineno)
if not par: continue
if name:
self.add_item(ctx, name, pars=par[0], fn=fn, lineno=lineno)
@ -1836,6 +1847,7 @@ class Type (Node):
pars = {
'TNAME' : tname,
'ER' : ectx.encp(),
'FN_VARIANT' : '',
'PINFO' : 'pinfo',
'TREE' : 'tree',
'TVB' : 'tvb',
@ -3009,16 +3021,14 @@ class ObjectIdentifierType (Type):
def eth_type_default_body(self, ectx, tname):
if (ectx.OBer()):
body = ectx.eth_fn_call('dissect_%(ER)s_object_identifier', ret='offset',
par=(('%(IMPLICIT_TAG)s', '%(PINFO)s', '%(TREE)s', '%(TVB)s', '%(OFFSET)s', '%(HF_INDEX)s'),
('%(VAL_PTR)s',),))
body = ectx.eth_fn_call('dissect_%(ER)s_object_identifier%(FN_VARIANT)s', ret='offset',
par=(('%(IMPLICIT_TAG)s', '%(PINFO)s', '%(TREE)s', '%(TVB)s', '%(OFFSET)s', '%(HF_INDEX)s', '%(VAL_PTR)s',),))
elif (ectx.NPer()):
body = ectx.eth_fn_call('dissect_%(ER)s_object_identifier', ret='offset',
par=(('%(TVB)s', '%(OFFSET)s', '%(PINFO)s', '%(TREE)s', '%(HF_INDEX)s', 'item', '%(VAL_PTR)s'),))
body = ectx.eth_fn_call('dissect_%(ER)s_object_identifier%(FN_VARIANT)s', ret='offset',
par=(('%(TVB)s', '%(OFFSET)s', '%(PINFO)s', '%(TREE)s', '%(HF_INDEX)s', 'item', '%(VAL_PTR)s',),))
elif (ectx.OPer()):
body = ectx.eth_fn_call('dissect_%(ER)s_object_identifier', ret='offset',
par=(('%(TVB)s', '%(OFFSET)s', '%(PINFO)s', '%(TREE)s', '%(HF_INDEX)s'),
('%(VAL_PTR)s',),))
body = ectx.eth_fn_call('dissect_%(ER)s_object_identifier%(FN_VARIANT)s', ret='offset',
par=(('%(TVB)s', '%(OFFSET)s', '%(PINFO)s', '%(TREE)s', '%(HF_INDEX)s', '%(VAL_PTR)s',),))
else:
body = '#error Can not decode %s' % (tname)
return body