forked from osmocom/wireshark
Clean up indentation.
Make "reset()" static (it's not used outside "sctp_stat.c"), and fix its prototype to match what's expected for a reset routine passed to "register_tap_listener()". Similarly, fix the prototypes of other routines passed to "register_tap_listener()", and get rid of the casts of pointers to those functions to "void *". Fix some declarations in "sctp_stat.h" to have function prototypes. svn path=/trunk/; revision=13319
This commit is contained in:
parent
c3440553eb
commit
a6694a746f
|
@ -93,19 +93,20 @@ sctp_error_on_unselect(GtkButton *button _U_, gpointer user_data _U_)
|
|||
|
||||
void sctp_error_dlg_update(GList *list)
|
||||
{
|
||||
GList *ilist=NULL;
|
||||
GList *ilist=NULL;
|
||||
|
||||
printf("dlg_update\n");
|
||||
if (sctp_error_dlg != NULL) {
|
||||
gtk_clist_clear(GTK_CLIST(clist));
|
||||
printf("vor ilist\n");
|
||||
ilist=list;
|
||||
if (ilist==NULL)
|
||||
if (ilist==NULL)
|
||||
printf("=NULL\n");
|
||||
printf("nach ilist\n");
|
||||
printf("nach ilist\n");
|
||||
|
||||
while (ilist)
|
||||
{
|
||||
printf("while\n");
|
||||
printf("while\n");
|
||||
add_to_clist((sctp_error_info_t*)(ilist->data));
|
||||
ilist = g_list_next(ilist);
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ sctp_error_on_select_row(GtkCList *clist,
|
|||
GdkEventButton *event _U_,
|
||||
gpointer user_data _U_)
|
||||
{
|
||||
selected_packet = gtk_clist_get_row_data(GTK_CLIST(clist), row);
|
||||
selected_packet = gtk_clist_get_row_data(GTK_CLIST(clist), row);
|
||||
}
|
||||
|
||||
|
||||
|
@ -250,15 +251,12 @@ gtk_sctperror_dlg(void)
|
|||
SIGNAL_CONNECT(bt_close, "clicked", sctp_error_on_close, NULL);
|
||||
|
||||
sctp_error_dlg = sctp_error_dlg_w;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void sctp_error_dlg_show(sctp_assoc_info_t* assoc)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
GList *list;
|
||||
|
||||
/* selected_assoc=(sctp_assoc_info_t*)get_selected_assoc(); */
|
||||
list =assoc->error_info_list;
|
||||
|
|
182
gtk/sctp_stat.c
182
gtk/sctp_stat.c
|
@ -122,28 +122,28 @@ static const value_string chunk_type_values[] = {
|
|||
{ 0, NULL } };
|
||||
|
||||
|
||||
#define FORWARD_STREAM 0
|
||||
#define BACKWARD_STREAM 1
|
||||
#define FORWARD_ADD_FORWARD_VTAG 2
|
||||
#define BACKWARD_ADD_FORWARD_VTAG 3
|
||||
#define BACKWARD_ADD_BACKWARD_VTAG 4
|
||||
#define ADDRESS_FORWARD_STREAM 5
|
||||
#define ADDRESS_BACKWARD_STREAM 6
|
||||
#define ADDRESS_FORWARD_ADD_FORWARD_VTAG 7
|
||||
#define ADDRESS_BACKWARD_ADD_FORWARD_VTAG 8
|
||||
#define ADDRESS_BACKWARD_ADD_BACKWARD_VTAG 9
|
||||
#define ASSOC_NOT_FOUND 10
|
||||
#define FORWARD_STREAM 0
|
||||
#define BACKWARD_STREAM 1
|
||||
#define FORWARD_ADD_FORWARD_VTAG 2
|
||||
#define BACKWARD_ADD_FORWARD_VTAG 3
|
||||
#define BACKWARD_ADD_BACKWARD_VTAG 4
|
||||
#define ADDRESS_FORWARD_STREAM 5
|
||||
#define ADDRESS_BACKWARD_STREAM 6
|
||||
#define ADDRESS_FORWARD_ADD_FORWARD_VTAG 7
|
||||
#define ADDRESS_BACKWARD_ADD_FORWARD_VTAG 8
|
||||
#define ADDRESS_BACKWARD_ADD_BACKWARD_VTAG 9
|
||||
#define ASSOC_NOT_FOUND 10
|
||||
|
||||
struct v4addr {
|
||||
address_type type;
|
||||
int len;
|
||||
guint32 addr;
|
||||
address_type type;
|
||||
int len;
|
||||
guint32 addr;
|
||||
};
|
||||
|
||||
struct v6addr {
|
||||
address_type type;
|
||||
int len;
|
||||
guint8 addr[16];
|
||||
address_type type;
|
||||
int len;
|
||||
guint8 addr[16];
|
||||
};
|
||||
|
||||
static sctp_allassocs_info_t sctp_tapinfo_struct = {0, NULL, FALSE, NULL};
|
||||
|
@ -158,7 +158,8 @@ void free_first(gpointer data, gpointer user_data _U_)
|
|||
|
||||
void tsn_free(gpointer data, gpointer user_data _U_)
|
||||
{
|
||||
tsn_t *tsn;
|
||||
tsn_t *tsn;
|
||||
|
||||
tsn = (tsn_t *) data;
|
||||
if (tsn->tsns!=NULL)
|
||||
{
|
||||
|
@ -168,11 +169,12 @@ tsn_t *tsn;
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
reset(sctp_allassocs_info_t *tapdata )
|
||||
static void
|
||||
reset(void *arg)
|
||||
{
|
||||
GList* list;
|
||||
sctp_assoc_info_t * info;
|
||||
sctp_allassocs_info_t *tapdata = arg;
|
||||
GList* list;
|
||||
sctp_assoc_info_t * info;
|
||||
|
||||
list = g_list_first(tapdata->assoc_info_list);
|
||||
while (list)
|
||||
|
@ -263,45 +265,45 @@ sctp_assoc_info_t * info;
|
|||
|
||||
static sctp_assoc_info_t * calc_checksum(struct _sctp_info * check_data, sctp_assoc_info_t * data)
|
||||
{
|
||||
guint8 ok=0;
|
||||
guint8 ok=0;
|
||||
|
||||
if (check_data->adler32_calculated)
|
||||
{
|
||||
if (check_data->adler32_calculated)
|
||||
{
|
||||
data->n_adler32_calculated++;
|
||||
if (check_data->adler32_correct)
|
||||
data->n_adler32_correct++;
|
||||
}
|
||||
if (check_data->crc32c_calculated)
|
||||
{
|
||||
}
|
||||
if (check_data->crc32c_calculated)
|
||||
{
|
||||
data->n_crc32c_calculated++;
|
||||
if (check_data->crc32c_correct)
|
||||
data->n_crc32c_correct++;
|
||||
}
|
||||
if (data->n_adler32_calculated>0)
|
||||
{
|
||||
}
|
||||
if (data->n_adler32_calculated>0)
|
||||
{
|
||||
if ((float)(data->n_adler32_correct*1.0/data->n_adler32_calculated)>0.5)
|
||||
{
|
||||
strcpy(data->checksum_type,"ADLER32");
|
||||
data->n_checksum_errors=(data->n_adler32_calculated-data->n_adler32_correct);
|
||||
ok=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data->n_crc32c_calculated>0)
|
||||
{
|
||||
if (data->n_crc32c_calculated>0)
|
||||
{
|
||||
if ((float)(data->n_crc32c_correct*1.0/data->n_crc32c_calculated)>0.5)
|
||||
{
|
||||
strcpy(data->checksum_type,"CRC32C");
|
||||
data->n_checksum_errors=data->n_crc32c_calculated-data->n_crc32c_correct;
|
||||
ok=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ok==0)
|
||||
{
|
||||
if (ok==0)
|
||||
{
|
||||
strcpy(data->checksum_type,"UNKNOWN");
|
||||
data->n_checksum_errors=0;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
|
@ -358,24 +360,24 @@ gint sctp_assoc_vtag_cmp(gconstpointer aa, gconstpointer bb)
|
|||
|
||||
gint sctp_assoc_address_cmp(gconstpointer aa, gconstpointer bb)
|
||||
{
|
||||
GList *srclist, *dstlist;
|
||||
const struct _sctp_tmp_info* a = aa;
|
||||
const struct _sctp_assoc_info* b = bb;
|
||||
address *store=NULL;
|
||||
address *srcstore=NULL;
|
||||
address *dststore=NULL;
|
||||
struct v4addr *src=NULL;
|
||||
struct v6addr *src6=NULL;
|
||||
struct v4addr *infosrc=NULL;
|
||||
struct v4addr *infodst=NULL;
|
||||
struct v6addr *infosrc6=NULL;
|
||||
struct v4addr *dst=NULL;
|
||||
struct v6addr *dst6=NULL;
|
||||
struct v6addr *infodst6=NULL;
|
||||
gboolean src_v4=FALSE;
|
||||
gboolean src_v6=FALSE;
|
||||
gboolean dst_v4=FALSE;
|
||||
gboolean dst_v6=FALSE;
|
||||
GList *srclist, *dstlist;
|
||||
const struct _sctp_tmp_info* a = aa;
|
||||
const struct _sctp_assoc_info* b = bb;
|
||||
address *store=NULL;
|
||||
address *srcstore=NULL;
|
||||
address *dststore=NULL;
|
||||
struct v4addr *src=NULL;
|
||||
struct v6addr *src6=NULL;
|
||||
struct v4addr *infosrc=NULL;
|
||||
struct v4addr *infodst=NULL;
|
||||
struct v6addr *infosrc6=NULL;
|
||||
struct v4addr *dst=NULL;
|
||||
struct v6addr *dst6=NULL;
|
||||
struct v6addr *infodst6=NULL;
|
||||
gboolean src_v4=FALSE;
|
||||
gboolean src_v6=FALSE;
|
||||
gboolean dst_v4=FALSE;
|
||||
gboolean dst_v6=FALSE;
|
||||
|
||||
store = g_malloc(sizeof(address));
|
||||
g_memmove(store, &(a->src),sizeof(address));
|
||||
|
@ -654,10 +656,10 @@ gboolean dst_v6=FALSE;
|
|||
|
||||
sctp_assoc_info_t * find_assoc(sctp_tmp_info_t * needle)
|
||||
{
|
||||
sctp_allassocs_info_t *assoc_info;
|
||||
sctp_assoc_info_t *info = NULL;
|
||||
GList* list;
|
||||
guint8 cmp;
|
||||
sctp_allassocs_info_t *assoc_info;
|
||||
sctp_assoc_info_t *info = NULL;
|
||||
GList* list;
|
||||
guint8 cmp;
|
||||
|
||||
assoc_info = &sctp_tapinfo_struct;
|
||||
if ((list = g_list_first(assoc_info->assoc_info_list))!=NULL)
|
||||
|
@ -732,10 +734,11 @@ guint8 cmp;
|
|||
|
||||
sctp_assoc_info_t * add_address(address * vadd, sctp_assoc_info_t *info, guint8 direction)
|
||||
{
|
||||
GList *list;
|
||||
struct v4addr *v4=NULL, *v4add=NULL;
|
||||
struct v6addr *v6=NULL, *v6add=NULL;
|
||||
address *v=NULL;
|
||||
GList *list;
|
||||
struct v4addr *v4=NULL, *v4add=NULL;
|
||||
struct v6addr *v6=NULL, *v6add=NULL;
|
||||
address *v=NULL;
|
||||
|
||||
if (direction == 1)
|
||||
list = g_list_first(info->addr1);
|
||||
else
|
||||
|
@ -790,26 +793,25 @@ address *v=NULL;
|
|||
}
|
||||
|
||||
static int
|
||||
packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , void *data _U_)
|
||||
packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const void *data _U_)
|
||||
{
|
||||
struct _sctp_info *sctp_info;
|
||||
guint32 chunk_number=0, ip, tsnumber;
|
||||
sctp_tmp_info_t tmp_info;
|
||||
sctp_assoc_info_t *info = NULL;
|
||||
sctp_error_info_t *error = NULL;
|
||||
char str[200];
|
||||
guint16 type, length;
|
||||
struct v4addr v4n;
|
||||
struct v6addr v6n;
|
||||
address *store=NULL;
|
||||
tsn_t *tsn=NULL;
|
||||
tsn_t *sack=NULL;
|
||||
guint8 *t_s_n=NULL;
|
||||
gboolean sackchunk=FALSE;
|
||||
gboolean datachunk=FALSE;
|
||||
guint32 max;
|
||||
struct tsn_sort tsn_s;
|
||||
|
||||
struct _sctp_info *sctp_info;
|
||||
guint32 chunk_number=0, ip, tsnumber;
|
||||
sctp_tmp_info_t tmp_info;
|
||||
sctp_assoc_info_t *info = NULL;
|
||||
sctp_error_info_t *error = NULL;
|
||||
char str[200];
|
||||
guint16 type, length;
|
||||
struct v4addr v4n;
|
||||
struct v6addr v6n;
|
||||
address *store=NULL;
|
||||
tsn_t *tsn=NULL;
|
||||
tsn_t *sack=NULL;
|
||||
guint8 *t_s_n=NULL;
|
||||
gboolean sackchunk=FALSE;
|
||||
gboolean datachunk=FALSE;
|
||||
guint32 max;
|
||||
struct tsn_sort tsn_s;
|
||||
|
||||
sctp_allassocs_info_t *assoc_info=NULL;
|
||||
assoc_info = &sctp_tapinfo_struct;
|
||||
|
@ -1379,7 +1381,7 @@ gtk_sctpstat_init(char *dummy _U_)
|
|||
|
||||
}
|
||||
|
||||
static void sctp_update(void)
|
||||
static void sctp_update(void *dummy _U_)
|
||||
{
|
||||
if (get_stat_dlg()!=NULL)
|
||||
sctp_stat_dlg_update();
|
||||
|
@ -1388,18 +1390,16 @@ static void sctp_update(void)
|
|||
void
|
||||
register_tap_listener_sctp_stat(void)
|
||||
{
|
||||
GString *error_string;
|
||||
GString *error_string;
|
||||
|
||||
if (!sctp_tapinfo_struct.is_registered)
|
||||
{
|
||||
register_ethereal_tap("sctp",gtk_sctpstat_init);
|
||||
if ((error_string = register_tap_listener("sctp", &sctp_tapinfo_struct, NULL, (void *)reset, packet, (void *)sctp_update))) {
|
||||
if (!sctp_tapinfo_struct.is_registered)
|
||||
{
|
||||
register_ethereal_tap("sctp",gtk_sctpstat_init);
|
||||
if ((error_string = register_tap_listener("sctp", &sctp_tapinfo_struct, NULL, reset, packet, sctp_update))) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str);
|
||||
g_string_free(error_string, TRUE);
|
||||
return;
|
||||
}
|
||||
sctp_tapinfo_struct.is_registered=TRUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -188,10 +188,10 @@ typedef struct _sctp_error_info {
|
|||
|
||||
|
||||
typedef struct _sctp_allassocs_info {
|
||||
guint32 sum_tvbs;
|
||||
GList* assoc_info_list;
|
||||
gboolean is_registered;
|
||||
GList* children;
|
||||
guint32 sum_tvbs;
|
||||
GList* assoc_info_list;
|
||||
gboolean is_registered;
|
||||
GList* children;
|
||||
} sctp_allassocs_info_t;
|
||||
|
||||
|
||||
|
@ -286,9 +286,6 @@ void sctp_stat_scan(void);
|
|||
|
||||
void remove_tap_listener_sctp_stat(void);
|
||||
|
||||
void reset(sctp_allassocs_info_t *tapdata _U_);
|
||||
|
||||
|
||||
void assoc_analyse(sctp_assoc_info_t* assoc);
|
||||
|
||||
const sctp_assoc_info_t* get_selected_assoc(void);
|
||||
|
@ -297,7 +294,7 @@ void create_graph(guint16 dir, struct sctp_analyse* u_data);
|
|||
|
||||
void create_byte_graph(guint16 dir, struct sctp_analyse* u_data);
|
||||
|
||||
void sctp_error_dlg_show();
|
||||
void sctp_error_dlg_show(sctp_assoc_info_t* assoc);
|
||||
|
||||
void sctp_stat_dlg_update(void);
|
||||
|
||||
|
@ -315,11 +312,10 @@ void set_child(struct sctp_udata *child, struct sctp_analyse *parent);
|
|||
|
||||
void remove_child(struct sctp_udata *child, struct sctp_analyse *parent);
|
||||
|
||||
void decrease_analyse_childcount();
|
||||
void decrease_analyse_childcount(void);
|
||||
|
||||
void increase_analyse_childcount();
|
||||
void increase_analyse_childcount(void);
|
||||
|
||||
void set_analyse_child(struct sctp_analyse *child);
|
||||
|
||||
void remove_analyse_child(struct sctp_analyse *child);
|
||||
|
||||
|
|
Loading…
Reference in New Issue