Add in some heuristics to try to detect AIX libpcap format. (This works
[obnox/wireshark/wip.git] / packet-snmp.c
index 176d3da78c84c41d291e658d7b6ae0668bcaa60e..9528ecc54a8aacf233017a4235a7b9fca43c697a 100644 (file)
@@ -1,6 +1,6 @@
 /* packet-snmp.c
  * Routines for SNMP (simple network management protocol)
- * D.Jorand (c) 1998
+ * Copyright (C) 1998 Didier Jorand
  *
  * See RFC 1157 for SNMPv1.
  *
@@ -8,11 +8,11 @@
  *
  * See RFCs 1905, 1906, 1909, and 1910 for SNMPv2u.
  *
- * $Id: packet-snmp.c,v 1.67 2001/04/23 04:29:53 guy Exp $
+ * $Id: packet-snmp.c,v 1.71 2001/09/03 10:33:07 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Didier Jorand
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
  *
  * Some stuff from:
  * 
@@ -580,7 +580,8 @@ format_oid(subid_t *oid, guint oid_length)
 {
        char *result;
        int result_len;
-       int len, i;
+       int len;
+       unsigned int i;
        char *buf;
 
        result_len = oid_length * 22;
@@ -726,7 +727,7 @@ snmp_variable_decode(proto_tree *snmp_tree, subid_t *variable_oid,
        long value;
 #endif
 #endif /* HAVE_SPRINT_VALUE */
-       int i;
+       unsigned int i;
        gchar *buf;
        int len;
 
@@ -2114,19 +2115,22 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         * IP addresses and ports.
         *
         * If this packet went to the SNMP port, we check to see if
-        * there's already a conversation with the source IP address
-        * and port of this packet, the destination IP address of this
-        * packet, and any destination UDP port.  If not, we create
-        * one, with a wildcard UDP port, and give it the SNMP dissector
-        * as a dissector.
+        * there's already a conversation with one address/port pair
+        * matching the source IP address and port of this packet,
+        * the other address matching the destination IP address of this
+        * packet, and any destination port.
+        *
+        * If not, we create one, with its address 1/port 1 pair being
+        * the source address/port of this packet, its address 2 being
+        * the destination address of this packet, and its port 2 being
+        * wildcarded, and give it the SNMP dissector as a dissector.
         */
        if (pinfo->destport == UDP_PORT_SNMP) {
          conversation = find_conversation(&pinfo->src, &pinfo->dst, PT_UDP,
-                                          pinfo->srcport, 0, NO_DST_PORT);
+                                          pinfo->srcport, 0, NO_PORT_B);
          if (conversation == NULL) {
            conversation = conversation_new(&pinfo->src, &pinfo->dst, PT_UDP,
-                                           pinfo->srcport, 0, NULL,
-                                           NO_DST_PORT);
+                                           pinfo->srcport, 0, NO_PORT2);
            conversation_set_dissector(conversation, dissect_snmp);
          }
        }
@@ -2152,16 +2156,16 @@ proto_register_snmp(void)
         static hf_register_info hf[] = {
                { &hf_snmpv3_flags,
                { "SNMPv3 Flags", "snmpv3.flags", FT_UINT8, BASE_HEX, NULL,
-                   0x0, "" }},
+                   0x0, "", HFILL }},
                { &hf_snmpv3_flags_auth,
                { "Authenticated", "snmpv3.flags.auth", FT_BOOLEAN, 8,
-                   TFS(&flags_set_truth), TH_AUTH, "" }},
+                   TFS(&flags_set_truth), TH_AUTH, "", HFILL }},
                { &hf_snmpv3_flags_crypt,
                { "Encrypted", "snmpv3.flags.crypt", FT_BOOLEAN, 8,
-                   TFS(&flags_set_truth), TH_CRYPT, "" }},
+                   TFS(&flags_set_truth), TH_CRYPT, "", HFILL }},
                { &hf_snmpv3_flags_report,
                { "Reportable", "snmpv3.flags.report", FT_BOOLEAN, 8,
-                   TFS(&flags_set_truth), TH_REPORT, "" }},
+                   TFS(&flags_set_truth), TH_REPORT, "", HFILL }},
         };
        static gint *ett[] = {
                &ett_snmp,