diff options
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/h245/h245.cnf | 49 | ||||
-rw-r--r-- | asn1/h245/packet-h245-template.c | 25 |
2 files changed, 31 insertions, 43 deletions
diff --git a/asn1/h245/h245.cnf b/asn1/h245/h245.cnf index 8c5f9acb55..0f57192553 100644 --- a/asn1/h245/h245.cnf +++ b/asn1/h245/h245.cnf @@ -367,16 +367,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format gint32 value; %(DEFAULT_BODY)s - if ( h245_shorttypes == TRUE ) - { - col_prepend_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(value, h245_RequestMessage_short_vals, "<unknown>")); - } - else - { - col_prepend_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(value, h245_RequestMessage_vals, "<unknown>")); - } + print_info_column(%(ACTX)s->pinfo->cinfo, &value, h245_RequestMessage_vals, h245_RequestMessage_short_vals); if (( codec_type != NULL ) && ( value == RequestMessage_openLogicalChannel) ){ col_append_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "(%%s) ", codec_type ); @@ -407,17 +398,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format gint32 value; %(DEFAULT_BODY)s - if ( h245_shorttypes == TRUE ) - { - col_prepend_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(value, h245_ResponseMessage_short_vals, "<unknown>")); - } - else - { - col_prepend_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(value, h245_ResponseMessage_vals, "<unknown>")); - } - + print_info_column(%(ACTX)s->pinfo->cinfo, &value, h245_ResponseMessage_vals, h245_ResponseMessage_short_vals); col_set_fence(%(ACTX)s->pinfo->cinfo,COL_INFO); if (h245_pi != NULL){ @@ -434,18 +415,9 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format gint32 value; %(DEFAULT_BODY)s - if ( h245_shorttypes == TRUE ) - { - col_prepend_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(value, h245_IndicationMessage_short_vals, "<unknown>")); - } - else - { - col_prepend_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(value, h245_IndicationMessage_vals, "<unknown>")); - } - + print_info_column(%(ACTX)s->pinfo->cinfo, &value, h245_IndicationMessage_vals, h245_IndicationMessage_short_vals); col_set_fence(%(ACTX)s->pinfo->cinfo,COL_INFO); + /* Add to packet info */ if (h245_pi !=NULL){ if ( strlen(h245_pi->frame_label) == 0 ){ @@ -461,18 +433,9 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format gint32 value; %(DEFAULT_BODY)s - if ( h245_shorttypes == TRUE ) - { - col_prepend_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(value, h245_CommandMessage_short_vals, "<unknown>")); - } - else - { - col_prepend_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(value, h245_CommandMessage_vals, "<unknown>")); - } - + print_info_column(%(ACTX)s->pinfo->cinfo, &value, h245_CommandMessage_vals, h245_CommandMessage_short_vals); col_set_fence(%(ACTX)s->pinfo->cinfo,COL_INFO); + /* Add to packet info */ if (h245_pi != NULL){ if ( strlen(h245_pi->frame_label) == 0 ){ diff --git a/asn1/h245/packet-h245-template.c b/asn1/h245/packet-h245-template.c index 6513f5e0a3..a2bc16d616 100644 --- a/asn1/h245/packet-h245-template.c +++ b/asn1/h245/packet-h245-template.c @@ -80,6 +80,7 @@ h245_packet_info *h245_pi=NULL; static gboolean h245_reassembly = TRUE; static gboolean h245_shorttypes = FALSE; +static gboolean info_col_fmt_prepend = FALSE; #include "packet-h245-val.h" @@ -377,6 +378,26 @@ static void h245_setup_channels(packet_info *pinfo, channel_info_t *upcoming_cha } } +/* Prints formated information column of h245 messages. Note that global variables + * "h245_shorttypes" and "info_col_fmt_prepend" are used to decide formating preferences */ +static void print_info_column(column_info *cinfo, const gint32 *value, + const value_string *msg_vals, const value_string *short_msg_vals) +{ + const value_string *vals; + + if (h245_shorttypes == FALSE || short_msg_vals == NULL) { + vals = msg_vals; + } else { + vals = short_msg_vals; + } + + if (info_col_fmt_prepend == FALSE) { + col_append_fstr(cinfo, COL_INFO, "%s ", val_to_str(*value, vals, "<unknown>")); + } else { + col_prepend_fstr(cinfo, COL_INFO, "%s ", val_to_str(*value, vals, "<unknown>")); + } +} + /* Initialize the protocol and registered fields */ static int proto_h245 = -1; #include "packet-h245-hf.c" @@ -507,6 +528,10 @@ void proto_register_h245(void) { "Show short message types", "Whether the dissector should show short names or the long names from the standard", &h245_shorttypes); + prefs_register_bool_preference(h245_module, "prepand", + "Show h245 info in reversed order", + "Whether the dissector should print items of h245 Info column in reversed order", + &info_col_fmt_prepend); register_dissector("h245dg", dissect_h245_h245, proto_h245); register_dissector("h245", dissect_h245, proto_h245); |