Explicitly print gratuitous arp requests as such
[metze/wireshark/wip.git] / packet-ansi_a.c
index ae6f7e2ff5c973124ed4e8f58e73b4df855e95dd..648b4662516a053cd7d426cda46d396c7a125da0 100644 (file)
@@ -10,7 +10,7 @@
  *   2000 Access Network Interfaces
  *                     3GPP2 A.S0001-1         TIA/EIA-2001
  *
- * $Id: packet-ansi_a.c,v 1.13 2003/12/08 23:40:12 guy Exp $
+ * $Id: packet-ansi_a.c,v 1.17 2004/05/24 02:25:17 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -150,7 +150,7 @@ const value_string ansi_a_ios401_dtap_strings[] = {
     { 0, NULL },
 };
 
-static const value_string ansi_elem_1_strings[] = {
+const value_string ansi_a_ios401_elem_1_strings[] = {
     { 0x20,    "Access Network Identifiers" },
     { 0x3D,    "ADDS User Part" },
     { 0x25,    "AMPS Hard Handoff Parameters" },
@@ -374,6 +374,7 @@ static dissector_handle_t bsmap_handle;
 static dissector_handle_t dtap_handle;
 static dissector_table_t is637_dissector_table; /* IS-637-A Transport Layer (SMS) */
 static dissector_table_t is683_dissector_table; /* IS-683-A (OTA) */
+static dissector_table_t is801_dissector_table; /* IS-801 (PLD) */
 static packet_info *g_pinfo;
 static proto_tree *g_tree;
 
@@ -4172,7 +4173,15 @@ elem_adds_user_part(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len,
            (g_pinfo->p2p_dir == P2P_DIR_RECV), adds_tvb, g_pinfo, g_tree);
        break;
 
-    case ADDS_APP_PLD: str = "PLD"; break;
+    case ADDS_APP_PLD:
+       str = "PLD";
+
+       adds_tvb = tvb_new_subset(tvb, curr_offset + 1, len - 1, len - 1);
+
+       dissector_try_port(is801_dissector_table,
+           (g_pinfo->p2p_dir == P2P_DIR_RECV), adds_tvb, g_pinfo, g_tree);
+       break;
+
     default:
        str = "Unknown";
        break;
@@ -5892,11 +5901,11 @@ typedef enum
     ANSI_A_E_XMODE,    /* Transcoder Mode */
     ANSI_A_E_UZ_ID,    /* User Zone ID */
     ANSI_A_E_VP_REQ,   /* Voice Privacy Request */
-    ANSI_A_E_NONE,     /* NONE */
+    ANSI_A_E_NONE      /* NONE */
 }
 elem_idx_t;
 
-#define        NUM_ELEM_1 (sizeof(ansi_elem_1_strings)/sizeof(value_string))
+#define        NUM_ELEM_1 (sizeof(ansi_a_ios401_elem_1_strings)/sizeof(value_string))
 static gint ett_ansi_elem_1[NUM_ELEM_1];
 static guint8 (*elem_1_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string) = {
     NULL,      /* Access Network Identifiers */
@@ -6005,7 +6014,7 @@ elem_tlv(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, guint
 
     oct = tvb_get_guint8(tvb, curr_offset);
 
-    if (oct == (guint8) ansi_elem_1_strings[idx].value)
+    if (oct == (guint8) ansi_a_ios401_elem_1_strings[idx].value)
     {
        parm_len = tvb_get_guint8(tvb, curr_offset + 1);
 
@@ -6013,7 +6022,7 @@ elem_tlv(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, guint
            proto_tree_add_text(tree,
                tvb, curr_offset, parm_len + 2,
                "%s%s",
-               ansi_elem_1_strings[idx].strptr,
+               ansi_a_ios401_elem_1_strings[idx].strptr,
                (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
 
        subtree = proto_item_add_subtree(item, ett_ansi_elem_1[idx]);
@@ -6075,13 +6084,13 @@ elem_tv(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, gchar *
 
     oct = tvb_get_guint8(tvb, curr_offset);
 
-    if (oct == (guint8) ansi_elem_1_strings[idx].value)
+    if (oct == (guint8) ansi_a_ios401_elem_1_strings[idx].value)
     {
        item =
            proto_tree_add_text(tree,
                tvb, curr_offset, -1,
                "%s%s",
-               ansi_elem_1_strings[idx].strptr,
+               ansi_a_ios401_elem_1_strings[idx].strptr,
                (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
 
        subtree = proto_item_add_subtree(item, ett_ansi_elem_1[idx]);
@@ -6136,11 +6145,11 @@ elem_t(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, gchar *n
 
     oct = tvb_get_guint8(tvb, curr_offset);
 
-    if (oct == (guint8) ansi_elem_1_strings[idx].value)
+    if (oct == (guint8) ansi_a_ios401_elem_1_strings[idx].value)
     {
        proto_tree_add_uint_format(tree, hf_ansi_a_elem_id, tvb, curr_offset, 1, oct,
            "%s%s",
-           ansi_elem_1_strings[idx].strptr,
+           ansi_a_ios401_elem_1_strings[idx].strptr,
            (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
 
        consumed = 1;
@@ -6171,7 +6180,7 @@ elem_lv(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset, guint l
        proto_tree_add_text(tree,
            tvb, curr_offset, parm_len + 1,
            "%s%s",
-           ansi_elem_1_strings[idx].strptr,
+           ansi_a_ios401_elem_1_strings[idx].strptr,
            (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
 
     subtree = proto_item_add_subtree(item, ett_ansi_elem_1[idx]);
@@ -6255,8 +6264,8 @@ elem_v(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset)
        proto_tree_add_text(tree, \
            tvb, curr_offset, 0, \
            "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
-               ansi_elem_1_strings[elem_idx].value, \
-               ansi_elem_1_strings[elem_idx].strptr, \
+               ansi_a_ios401_elem_1_strings[elem_idx].value, \
+               ansi_a_ios401_elem_1_strings[elem_idx].strptr, \
                (elem_name_addition == NULL) || (elem_name_addition[0] == '\0') ? "" : elem_name_addition \
            ); \
     } \
@@ -6285,8 +6294,8 @@ elem_v(tvbuff_t *tvb, proto_tree *tree, elem_idx_t idx, guint32 offset)
        proto_tree_add_text(tree, \
            tvb, curr_offset, 0, \
            "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
-               ansi_elem_1_strings[elem_idx].value, \
-               ansi_elem_1_strings[elem_idx].strptr, \
+               ansi_a_ios401_elem_1_strings[elem_idx].value, \
+               ansi_a_ios401_elem_1_strings[elem_idx].strptr, \
                (elem_name_addition == NULL) || (elem_name_addition[0] == '\0') ? "" : elem_name_addition \
            ); \
     } \
@@ -8249,7 +8258,7 @@ proto_register_ansi_a(void)
        },
        { &hf_ansi_a_elem_id,
            { "Element ID",     "ansi_a.elem_id",
-           FT_UINT8, BASE_DEC, VALS(ansi_elem_1_strings), 0,
+           FT_UINT8, BASE_DEC, VALS(ansi_a_ios401_elem_1_strings), 0,
            "", HFILL }
        },
        { &hf_ansi_a_length,
@@ -8319,13 +8328,13 @@ proto_register_ansi_a(void)
     };
 
     static enum_val_t a_variant_options[] = {
-           { "IS-634 rev. 0",  A_VARIANT_IS634 },
-           { "TSB-80",         A_VARIANT_TSB80 },
-           { "IS-634-A",       A_VARIANT_IS634A },
-           { "IOS 2.x",        A_VARIANT_IOS2 },
-           { "IOS 3.x",        A_VARIANT_IOS3 },
-           { "IOS 4.0.1",      A_VARIANT_IOS401 },
-           { NULL,             0 }
+           { "is-634-rev0",    "IS-634 rev. 0",        A_VARIANT_IS634 },
+           { "tsb-80",         "TSB-80",               A_VARIANT_TSB80 },
+           { "is-634-a",       "IS-634-A",             A_VARIANT_IS634A },
+           { "ios-2.x",        "IOS 2.x",              A_VARIANT_IOS2 },
+           { "ios-3.x",        "IOS 3.x",              A_VARIANT_IOS3 },
+           { "ios-4.0.1",      "IOS 4.0.1",            A_VARIANT_IOS401 },
+           { NULL,             NULL,                   0 }
 
     };
 
@@ -8400,6 +8409,10 @@ proto_register_ansi_a(void)
        register_dissector_table("ansi_a.ota", "IS-683-A (OTA)",
        FT_UINT8, BASE_DEC);
 
+    is801_dissector_table =
+       register_dissector_table("ansi_a.pld", "IS-801 (PLD)",
+       FT_UINT8, BASE_DEC);
+
     proto_register_subtree_array(ett, ett_len / sizeof(gint *));
 
     ansi_a_tap = register_tap("ansi_a");