Try to fix some of the build problems, it still bumms out on:
[obnox/wireshark/wip.git] / tap-sctpchunkstat.c
index 695e8f9ca4d2d6958b876f7f173ab8bf30bf3daf..fcb82852408b0ebb2404adc563b8f2ee53fac142 100644 (file)
@@ -39,8 +39,8 @@
 #include <epan/tap.h>
 #include <epan/stat_cmd_args.h>
 #include "epan/value_string.h"
 #include <epan/tap.h>
 #include <epan/stat_cmd_args.h>
 #include "epan/value_string.h"
-#include "register.h"
 #include <epan/dissectors/packet-sctp.h>
 #include <epan/dissectors/packet-sctp.h>
+#include <epan/to_str.h>
 
 typedef struct sctp_ep {
        struct sctp_ep* next;
 
 typedef struct sctp_ep {
        struct sctp_ep* next;
@@ -85,10 +85,6 @@ typedef struct _sctpstat_t {
 #define CHUNK_TYPE_OFFSET 0
 #define CHUNK_TYPE(x)(tvb_get_guint8((x), CHUNK_TYPE_OFFSET))
 
 #define CHUNK_TYPE_OFFSET 0
 #define CHUNK_TYPE(x)(tvb_get_guint8((x), CHUNK_TYPE_OFFSET))
 
-
-extern gchar* address_to_str(const address *);
-
-
 static void
 sctpstat_reset(void *phs)
 {
 static void
 sctpstat_reset(void *phs)
 {
@@ -96,7 +92,7 @@ sctpstat_reset(void *phs)
        sctp_ep_t* list = (sctp_ep_t*)sctp_stat->ep_list;
        sctp_ep_t* tmp = NULL;
        guint16 chunk_type;
        sctp_ep_t* list = (sctp_ep_t*)sctp_stat->ep_list;
        sctp_ep_t* tmp = NULL;
        guint16 chunk_type;
-       
+
        if(!list)
                return;
 
        if(!list)
                return;
 
@@ -108,7 +104,8 @@ sctpstat_reset(void *phs)
 }
 
 
 }
 
 
-sctp_ep_t* alloc_sctp_ep(struct _sctp_info *si)
+static sctp_ep_t*
+alloc_sctp_ep(const struct _sctp_info *si)
 {
        sctp_ep_t* ep;
        guint16 chunk_type;
 {
        sctp_ep_t* ep;
        guint16 chunk_type;
@@ -118,7 +115,7 @@ sctp_ep_t* alloc_sctp_ep(struct _sctp_info *si)
 
        if (!(ep = g_malloc(sizeof(sctp_ep_t))))
                return NULL;
 
        if (!(ep = g_malloc(sizeof(sctp_ep_t))))
                return NULL;
-       
+
        COPY_ADDRESS(&ep->src,&si->ip_src);
        COPY_ADDRESS(&ep->dst,&si->ip_dst);
        ep->sport = si->sport;
        COPY_ADDRESS(&ep->src,&si->ip_src);
        COPY_ADDRESS(&ep->dst,&si->ip_dst);
        ep->sport = si->sport;
@@ -130,7 +127,7 @@ sctp_ep_t* alloc_sctp_ep(struct _sctp_info *si)
 }
 
 
 }
 
 
-       
+
 
 static int
 sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
 
 static int
 sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
@@ -138,15 +135,15 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
 
        sctpstat_t *hs=(sctpstat_t *)phs;
        sctp_ep_t *tmp = NULL, *te = NULL;
 
        sctpstat_t *hs=(sctpstat_t *)phs;
        sctp_ep_t *tmp = NULL, *te = NULL;
-       struct _sctp_info *si = (struct _sctp_info *) phi;
+       const struct _sctp_info *si = (const struct _sctp_info *) phi;
        guint32 tvb_number;
        guint8 chunk_type;
        guint32 tvb_number;
        guint8 chunk_type;
-       
+
        if (!hs)
                return (0);
        if (!hs)
                return (0);
-               
+
        hs->number_of_packets++;
        hs->number_of_packets++;
-       
+
        if(!hs->ep_list) {
                hs->ep_list = alloc_sctp_ep(si);
                te = hs->ep_list;
        if(!hs->ep_list) {
                hs->ep_list = alloc_sctp_ep(si);
                te = hs->ep_list;
@@ -173,7 +170,7 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
        if(!te)
                return (0);
 
        if(!te)
                return (0);
 
-       
+
        if (si->number_of_tvbs > 0) {
                chunk_type = CHUNK_TYPE(si->tvb[0]);
                if ((chunk_type == SCTP_INIT_CHUNK_ID) ||
        if (si->number_of_tvbs > 0) {
                chunk_type = CHUNK_TYPE(si->tvb[0]);
                if ((chunk_type == SCTP_INIT_CHUNK_ID) ||
@@ -199,11 +196,11 @@ sctpstat_draw(void *phs)
        printf("---------------------------------------------------------------------------------------------------------------------------------------\n");
        printf("|   Source IP   |PortA|    Dest. IP   |PortB|  DATA  |  SACK  |  HBEAT |HBEATACK|  INIT  | INITACK| COOKIE |COOKIACK| ABORT  |  ERROR |\n");
        printf("---------------------------------------------------------------------------------------------------------------------------------------\n");
        printf("---------------------------------------------------------------------------------------------------------------------------------------\n");
        printf("|   Source IP   |PortA|    Dest. IP   |PortB|  DATA  |  SACK  |  HBEAT |HBEATACK|  INIT  | INITACK| COOKIE |COOKIACK| ABORT  |  ERROR |\n");
        printf("---------------------------------------------------------------------------------------------------------------------------------------\n");
-       
+
        for(tmp = list ; tmp ; tmp=tmp->next) {
                printf("|%15s|%5u|%15s|%5u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|\n",
        for(tmp = list ; tmp ; tmp=tmp->next) {
                printf("|%15s|%5u|%15s|%5u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|%8u|\n",
-                      address_to_str(&tmp->src),tmp->sport,
-                      address_to_str(&tmp->dst),tmp->dport,
+                      ep_address_to_str(&tmp->src),tmp->sport,
+                      ep_address_to_str(&tmp->dst),tmp->dport,
                       tmp->chunk_count[SCTP_DATA_CHUNK_ID],
                       tmp->chunk_count[SCTP_SACK_CHUNK_ID],
                       tmp->chunk_count[SCTP_HEARTBEAT_CHUNK_ID],
                       tmp->chunk_count[SCTP_DATA_CHUNK_ID],
                       tmp->chunk_count[SCTP_SACK_CHUNK_ID],
                       tmp->chunk_count[SCTP_HEARTBEAT_CHUNK_ID],
@@ -225,7 +222,7 @@ sctpstat_init(const char *optarg, void* userdata _U_)
        sctpstat_t *hs;
        GString *error_string;
 
        sctpstat_t *hs;
        GString *error_string;
 
-       hs = g_malloc(sizeof(sctpstat_t));
+       hs = (sctpstat_t *)g_malloc(sizeof(sctpstat_t));
        if(!strncmp(optarg,"sctp,stat,",11)){
                hs->filter=g_strdup(optarg+11);
        } else {
        if(!strncmp(optarg,"sctp,stat,",11)){
                hs->filter=g_strdup(optarg+11);
        } else {