add a tap to h248

svn path=/trunk/; revision=21054
This commit is contained in:
Luis Ontanon 2007-03-18 21:54:07 +00:00
parent 001350a7fb
commit 7a7e743627
3 changed files with 49 additions and 15 deletions

View File

@ -103,12 +103,15 @@ IndAudStatisticsDescriptor/statName iAStatName
#.END #.END
#.FN_FTR ActionReply #.FN_FTR ActionReply
if (!curr_info.cmd) if (!curr_info.cmd) {
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_REPLY,offset);
H248_TAP();
}
#.END #.END
#.FN_HDR Command/addReq #.FN_HDR Command/addReq
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_ADD_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_ADD_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR Command/addReq #.FN_FTR Command/addReq
@ -117,6 +120,8 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR Command/moveReq #.FN_HDR Command/moveReq
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_MOVE_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_MOVE_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR Command/moveReq #.FN_FTR Command/moveReq
@ -125,6 +130,7 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR Command/modReq #.FN_HDR Command/modReq
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_MOD_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_MOD_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR Command/modReq #.FN_FTR Command/modReq
curr_info.cmd = NULL; curr_info.cmd = NULL;
@ -132,6 +138,7 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR Command/subtractReq #.FN_HDR Command/subtractReq
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_SUB_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_SUB_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR Command/subtractReq #.FN_FTR Command/subtractReq
curr_info.cmd = NULL; curr_info.cmd = NULL;
@ -139,6 +146,7 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR Command/auditCapRequest #.FN_HDR Command/auditCapRequest
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_AUDITCAP_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_AUDITCAP_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR Command/auditCapRequest #.FN_FTR Command/auditCapRequest
curr_info.cmd = NULL; curr_info.cmd = NULL;
@ -146,6 +154,7 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR Command/auditValueRequest #.FN_HDR Command/auditValueRequest
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_AUDITVAL_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_AUDITVAL_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR Command/auditValueRequest #.FN_FTR Command/auditValueRequest
curr_info.cmd = NULL; curr_info.cmd = NULL;
@ -153,6 +162,7 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR Command/notifyReq #.FN_HDR Command/notifyReq
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_NOTIFY_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_NOTIFY_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR Command/notifyReq #.FN_FTR Command/notifyReq
curr_info.cmd = NULL; curr_info.cmd = NULL;
@ -160,6 +170,7 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR ServiceChangeRequest #.FN_HDR ServiceChangeRequest
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_SVCCHG_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_SVCCHG_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR ServiceChangeRequest #.FN_FTR ServiceChangeRequest
curr_info.cmd = NULL; curr_info.cmd = NULL;
@ -167,6 +178,7 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR ContextRequest/topologyReq #.FN_HDR ContextRequest/topologyReq
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_TOPOLOGY_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_TOPOLOGY_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR ContextRequest/topologyReq #.FN_FTR ContextRequest/topologyReq
curr_info.cmd = NULL; curr_info.cmd = NULL;
@ -174,6 +186,7 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR ActionRequest/contextAttrAuditReq #.FN_HDR ActionRequest/contextAttrAuditReq
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_CTX_ATTR_AUDIT_REQ,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_CTX_ATTR_AUDIT_REQ,offset);
H248_TAP();
#.END #.END
#.FN_FTR ActionRequest/contextAttrAuditReq #.FN_FTR ActionRequest/contextAttrAuditReq
curr_info.cmd = NULL; curr_info.cmd = NULL;
@ -181,34 +194,42 @@ IndAudStatisticsDescriptor/statName iAStatName
#.FN_HDR CommandReply/addReply #.FN_HDR CommandReply/addReply
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_ADD_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_ADD_REPLY,offset);
H248_TAP();
#.END #.END
#.FN_HDR CommandReply/moveReply #.FN_HDR CommandReply/moveReply
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_MOVE_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_MOVE_REPLY,offset);
H248_TAP();
#.END #.END
#.FN_HDR CommandReply/modReply #.FN_HDR CommandReply/modReply
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_MOD_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_MOD_REPLY,offset);
H248_TAP();
#.END #.END
#.FN_HDR CommandReply/subtractReply #.FN_HDR CommandReply/subtractReply
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_SUB_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_SUB_REPLY,offset);
H248_TAP();
#.END #.END
#.FN_HDR CommandReply/notifyReply #.FN_HDR CommandReply/notifyReply
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_NOTIFY_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_NOTIFY_REPLY,offset);
H248_TAP();
#.END #.END
#.FN_HDR ServiceChangeReply #.FN_HDR ServiceChangeReply
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_SVCCHG_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_SVCCHG_REPLY,offset);
H248_TAP();
#.END #.END
#.FN_HDR CommandReply/auditCapReply #.FN_HDR CommandReply/auditCapReply
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_AUDITCAP_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_AUDITCAP_REPLY,offset);
H248_TAP();
#.END #.END
#.FN_HDR CommandReply/auditValueReply #.FN_HDR CommandReply/auditValueReply
curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_AUDITVAL_REPLY,offset); curr_info.cmd = h248_cmd(curr_info.msg,curr_info.trx,curr_info.ctx,H248_CMD_AUDITVAL_REPLY,offset);
H248_TAP();
#.END #.END
#.FN_BODY ErrorDescriptor/errorCode #.FN_BODY ErrorDescriptor/errorCode

View File

@ -26,6 +26,7 @@
*/ */
#include "packet-h248.h" #include "packet-h248.h"
#include "tap.h"
#include "packet-tpkt.h" #include "packet-tpkt.h"
#define PNAME "H.248 MEGACO" #define PNAME "H.248 MEGACO"
@ -89,6 +90,8 @@ static gint ett_h248_no_pkg = -1;
static gint ett_h248_no_sig = -1; static gint ett_h248_no_sig = -1;
static gint ett_h248_no_evt = -1; static gint ett_h248_no_evt = -1;
static int h248_tap = -1;
#include "packet-h248-ett.c" #include "packet-h248-ett.c"
static dissector_handle_t h248_term_handle; static dissector_handle_t h248_term_handle;
@ -403,12 +406,6 @@ static const value_string signal_name_vals[] = {
}; };
#define NULL_CONTEXT 0
#define CHOOSE_CONTEXT 0xFFFFFFFE
#define ALL_CONTEXTS 0xFFFFFFFF
#if 0 #if 0
static const value_string context_id_type[] = { static const value_string context_id_type[] = {
{NULL_CONTEXT,"0 (Null Context)"}, {NULL_CONTEXT,"0 (Null Context)"},
@ -1336,10 +1333,11 @@ static h248_trx_t* h248_trx(h248_msg_t* m ,guint32 t_id , h248_trx_type_t type)
static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) { static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
h248_ctx_t* context = NULL; h248_ctx_t* context = NULL;
h248_ctx_t** context_p = NULL; h248_ctx_t** context_p = NULL;
if ( !m || !t ) return NULL; if ( !m || !t ) return NULL;
if (keep_persistent_data) { if (keep_persistent_data) {
emem_tree_key_t ctx_key[] = { emem_tree_key_t ctx_key[] = {
{1,&(m->hi_addr)}, {1,&(m->hi_addr)},
{1,&(m->lo_addr)}, {1,&(m->lo_addr)},
@ -1378,7 +1376,7 @@ static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
context->terms.last = &(context->terms); context->terms.last = &(context->terms);
context->terms.next = NULL; context->terms.next = NULL;
context->terms.term = NULL; context->terms.term = NULL;
se_tree_insert32_array(ctxs_by_trx,trx_key,context); se_tree_insert32_array(ctxs_by_trx,trx_key,context);
} }
} else { } else {
@ -1470,6 +1468,7 @@ static h248_cmd_t* h248_cmd(h248_msg_t* m, h248_trx_t* t, h248_ctx_t* c, h248_cm
cmd->terms.term = NULL; cmd->terms.term = NULL;
cmd->terms.next = NULL; cmd->terms.next = NULL;
cmd->terms.last = &(cmd->terms); cmd->terms.last = &(cmd->terms);
cmd->str = NULL;
cmd->msg = m; cmd->msg = m;
cmd->trx = t; cmd->trx = t;
cmd->ctx = c; cmd->ctx = c;
@ -1494,7 +1493,7 @@ static h248_cmd_t* h248_cmd(h248_msg_t* m, h248_trx_t* t, h248_ctx_t* c, h248_cm
c->cmds = cmdctx; c->cmds = cmdctx;
c->cmds->last = cmdctx; c->cmds->last = cmdctx;
} }
return cmd; return cmd;
} }
@ -1707,8 +1706,15 @@ static gchar* h248_cmd_to_str(h248_cmd_t* c) {
s = ep_strdup_printf("%s Error=%i",s,c->error); s = ep_strdup_printf("%s Error=%i",s,c->error);
} }
s = ep_strdup_printf("%s }", s);
return ep_strdup_printf("%s }", s); if (keep_persistent_data) {
if (! c->str) c->str = se_strdup(s);
} else {
c->str = s;
}
return s;
} }
static gchar* h248_trx_to_str(h248_msg_t* m, h248_trx_t* t) { static gchar* h248_trx_to_str(h248_msg_t* m, h248_trx_t* t) {
@ -1800,7 +1806,7 @@ static void analyze_h248_msg(h248_msg_t* m) {
for (c = ctx->cmds; c; c = c->next) { for (c = ctx->cmds; c; c = c->next) {
proto_item* cmd_item = proto_tree_add_uint(history_tree,hf_h248_ctx_cmd,h248_tvb,0,0,c->cmd->msg->framenum); proto_item* cmd_item = proto_tree_add_uint(history_tree,hf_h248_ctx_cmd,h248_tvb,0,0,c->cmd->msg->framenum);
proto_item_set_text(cmd_item,"%s",h248_cmd_to_str(c->cmd) ); proto_item_append_text(cmd_item," %s ",c->cmd->str);
PROTO_ITEM_SET_GENERATED(cmd_item); PROTO_ITEM_SET_GENERATED(cmd_item);
if (c->cmd->error) { if (c->cmd->error) {
proto_item_set_expert_flags(cmd_item, PI_RESPONSE_CODE, PI_WARN); proto_item_set_expert_flags(cmd_item, PI_RESPONSE_CODE, PI_WARN);
@ -1847,6 +1853,7 @@ static void analyze_h248_msg(h248_msg_t* m) {
#define h248_cmd_set_error(c,e) (c->error = e) #define h248_cmd_set_error(c,e) (c->error = e)
#define h248_trx_set_error(t,e) (t->error = e) #define h248_trx_set_error(t,e) (t->error = e)
#define H248_TAP() do { if (keep_persistent_data && curr_info.cmd) tap_queue_packet(h248_tap, pinfo, curr_info.cmd); } while(0)
#include "packet-h248-fn.c" #include "packet-h248-fn.c"
@ -2011,7 +2018,7 @@ void proto_register_h248(void) {
{ &hf_h248_ctx_term_type, { "Type", "h248.ctx.term.type", FT_UINT32, BASE_HEX, VALS(term_types), 0, "", HFILL }}, { &hf_h248_ctx_term_type, { "Type", "h248.ctx.term.type", FT_UINT32, BASE_HEX, VALS(term_types), 0, "", HFILL }},
{ &hf_h248_ctx_term_bir, { "BIR", "h248.ctx.term.bir", FT_STRING, BASE_HEX, NULL, 0, "", HFILL }}, { &hf_h248_ctx_term_bir, { "BIR", "h248.ctx.term.bir", FT_STRING, BASE_HEX, NULL, 0, "", HFILL }},
{ &hf_h248_ctx_term_nsap, { "NSAP", "h248.ctx.term.nsap", FT_STRING, BASE_NONE, NULL, 0, "", HFILL }}, { &hf_h248_ctx_term_nsap, { "NSAP", "h248.ctx.term.nsap", FT_STRING, BASE_NONE, NULL, 0, "", HFILL }},
{ &hf_h248_ctx_cmd, { "Command", "h248.ctx.cmd", FT_FRAMENUM, BASE_DEC, NULL, 0, "", HFILL }}, { &hf_h248_ctx_cmd, { "Command in Frame", "h248.ctx.cmd", FT_FRAMENUM, BASE_DEC, NULL, 0, "", HFILL }},
}; };
/* List of subtrees */ /* List of subtrees */
@ -2072,6 +2079,7 @@ void proto_register_h248(void) {
ctxs_by_trx = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs_by_trx"); ctxs_by_trx = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs_by_trx");
ctxs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs"); ctxs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_ctxs");
h248_tap = register_tap("h248");
} }
/*--- proto_reg_handoff_h248 -------------------------------------------*/ /*--- proto_reg_handoff_h248 -------------------------------------------*/

View File

@ -53,6 +53,10 @@
/*#include "packet-h248-exp.h"*/ /*#include "packet-h248-exp.h"*/
#define NULL_CONTEXT 0
#define CHOOSE_CONTEXT 0xFFFFFFFE
#define ALL_CONTEXTS 0xFFFFFFFF
typedef enum { typedef enum {
H248_CMD_NONE, H248_CMD_NONE,
H248_CMD_ADD_REQ, H248_CMD_ADD_REQ,
@ -161,6 +165,7 @@ typedef struct _h248_terms_t {
typedef struct _h248_cmd_t { typedef struct _h248_cmd_t {
guint offset; guint offset;
gchar* str;
h248_cmd_type_t type; h248_cmd_type_t type;
h248_terms_t terms; h248_terms_t terms;
struct _h248_msg_t* msg; struct _h248_msg_t* msg;
@ -173,7 +178,7 @@ typedef struct _h248_cmd_t {
typedef struct _h248_ctx_t { typedef struct _h248_ctx_t {
h248_msg_t* initial; h248_msg_t* initial;
guint32 id; guint32 id;
struct _h248_cmd_msg_t* cmds; struct _h248_cmd_msg_t* cmds;
struct _h248_ctx_t* prev; struct _h248_ctx_t* prev;
h248_terms_t terms; h248_terms_t terms;
} h248_ctx_t; } h248_ctx_t;