Wireshark-dev: [Wireshark-dev] Unable to submit patch : Bug# 2129
From: "Abhik Sarkar" <sarkar.abhik@xxxxxxxxx>
Date: Fri, 21 Dec 2007 03:43:47 +0400
Hello all, I created a bug (2129) to submit a patch for review... However, everytime I try to attach the patch to the bug, I get the following error: "undef error - Undefined subroutine Fh::slice at data/template/template/en/default/global/hidden-fields.html.tmpl line 58" It says I should send the error in a mail to wireshark-bugs@xxxxxxxxxxxxx with details of what I was trying to do, but that mail bounced. I have tried both with IE and Firefox. Does someone know why this could be happening? I am attaching the patch to this email, just in case some else could try to give it a shot. Thanks, Abhik.
Index: epan/dissectors/packet-smpp.c =================================================================== --- epan/dissectors/packet-smpp.c (revision 23895) +++ epan/dissectors/packet-smpp.c (working copy) @@ -49,10 +49,13 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/tap.h> +#include <epan/stats_tree.h> #include <epan/prefs.h> #include <epan/emem.h> #include "packet-tcp.h" +#include "packet-smpp.h" /* General-purpose debug logger. * Requires double parentheses because of variable arguments of printf(). @@ -80,6 +83,11 @@ */ static int proto_smpp = -1; +static int st_smpp_ops = -1; +static int st_smpp_req = -1; +static int st_smpp_res = -1; +static int st_smpp_res_status = -1; + static int hf_smpp_command_id = -1; static int hf_smpp_command_length = -1; static int hf_smpp_command_status = -1; @@ -213,6 +221,12 @@ /* Reassemble SMPP TCP segments */ static gboolean reassemble_over_tcp = TRUE; +/* Tap */ +static int smpp_tap = -1; + +/* Stats Tree */ +static guint8* st_str_smpp = "SMPP"; + /* * Value-arrays for field-contents */ @@ -728,6 +742,45 @@ static dissector_handle_t gsm_sms_handle; +/* + * For Stats Tree + */ +extern void smpp_stats_tree_init(stats_tree* st) +{ + st_smpp_ops = stats_tree_create_node(st, "SMPP Operations", 0, TRUE); + st_smpp_req = stats_tree_create_node(st, "SMPP Requests", st_smpp_ops, TRUE); + st_smpp_res = stats_tree_create_node(st, "SMPP Responses", st_smpp_ops, TRUE); + st_smpp_res_status = stats_tree_create_node(st, "SMPP Response Status", 0, TRUE); + +} + +extern int smpp_stats_tree_per_packet(stats_tree *st, /* st as it was passed to us */ + packet_info *pinfo, + epan_dissect_t *edt _U_, /* unused */ + const void *p) /* Used for getting SMPP command_id values */ +{ + smpp_tap_rec_t* tap_rec = (smpp_tap_rec_t*) p; + + tick_stat_node(st, "SMPP Operations", 0, TRUE); + + if ((tap_rec->command_id & 0x80000000) == 0x80000000) // Response + { + tick_stat_node(st, "SMPP Responses", st_smpp_ops, TRUE); + tick_stat_node(st, val_to_str(tap_rec->command_id, vals_command_id, "Unknown 0x%08x") , st_smpp_res, FALSE); + + tick_stat_node(st, "SMPP Response Status", 0, TRUE); + tick_stat_node(st, val_to_str(tap_rec->command_status, vals_command_status, "Unknown 0x%08x") , st_smpp_res_status, FALSE); + + } + else // Request + { + tick_stat_node(st, "SMPP Requests", st_smpp_ops, TRUE); + tick_stat_node(st, val_to_str(tap_rec->command_id, vals_command_id, "Unknown 0x%08x") , st_smpp_req, FALSE); + } + + return 1; +} + /*! * SMPP equivalent of mktime() (3). Convert date to standard 'time_t' format * @@ -1722,6 +1775,7 @@ guint command_id; /* SMPP command */ guint command_status; /* Status code */ guint sequence_number; /* ...of command */ + smpp_tap_rec_t* tap_rec; /* Tap record */ const gchar *command_str; const gchar *command_status_str = NULL; /* Set up structures needed to add the protocol subtree and manage it */ @@ -1955,9 +2009,17 @@ break; } /* switch (command_id) */ } /* if (command_id & 0x80000000) */ + } /* if (command_length <= tvb_reported_length(pdu_tvb)) */ offset += command_length; } /* if (tree || (command_id == 4)) */ + + /* Queue packet for Tap */ + tap_rec = ep_alloc0(sizeof(smpp_tap_rec_t)); + tap_rec->command_id = command_id; + tap_rec->command_status = command_status; + tap_queue_packet(smpp_tap, pinfo, tap_rec); + first = FALSE; } @@ -2757,6 +2819,9 @@ /* Allow other dissectors to find this one by name. */ register_dissector("smpp", dissect_smpp, proto_smpp); + /* Register for tapping */ + smpp_tap = register_tap("smpp"); + /* Preferences */ smpp_module = prefs_register_protocol (proto_smpp, NULL); prefs_register_bool_preference (smpp_module, @@ -2791,8 +2856,11 @@ heur_dissector_add("tcp", dissect_smpp_heur, proto_smpp); heur_dissector_add("x.25", dissect_smpp_heur, proto_smpp); - /* Required for call_dissector() */ - DebugLog(("Finding gsm-sms-ud subdissector\n")); - gsm_sms_handle = find_dissector("gsm-sms-ud"); - DISSECTOR_ASSERT(gsm_sms_handle); + /* Required for call_dissector() */ + DebugLog(("Finding gsm-sms-ud subdissector\n")); + gsm_sms_handle = find_dissector("gsm-sms-ud"); + DISSECTOR_ASSERT(gsm_sms_handle); + + /* Tapping setup */ + stats_tree_register("smpp","smpp_commands", st_str_smpp, smpp_stats_tree_per_packet, smpp_stats_tree_init, NULL); } Index: epan/dissectors/packet-smpp.h =================================================================== --- epan/dissectors/packet-smpp.h (revision 23895) +++ epan/dissectors/packet-smpp.h (working copy) @@ -36,8 +36,19 @@ * SMS forum (www.smsforum.net) in "SMPP protocol specification v3.4" * (document version: 12-Oct-1999 Issue 1.2) */ + +#ifndef __PACKET_SMPP_H_ +#define __PACKET_SMPP_H_ /* * Export dissection of some parameters */ void smpp_handle_dcs(proto_tree *tree, tvbuff_t *tvb, int *offset); + + +/* Tap Record */ +typedef struct _smpp_tap_rec_t { + guint command_id; + guint command_status; +} smpp_tap_rec_t; +#endif
- Follow-Ups:
- Re: [Wireshark-dev] Unable to submit patch : Bug# 2129
- From: Stephen Fisher
- Re: [Wireshark-dev] Unable to submit patch : Bug# 2129
- Prev by Date: Re: [Wireshark-dev] Problemems with proto_tree_new_item after update
- Next by Date: Re: [Wireshark-dev] Unable to submit patch : Bug# 2129
- Previous by thread: [Wireshark-dev] [Patch] Enable TCP reassembly for Lua plugins (was: Re: Lua dll is outdated in windows binaries)
- Next by thread: Re: [Wireshark-dev] Unable to submit patch : Bug# 2129
- Index(es):