guint8 tempchar;
gint tvb_RBRKT, tvb_LBRKT, RBRKT_counter, LBRKT_counter;
guint token_index=0;
-
+
gcp_msg_t* msg = NULL;
gcp_trx_t* trx = NULL;
gcp_ctx_t* ctx = NULL;
guint32 ctx_id = 0;
gcp_cmd_type_t cmd_type = GCP_CMD_NONE;
gcp_wildcard_t wild_term = GCP_WILDCARD_NONE;
-
+
top_tree=tree;
/* Initialize variables */
tvb_len = tvb_length(tvb);
RBRKT_counter = 0;
LBRKT_counter = 0;
- msg = gcp_msg(pinfo, TVB_RAW_OFFSET(tvb), keep_persistent_data);
+ msg = gcp_msg(pinfo, TVB_RAW_OFFSET(tvb), keep_persistent_data);
/*
* Check to see whether we're really dealing with MEGACO by looking
*/
if(!tvb_get_nstringz0(tvb,tvb_offset,sizeof(word),word)) return;
-
-
-
+
+
+
if (strncasecmp(word, "MEGACO", 6) != 0 && tvb_get_guint8(tvb, tvb_offset ) != '!'){
gint8 class;
gboolean pc;
tvb_format_text(tvb,tvb_previous_offset,len));
trx_id = strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10);
-
+
if(tree)
my_proto_tree_add_string(message_body_tree, hf_megaco_transid, tvb,
tvb_previous_offset, len,
tvb_format_text(tvb,tvb_previous_offset,len));
-
+
if(global_megaco_raw_text){
tvb_raw_text_add(tvb, megaco_tree);
}
ti = proto_tree_add_text(megaco_tree, tvb, tvb_previous_offset, tvb_current_offset-tvb_previous_offset,
"%s",tvb_format_text(tvb, tvb_previous_offset, tvb_current_offset-tvb_previous_offset+1));
message_body_tree = proto_item_add_subtree(ti, ett_megaco_message_body);
-
+
tvb_current_offset = tvb_skip_wsp_return(tvb, tvb_current_offset-1);
len = tvb_current_offset - tvb_offset;
if (tree)
col_add_fstr(pinfo->cinfo, COL_INFO, "%s Reply ",
tvb_format_text(tvb,tvb_offset,len));
trx_id = strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10);
-
+
if(tree)
my_proto_tree_add_string(message_body_tree, hf_megaco_transid, tvb,
tvb_offset, len, tvb_format_text(tvb,tvb_offset,len));
/* Offset should be at first printarable char after { */
tvb_previous_offset = tvb_offset;
break;
- case TRANSTOKEN:
+ case TRANSTOKEN:
/* TransactionRequest */
trx_type = GCP_TRX_REQUEST;
tvb_LBRKT = tvb_find_guint8(tvb, tvb_offset, tvb_len, '{');
RBRKT_counter = 0;
goto nextcontext;
}
-
+
sub_ti = proto_tree_add_text(megaco_tree, tvb, tvb_command_start_offset, len+1,
"%s", tvb_format_text(tvb, tvb_command_start_offset, len+1));
megaco_tree_command_line = proto_item_add_subtree(sub_ti, ett_megaco_command_line);
/* creation of the megaco_tree_command_line additionally Command and Transaction ID will be printed in this line */
- /* Changed to use the lines above. this code is saved if there is complaints
+ /* Changed to use the lines above. this code is saved if there is complaints
sub_ti = proto_tree_add_item(megaco_tree,hf_megaco_command_line,tvb,tvb_command_start_offset,tokenlen, FALSE);
megaco_tree_command_line = proto_item_add_subtree(sub_ti, ett_megaco_command_line);
*/
case GCP_TRX_REPLY: cmd_type = GCP_CMD_AUDITVAL_REQ; break;
default: cmd_type = GCP_CMD_NONE; break;
}
-
+
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_command, tvb,
tvb_command_start_offset, tokenlen,
"AuditValue");
case GCP_TRX_REPLY: cmd_type = GCP_CMD_ADD_REPLY; break;
default: cmd_type = GCP_CMD_NONE; break;
}
-
+
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_command, tvb,
tvb_command_start_offset, tokenlen,
"Add");
case GCP_TRX_REPLY: cmd_type = GCP_CMD_NOTIFY_REPLY; break;
default: cmd_type = GCP_CMD_NONE; break;
}
-
+
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_command, tvb,
tvb_command_start_offset, tokenlen,
"Notify");
col_append_str(pinfo->cinfo, COL_INFO, " Notify");
break;
- case 'M':
+ case 'M':
tempchar = tvb_get_guint8(tvb, tvb_command_start_offset+1);
if ( (tempchar >= 'a')&& (tempchar <= 'z'))
case GCP_TRX_REPLY: cmd_type = GCP_CMD_MOD_REPLY; break;
default: cmd_type = GCP_CMD_NONE; break;
}
-
+
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_command, tvb,
tvb_command_start_offset, tokenlen,
"Modify");
break;
case 'P':
- cmd_type = GCP_CMD_NONE;
+ cmd_type = GCP_CMD_NONE;
/*
PackagesToken = ("Packages" / "PG")
PendingToken = ("Pending" / "PN")
case GCP_TRX_REQUEST: cmd_type = GCP_CMD_SUB_REQ; break;
case GCP_TRX_REPLY: cmd_type = GCP_CMD_SUB_REPLY; break;
default: cmd_type = GCP_CMD_NONE; break;
- }
+ }
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_command, tvb,
tvb_command_start_offset, tokenlen,
"Subtract");
}
else{
gchar* command = tvb_format_text(tvb, tvb_command_start_offset, tokenlen);
-
+
if ( g_str_equal(command,"Subtract") ) {
switch(trx_type) {
case GCP_TRX_REQUEST: cmd_type = GCP_CMD_SUB_REQ; break;
case GCP_TRX_REPLY: cmd_type = GCP_CMD_SUB_REPLY; break;
default: cmd_type = GCP_CMD_NONE; break;
- }
+ }
} else if ( g_str_equal(command,"AuditValue") ) {
switch(trx_type) {
case GCP_TRX_REQUEST: cmd_type = GCP_CMD_AUDITVAL_REPLY; break;
default: cmd_type = GCP_CMD_NONE; break;
}
}
-
-
+
+
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_command, tvb,
tvb_command_start_offset, tokenlen,
tvb_format_text(tvb, tvb_command_start_offset,
if (check_col(pinfo->cinfo, COL_INFO) )
col_append_fstr(pinfo->cinfo, COL_INFO, " %s",command);
}
-
+
if (cmd_type == GCP_CMD_NONE && trx_type == GCP_TRX_REPLY) {
cmd_type = GCP_CMD_REPLY;
}
-
+
if (cmd_type != GCP_CMD_NONE) {
cmd = gcp_cmd(msg, trx, ctx, cmd_type, tvb_command_start_offset, keep_persistent_data);
tap_queue_packet(megaco_tap, pinfo, cmd);
}
-
+
tvb_offset = tvb_find_guint8(tvb, tvb_command_start_offset,
tvb_len, '=');
tvb_offset = tvb_skip_wsp(tvb, tvb_offset+1);
term->str = (gchar*)(term->buffer = TermID);
term = gcp_cmd_add_term(msg, trx, cmd, term, wild_term, keep_persistent_data);
-
+
/*** TERM ***/
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_termid, tvb,
tvb_offset, tokenlen,
wild_term = GCP_WILDCARD_ALL;
term->len = 1;
term->buffer = (guint8*)(term->str = "*");
-
+
term = gcp_cmd_add_term(msg, trx, cmd, term, wild_term, keep_persistent_data);
-
+
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_termid, tvb,
tvb_offset, tokenlen,
"WildCard all");
case '$':
wild_term = GCP_WILDCARD_CHOOSE;
-
+
term->len = 1;
term->buffer = (guint8*)(term->str = "$");
-
+
term = gcp_cmd_add_term(msg, trx, cmd, term, wild_term, keep_persistent_data);
-
+
my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_termid, tvb,
tvb_offset, tokenlen,
"WildCard any");
tvb_offset, tokenlen,
tvb_format_text(tvb, tvb_offset,
tokenlen));
-
+
term->len = tokenlen;
term->buffer = (guint8*)(term->str = tvb_format_text(tvb, tvb_offset, tokenlen));
-
+
term = gcp_cmd_add_term(msg, trx, cmd, term, wild_term, keep_persistent_data);
-
+
if (check_col(pinfo->cinfo, COL_INFO) )
col_append_fstr(pinfo->cinfo, COL_INFO, "=%s",tvb_format_text(tvb, tvb_offset,tokenlen));
break;
{ "Media", "M" }, /* 3 */
{ "Signals", "SG" }, /* 4 */
{ "Services", "SV" }, /* 5 */
- { "Statistics", "SA" }, /* 6 */
- { "Error", "ER" }, /* 7 */
- { "Events", "E" }, /* 8 */
- { "Audit", "AT" }, /* 9 */
- { "DigitMap", "DM" }, /* 10 */
- { "ObservedEvents", "OE" }, /* 11 */
- { "Topology", "TP" }, /* 12 */
- { "Packages", "PG" }, /* 13 */
+ { "Statistics", "SA" }, /* 6 */
+ { "Error", "ER" }, /* 7 */
+ { "Events", "E" }, /* 8 */
+ { "Audit", "AT" }, /* 9 */
+ { "DigitMap", "DM" }, /* 10 */
+ { "ObservedEvents", "OE" }, /* 11 */
+ { "Topology", "TP" }, /* 12 */
+ { "Packages", "PG" }, /* 13 */
};
/* Returns index of megaco_tokens_t */
if (!isalpha(tvb_get_guint8(tvb, tvb_offset ))){
break;
}
- }
+ }
tokenlen = tvb_offset - tvb_previous_offset;
token_index = find_megaco_descriptors_names(tvb, tvb_previous_offset, tokenlen);
switch ( token_index ){
tvb_previous_offset = tvb_skip_wsp(tvb, tvb_current_offset+1);
tvb_LBRKT = tvb_previous_offset;
tvb_RBRKT = tvb_previous_offset;
-
-}while ( tvb_current_offset < tvb_descriptors_end_offset );
+
+ } while ( tvb_current_offset < tvb_descriptors_end_offset );
}
gint mediaParm;
- proto_tree *megaco_mediadescriptor_tree, *megaco_mediadescriptor_ti;
+ proto_tree *megaco_mediadescriptor_tree, *megaco_mediadescriptor_ti;
tokenlen = 0;
tvb_next_offset = 0;
}
}
tokenlen = tvb_next_offset - tvb_current_offset;
-
+
mediaParm = find_megaco_mediaParm_names(tvb, tvb_current_offset, tokenlen);
tvb_LBRKT = tvb_find_guint8(tvb, tvb_next_offset , tvb_last_RBRKT, '{');
switch ( mediaParm ){
case MEGACO_LOCAL_TOKEN:
tvb_current_offset = tvb_skip_wsp(tvb, tvb_LBRKT+1);
- dissect_megaco_Localdescriptor(tvb,megaco_tree_command_line , pinfo,
+ dissect_megaco_Localdescriptor(tvb,megaco_tree_command_line , pinfo,
tvb_RBRKT, tvb_current_offset);
tvb_current_offset = tvb_RBRKT;
break;
case MEGACO_REMOTE_TOKEN:
tvb_current_offset = tvb_skip_wsp(tvb, tvb_LBRKT+1);
- dissect_megaco_Localdescriptor(tvb,megaco_tree_command_line , pinfo,
+ dissect_megaco_Localdescriptor(tvb,megaco_tree_command_line , pinfo,
tvb_RBRKT, tvb_current_offset);
tvb_current_offset = tvb_RBRKT;
break;
continue;
case MEGACO_TERMINATION_STATE_DESC:
tvb_current_offset = tvb_skip_wsp(tvb, tvb_LBRKT+1);
- dissect_megaco_TerminationStatedescriptor(tvb,megaco_tree_command_line ,
+ dissect_megaco_TerminationStatedescriptor(tvb,megaco_tree_command_line ,
tvb_RBRKT, tvb_current_offset);
tvb_current_offset = tvb_RBRKT;
break;
}
+ tvb_previous_offset = tvb_current_offset;
tvb_current_offset = tvb_find_guint8(tvb, tvb_RBRKT,
tvb_events_end_offset, ',');
- if (tvb_current_offset == -1 || tvb_current_offset > tvb_events_end_offset ){
+ if (tvb_current_offset == -1 || tvb_current_offset > tvb_events_end_offset || tvb_current_offset < tvb_previous_offset ) {
tvb_current_offset = tvb_events_end_offset;
}
else
tokenlen = 7; /* token must be verbose text (Signals) */
- tvb_current_offset = tvb_skip_wsp(tvb, tvb_previous_offset+tokenlen);
+ tvb_current_offset = tvb_skip_wsp(tvb, tvb_previous_offset+tokenlen);
if(tvb_get_guint8(tvb, tvb_current_offset)!='{') { /* {} has been omitted */
megaco_requestedsignal_tree = proto_item_add_subtree(megaco_requestedsignal_ti, ett_megaco_requestedsignal);
proto_tree_add_item(megaco_requestedsignal_tree,hf_megaco_pkgdname,tvb,tvb_previous_offset,pkg_tokenlen, FALSE);
-
+
if ( tvb_help_offset < tvb_RBRKT && tvb_help_offset != -1 ){
gchar *msg;
* ServiceChangeReasons References
* -------------------- ----------
*/
-static const value_string MEGACO_ServiceChangeReasons_vals[] = {
+static const value_string MEGACO_ServiceChangeReasons_vals[] = {
{900, "Service Restored"},
{901, "Cold Boot"},
{902, "Warm Boot"},
{913, "Signal Capability Failure"},
{914, "Event Capability Failure"},
{915, "State Loss"},
- {916, "Packages Change"},
- {917, "Capabilities Change"},
+ {916, "Packages Change"},
+ {917, "Capabilities Change"},
{918, "Cancel Graceful"},
{919, "Warm Failover"},
{920, "Cold Failover"},
*/
item = proto_tree_add_text(megaco_tree, tvb, tvb_previous_offset, tokenlen,
"%s", tvb_format_text(tvb, tvb_previous_offset, tokenlen));
-
- /* As the reason code ( if a digit ) can be in quoted string or 'just' digit
+
+ /* As the reason code ( if a digit ) can be in quoted string or 'just' digit
* look for a nine and hope for the best.
*/
tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset, tvb_RBRKT, '9');
/* No special dissection: fall trough */
default:
/* Unknown or:
- * extension = extensionParameter parmValue
+ * extension = extensionParameter parmValue
* extensionParameter = "X" ("-" / "+") 1*6(ALPHA / DIGIT)
*/
proto_tree_add_text(megaco_tree, tvb, tvb_previous_offset, tokenlen,
}/*End while */
- /* extension = extensionParameter parmValue
+ /* extension = extensionParameter parmValue
* extensionParameter = "X" ("-" / "+") 1*6(ALPHA / DIGIT)
*/
tvb_LBRKT = tvb_find_guint8(tvb, tvb_previous_offset, tvb_RBRKT, '{');
- tvb_next_offset = tvb_LBRKT;
+ tvb_next_offset = tvb_LBRKT;
tokenlen = (tvb_next_offset+1) - tvb_previous_offset;
/*
"%s", tvb_format_text(tvb, tvb_previous_offset, tokenlen));
megaco_observedevent_tree = proto_item_add_subtree(megaco_observedevent_ti, ett_megaco_observedevent);
-
+
proto_tree_add_item(megaco_observedevent_tree,hf_megaco_pkgdname,tvb,tvb_previous_offset,pkg_tokenlen, FALSE);
if ( tvb_help_offset < tvb_RBRKT && tvb_help_offset != -1 ){
tvb_current_offset, tokenlen,
tvb_format_text(tvb, tvb_current_offset,
tokenlen));
-
+
tvb_get_nstringz0(tvb,tvb_current_offset,3,code_str);
proto_item_append_text(item,"[ %s ]", val_to_str(strtoul(code_str,NULL,16), dscp_vals,"Unknown (%u)"));
-
+
tvb_current_offset = tvb_skip_wsp(tvb, tvb_offset +1);
break;
h245_handle = find_dissector("h245dg");
h248_handle = find_dissector("h248");
data_handle = find_dissector("data");
-
+
if (!megaco_prefs_initialized) {
megaco_text_handle = create_dissector_handle(dissect_megaco_text,
proto_megaco);
&ett_megaco_h245,
GCP_ETT_ARR_ELEMS(megaco_ctx_ids),
};
-
+
module_t *megaco_module;
proto_megaco = proto_register_protocol("MEGACO",
&keep_persistent_data);
megaco_tap = register_tap("megaco");
-
+
}