Fix return type for frame_data_init()
[obnox/wireshark/wip.git] / tap-ansi_astat.c
index eb1e962d81285ef208ccc83d6b0a22388b814d12..0d238956742a9b11538e978cc15034804555c946 100644 (file)
@@ -3,10 +3,10 @@
  * Copyright 2003, Michael Lum <mlum [AT] telostech.com>
  * In association with Telos Technology Inc.
  *
- * $Id: tap-ansi_astat.c,v 1.1 2003/12/01 23:05:09 guy Exp $
+ * $Id$
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
  * This program is free software; you can redistribute it and/or
 #include <string.h>
 #include "epan/packet_info.h"
 #include "epan/value_string.h"
-#include "tap.h"
-#include "packet-bssap.h"
-#include "packet-ansi_a.h"
+#include <epan/tap.h>
+#include <epan/stat_cmd_args.h>
+#include <epan/dissectors/packet-bssap.h>
+#include <epan/dissectors/packet-ansi_a.h>
 #include "register.h"
 
 
-/*
- * taken from packet-ansi_a.c
- * TODO:
- *     Have these moved from packet-ansi_a.c to packet-ansi_a.h
- *     and then we would automatically get them!
- */
-static const value_string ansi_bsmap_strings[] = {
-    { 0x69,    "Additional Service Notification" },
-    { 0x65,    "ADDS Page" },
-    { 0x66,    "ADDS Page Ack" },
-    { 0x67,    "ADDS Transfer" },
-    { 0x68,    "ADDS Transfer Ack" },
-    { 0x02,    "Assignment Complete" },
-    { 0x03,    "Assignment Failure" },
-    { 0x01,    "Assignment Request" },
-    { 0x45,    "Authentication Request" },
-    { 0x46,    "Authentication Response" },
-    { 0x48,    "Base Station Challenge" },
-    { 0x49,    "Base Station Challenge Response" },
-    { 0x40,    "Block" },
-    { 0x41,    "Block Acknowledge" },
-    { 0x09,    "BS Service Request" },
-    { 0x0A,    "BS Service Response" },
-    { 0x20,    "Clear Command" },
-    { 0x21,    "Clear Complete" },
-    { 0x22,    "Clear Request" },
-    { 0x57,    "Complete Layer 3 Information" },
-    { 0x60,    "Feature Notification" },
-    { 0x61,    "Feature Notification Ack" },
-    { 0x13,    "Handoff Command" },
-    { 0x15,    "Handoff Commenced" },
-    { 0x14,    "Handoff Complete" },
-    { 0x16,    "Handoff Failure" },
-    { 0x17,    "Handoff Performed" },
-    { 0x10,    "Handoff Request" },
-    { 0x12,    "Handoff Request Acknowledge" },
-    { 0x11,    "Handoff Required" },
-    { 0x1A,    "Handoff Required Reject" },
-    { 0x6C,    "PACA Command" },
-    { 0x6D,    "PACA Command Ack" },
-    { 0x6E,    "PACA Update" },
-    { 0x6F,    "PACA Update Ack" },
-    { 0x52,    "Paging Request" },
-    { 0x53,    "Privacy Mode Command" },
-    { 0x55,    "Privacy Mode Complete" },
-    { 0x23,    "Radio Measurements for Position Request" },
-    { 0x25,    "Radio Measurements for Position Response" },
-    { 0x56,    "Rejection" },
-    { 0x05,    "Registration Request" },
-    { 0x30,    "Reset" },
-    { 0x31,    "Reset Acknowledge" },
-    { 0x34,    "Reset Circuit" },
-    { 0x35,    "Reset Circuit Acknowledge" },
-    { 0x47,    "SSD Update Request" },
-    { 0x4A,    "SSD Update Response" },
-    { 0x6A,    "Status Request" },
-    { 0x6B,    "Status Response" },
-    { 0x39,    "Transcoder Control Acknowledge" },
-    { 0x38,    "Transcoder Control Request" },
-    { 0x42,    "Unblock" },
-    { 0x43,    "Unblock Acknowledge" },
-    { 0x0B,    "User Zone Reject" },
-    { 0x04,    "User Zone Update" },
-    { 0, NULL },
-};
-
-static const value_string ansi_dtap_strings[] = {
-    { 0x62,    "Additional Service Request" },
-    { 0x53,    "ADDS Deliver" },
-    { 0x54,    "ADDS Deliver Ack" },
-    { 0x26,    "Alert With Information" },
-    { 0x45,    "Authentication Request" },
-    { 0x46,    "Authentication Response" },
-    { 0x48,    "Base Station Challenge" },
-    { 0x49,    "Base Station Challenge Response" },
-    { 0x24,    "CM Service Request" },
-    { 0x25,    "CM Service Request Continuation" },
-    { 0x07,    "Connect" },
-    { 0x10,    "Flash with Information" },
-    { 0x50,    "Flash with Information Ack" },
-    { 0x02,    "Location Updating Accept" },
-    { 0x04,    "Location Updating Reject" },
-    { 0x08,    "Location Updating Request" },
-    { 0x27,    "Paging Response" },
-    { 0x2B,    "Parameter Update Confirm" },
-    { 0x2C,    "Parameter Update Request" },
-    { 0x56,    "Rejection" },
-    { 0x03,    "Progress" },
-    { 0x70,    "Service Redirection" },
-    { 0x2E,    "Service Release" },
-    { 0x2F,    "Service Release Complete" },
-    { 0x47,    "SSD Update Request" },
-    { 0x4A,    "SSD Update Response" },
-    { 0x6A,    "Status Request" },
-    { 0x6B,    "Status Response" },
-    { 0x0B,    "User Zone Reject" },
-    { 0x0C,    "User Zone Update" },
-    { 0x0D,    "User Zone Update Request" },
-    { 0, NULL },
-};
-
-#define        ANSI_A_STAT_NUM_IOS401_BSMAP_MSG (sizeof(ansi_bsmap_strings)/sizeof(value_string))
-#define        ANSI_A_STAT_NUM_IOS401_DTAP_MSG (sizeof(ansi_dtap_strings)/sizeof(value_string))
-
 typedef struct _ansi_a_stat_t {
     int                bsmap_message_type[0xff];
     int                dtap_message_type[0xff];
@@ -160,15 +57,13 @@ typedef struct _ansi_a_stat_t {
 static int
 ansi_a_stat_packet(
     void                       *tapdata,
-    packet_info                        *pinfo,
+    packet_info                        *pinfo _U_,
     epan_dissect_t             *edt _U_,
-    void                       *data)
+    const void                 *data)
 {
     ansi_a_stat_t              *stat_p = tapdata;
-    ansi_a_tap_rec_t           *tap_p = data;
-
+    const ansi_a_tap_rec_t     *tap_p = data;
 
-    pinfo = pinfo;
 
     switch (tap_p->pdu_type)
     {
@@ -204,29 +99,35 @@ ansi_a_stat_draw(
     printf("BSMAP\n");
     printf("Message (ID)Type                                        Number\n");
 
-    for (i=0; i < ANSI_A_STAT_NUM_IOS401_BSMAP_MSG; i++)
+    i = 0;
+    while (ansi_a_ios401_bsmap_strings[i].strptr)
     {
-       if (stat_p->bsmap_message_type[ansi_bsmap_strings[i].value] > 0)
+       if (stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value] > 0)
        {
            printf("0x%02x  %-50s%d\n",
-               i,
-               ansi_bsmap_strings[i].strptr,
-               stat_p->bsmap_message_type[ansi_bsmap_strings[i].value]);
+               ansi_a_ios401_bsmap_strings[i].value,
+               ansi_a_ios401_bsmap_strings[i].strptr,
+               stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value]);
        }
+
+       i++;
     }
 
     printf("\nDTAP\n");
     printf("Message (ID)Type                                        Number\n");
 
-    for (i=0; i < ANSI_A_STAT_NUM_IOS401_DTAP_MSG; i++)
+    i = 0;
+    while (ansi_a_ios401_dtap_strings[i].strptr)
     {
-       if (stat_p->dtap_message_type[ansi_dtap_strings[i].value] > 0)
+       if (stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value] > 0)
        {
            printf("0x%02x  %-50s%d\n",
-               i,
-               ansi_dtap_strings[i].strptr,
-               stat_p->dtap_message_type[ansi_dtap_strings[i].value]);
+               ansi_a_ios401_dtap_strings[i].value,
+               ansi_a_ios401_dtap_strings[i].strptr,
+               stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value]);
        }
+
+       i++;
     }
 
     printf("==============================================================\n");
@@ -234,20 +135,17 @@ ansi_a_stat_draw(
 
 
 static void
-ansi_a_stat_init(char *optarg)
+ansi_a_stat_init(const char *optarg _U_, void* userdata _U_)
 {
     ansi_a_stat_t      *stat_p;
     GString            *err_p;
 
-
-    optarg = optarg;
-
     stat_p = g_malloc(sizeof(ansi_a_stat_t));
 
     memset(stat_p, 0, sizeof(ansi_a_stat_t));
 
     err_p =
-       register_tap_listener("ansi_a", stat_p, NULL,
+       register_tap_listener("ansi_a", stat_p, NULL, 0,
            NULL,
            ansi_a_stat_packet,
            ansi_a_stat_draw);
@@ -265,5 +163,5 @@ ansi_a_stat_init(char *optarg)
 void
 register_tap_listener_ansi_astat(void)
 {
-    register_ethereal_tap("ansi_a,", ansi_a_stat_init);
+    register_stat_cmd_arg("ansi_a,", ansi_a_stat_init,NULL);
 }