Some more variable bindings and add some mising PDU types.

svn path=/trunk/; revision=17637
This commit is contained in:
Anders Broman 2006-03-15 18:57:47 +00:00
parent 61b223303a
commit b4d7dd6060
3 changed files with 133 additions and 11 deletions

View File

@ -739,7 +739,13 @@ dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
return offset;
}
/* This code is copied from the original SNMP dissector with minor changes to adapt it to use packet-ber.c routines
* TODO:
* - Rewrite it completly as OID as subid_t could be returned from dissect_ber_objectidentifier
* - vb_type_name is known when calling this routine(?)
* - All branches not needed(?)
* ...
*/
static void
snmp_variable_decode(tvbuff_t *tvb, proto_tree *snmp_tree, packet_info *pinfo,tvbuff_t *oid_tvb,

View File

@ -44,25 +44,31 @@ SimpleSyntax ::=
CHOICE {
-- INTEGERs with a more restrictive range
-- may also be used
integer-value -- includes Integer32
INTEGER (-2147483648..2147483647),
integer-value Integer-value,
-- OCTET STRINGs with a more restrictive size
-- may also be used
string-value String-value,
string-value String-value,
objectID-value
OBJECT IDENTIFIER,
empty -- Added from RFC 1155 for Ethereal
NULL
objectID-value ObjectID-value,
empty Empty
-- Added from RFC 1155 for Ethereal
}
String-value ::= OCTET STRING (SIZE (0..65535))
Integer-value ::= -- includes Integer32
INTEGER (-2147483648..2147483647)
-- OCTET STRINGs with a more restrictive size
-- may also be used
-- indistinguishable from INTEGER, but never needs more than
-- 32-bits for a two's complement representation
Integer32 ::=
INTEGER (-2147483648..2147483647)
Integer32 ::= INTEGER (-2147483648..2147483647)
ObjectID-value ::= OBJECT IDENTIFIER
Empty ::= NULL
-- Added from RFC 1155 for Ethereal
-- application-wide types
@ -261,7 +267,20 @@ SnmpEngineID ::= OCTET STRING
SetRequest-PDU,
trap
Trap-PDU
Trap-PDU,
-- v2 added ?
getBulkRequest
GetBulkRequest-PDU,
informRequest
InformRequest-PDU,
sNMPv2-Trap
SNMPv2-Trap-PDU,
report
Report-PDU
}
-- PDUs

View File

@ -15,6 +15,18 @@ SMUX-PDUs
Messagev2u/datav2u/plaintext v2u_plaintext
BulkPDU/request-id bulkPDU_request-id
#.FN_PARS PDUs
VAL_PTR = &pdu_type
#.FN_BODY PDUs
gint pdu_type;
%(DEFAULT_BODY)s
if (check_col(pinfo->cinfo, COL_INFO))
col_add_str(pinfo->cinfo, COL_INFO, val_to_str(pdu_type, snmp_PDUs_vals,"Unknown PDU type (%%u)"));
#.FN_BODY PDUs/get-request
gint8 class;
gboolean pc, ind_field;
@ -75,6 +87,7 @@ BulkPDU/request-id bulkPDU_request-id
}
offset = dissect_snmp_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
#.FN_BODY PDUs/trap
gint8 class;
gboolean pc, ind_field;
@ -90,6 +103,66 @@ BulkPDU/request-id bulkPDU_request-id
}
offset = dissect_snmp_Trap_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
#.FN_BODY PDUs/getBulkRequest
gint8 class;
gboolean pc, ind_field;
gint32 tag;
guint32 len1;
if(!implicit_tag){
/* XXX asn2eth can not yet handle tagged assignment yes so this
* XXX is some conformance file magic to work around that bug
*/
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
}
offset = dissect_snmp_GetBulkRequest_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
#.FN_BODY PDUs/informRequest
gint8 class;
gboolean pc, ind_field;
gint32 tag;
guint32 len1;
if(!implicit_tag){
/* XXX asn2eth can not yet handle tagged assignment yes so this
* XXX is some conformance file magic to work around that bug
*/
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
}
offset = dissect_snmp_InformRequest_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
#.FN_BODY PDUs/sNMPv2-Trap
gint8 class;
gboolean pc, ind_field;
gint32 tag;
guint32 len1;
if(!implicit_tag){
/* XXX asn2eth can not yet handle tagged assignment yes so this
* XXX is some conformance file magic to work around that bug
*/
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
}
offset = dissect_snmp_SNMPv2_Trap_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
#.FN_BODY PDUs/report
gint8 class;
gboolean pc, ind_field;
gint32 tag;
guint32 len1;
if(!implicit_tag){
/* XXX asn2eth can not yet handle tagged assignment yes so this
* XXX is some conformance file magic to work around that bug
*/
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
}
offset = dissect_snmp_Report_PDU(TRUE, tvb, offset, pinfo, tree, hf_index);
#.FN_PARS HeaderData/msgSecurityModel
VAL_PTR = &MsgSecurityModel
@ -146,6 +219,30 @@ BulkPDU/request-id bulkPDU_request-id
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
offset = offset + length;
#.FN_BODY Integer-value
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
offset = offset + length;
#.FN_BODY ObjectID-value
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
offset = offset + length;
#.FN_BODY Empty
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
offset = offset + length;
#.FN_BODY TimeTicks
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
offset = offset + length;
#.TYPE_ATTR
IpAddress TYPE = FT_IPv4 DISPLAY = BASE_NONE STRINGS = NULL
Message/community TYPE = FT_STRING DISPLAY = BASE_HEX STRINGS = NULL