diff options
Diffstat (limited to 'epan/dissectors/packet-xtp.c')
-rw-r--r-- | epan/dissectors/packet-xtp.c | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/epan/dissectors/packet-xtp.c b/epan/dissectors/packet-xtp.c index fcfa143103..1918cadd81 100644 --- a/epan/dissectors/packet-xtp.c +++ b/epan/dissectors/packet-xtp.c @@ -71,6 +71,8 @@ void proto_register_xtp(void); void proto_reg_handoff_xtp(void); +static dissector_handle_t xtp_handle; + /** packet structures definition **/ struct xtp_cntl { guint64 rseq; @@ -222,93 +224,93 @@ static const value_string diag_val_vals[] = { }; /* Initialize the protocol and registered fields */ -static int proto_xtp = -1; +static int proto_xtp; /* common header */ -static int hf_xtp_key = -1; -static int hf_xtp_cmd = -1; -static int hf_xtp_cmd_options = -1; -static int hf_xtp_cmd_options_nocheck = -1; -static int hf_xtp_cmd_options_edge = -1; -static int hf_xtp_cmd_options_noerr = -1; -static int hf_xtp_cmd_options_multi = -1; -static int hf_xtp_cmd_options_res = -1; -static int hf_xtp_cmd_options_sort = -1; -static int hf_xtp_cmd_options_noflow = -1; -static int hf_xtp_cmd_options_fastnak = -1; -static int hf_xtp_cmd_options_sreq = -1; -static int hf_xtp_cmd_options_dreq = -1; -static int hf_xtp_cmd_options_rclose = -1; -static int hf_xtp_cmd_options_wclose = -1; -static int hf_xtp_cmd_options_eom = -1; -static int hf_xtp_cmd_options_end = -1; -static int hf_xtp_cmd_options_btag = -1; -static int hf_xtp_cmd_ptype = -1; -static int hf_xtp_cmd_ptype_ver = -1; -static int hf_xtp_cmd_ptype_pformat = -1; -static int hf_xtp_dlen = -1; -static int hf_xtp_sort = -1; -static int hf_xtp_sync = -1; -static int hf_xtp_seq = -1; +static int hf_xtp_key; +static int hf_xtp_cmd; +static int hf_xtp_cmd_options; +static int hf_xtp_cmd_options_nocheck; +static int hf_xtp_cmd_options_edge; +static int hf_xtp_cmd_options_noerr; +static int hf_xtp_cmd_options_multi; +static int hf_xtp_cmd_options_res; +static int hf_xtp_cmd_options_sort; +static int hf_xtp_cmd_options_noflow; +static int hf_xtp_cmd_options_fastnak; +static int hf_xtp_cmd_options_sreq; +static int hf_xtp_cmd_options_dreq; +static int hf_xtp_cmd_options_rclose; +static int hf_xtp_cmd_options_wclose; +static int hf_xtp_cmd_options_eom; +static int hf_xtp_cmd_options_end; +static int hf_xtp_cmd_options_btag; +static int hf_xtp_cmd_ptype; +static int hf_xtp_cmd_ptype_ver; +static int hf_xtp_cmd_ptype_pformat; +static int hf_xtp_dlen; +static int hf_xtp_sort; +static int hf_xtp_sync; +static int hf_xtp_seq; /* control segment */ -static int hf_xtp_cntl_rseq = -1; -static int hf_xtp_cntl_alloc = -1; -static int hf_xtp_cntl_echo = -1; -static int hf_xtp_ecntl_rseq = -1; -static int hf_xtp_ecntl_alloc = -1; -static int hf_xtp_ecntl_echo = -1; -static int hf_xtp_ecntl_nspan = -1; -static int hf_xtp_ecntl_span_left = -1; -static int hf_xtp_ecntl_span_right = -1; -static int hf_xtp_tcntl_rseq = -1; -static int hf_xtp_tcntl_alloc = -1; -static int hf_xtp_tcntl_echo = -1; -static int hf_xtp_tcntl_rsvd = -1; -static int hf_xtp_tcntl_xkey = -1; +static int hf_xtp_cntl_rseq; +static int hf_xtp_cntl_alloc; +static int hf_xtp_cntl_echo; +static int hf_xtp_ecntl_rseq; +static int hf_xtp_ecntl_alloc; +static int hf_xtp_ecntl_echo; +static int hf_xtp_ecntl_nspan; +static int hf_xtp_ecntl_span_left; +static int hf_xtp_ecntl_span_right; +static int hf_xtp_tcntl_rseq; +static int hf_xtp_tcntl_alloc; +static int hf_xtp_tcntl_echo; +static int hf_xtp_tcntl_rsvd; +static int hf_xtp_tcntl_xkey; /* traffic specifier */ -static int hf_xtp_tspec_tlen = -1; -static int hf_xtp_tspec_service = -1; -static int hf_xtp_tspec_tformat = -1; -static int hf_xtp_tspec_traffic = -1; -static int hf_xtp_tspec_maxdata = -1; -static int hf_xtp_tspec_inrate = -1; -static int hf_xtp_tspec_outrate = -1; -static int hf_xtp_tspec_inburst = -1; -static int hf_xtp_tspec_outburst = -1; +static int hf_xtp_tspec_tlen; +static int hf_xtp_tspec_service; +static int hf_xtp_tspec_tformat; +static int hf_xtp_tspec_traffic; +static int hf_xtp_tspec_maxdata; +static int hf_xtp_tspec_inrate; +static int hf_xtp_tspec_outrate; +static int hf_xtp_tspec_inburst; +static int hf_xtp_tspec_outburst; /* address segment */ -static int hf_xtp_aseg_alen = -1; -static int hf_xtp_aseg_adomain = -1; -static int hf_xtp_aseg_aformat = -1; -static int hf_xtp_aseg_address = -1; -static int hf_xtp_aseg_dsthost = -1; -static int hf_xtp_aseg_srchost = -1; -static int hf_xtp_aseg_dstport = -1; -static int hf_xtp_aseg_srcport = -1; +static int hf_xtp_aseg_alen; +static int hf_xtp_aseg_adomain; +static int hf_xtp_aseg_aformat; +static int hf_xtp_aseg_address; +static int hf_xtp_aseg_dsthost; +static int hf_xtp_aseg_srchost; +static int hf_xtp_aseg_dstport; +static int hf_xtp_aseg_srcport; /* others */ -static int hf_xtp_btag = -1; -static int hf_xtp_diag_code = -1; -static int hf_xtp_diag_val = -1; -static int hf_xtp_diag_msg = -1; -static int hf_xtp_checksum = -1; -static int hf_xtp_checksum_status = -1; -static int hf_xtp_data = -1; +static int hf_xtp_btag; +static int hf_xtp_diag_code; +static int hf_xtp_diag_val; +static int hf_xtp_diag_msg; +static int hf_xtp_checksum; +static int hf_xtp_checksum_status; +static int hf_xtp_data; /* Initialize the subtree pointers */ -static gint ett_xtp = -1; -static gint ett_xtp_cmd = -1; -static gint ett_xtp_cmd_options = -1; -static gint ett_xtp_cmd_ptype = -1; -static gint ett_xtp_cntl = -1; -static gint ett_xtp_ecntl = -1; -static gint ett_xtp_tcntl = -1; -static gint ett_xtp_tspec = -1; -static gint ett_xtp_jcntl = -1; -static gint ett_xtp_first = -1; -static gint ett_xtp_aseg = -1; -static gint ett_xtp_data = -1; -static gint ett_xtp_diag = -1; - -static expert_field ei_xtp_spans_bad = EI_INIT; -static expert_field ei_xtp_checksum = EI_INIT; +static gint ett_xtp; +static gint ett_xtp_cmd; +static gint ett_xtp_cmd_options; +static gint ett_xtp_cmd_ptype; +static gint ett_xtp_cntl; +static gint ett_xtp_ecntl; +static gint ett_xtp_tcntl; +static gint ett_xtp_tspec; +static gint ett_xtp_jcntl; +static gint ett_xtp_first; +static gint ett_xtp_aseg; +static gint ett_xtp_data; +static gint ett_xtp_diag; + +static expert_field ei_xtp_spans_bad; +static expert_field ei_xtp_checksum; /* dissector of each payload */ static int @@ -469,12 +471,12 @@ dissect_xtp_traffic_cntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /** add summary **/ col_append_fstr(pinfo->cinfo, COL_INFO, - " Recv-Seq=%" G_GINT64_MODIFIER "u", tcntl->rseq); + " Recv-Seq=%" PRIu64, tcntl->rseq); col_append_fstr(pinfo->cinfo, COL_INFO, - " Alloc=%" G_GINT64_MODIFIER "u", tcntl->alloc); + " Alloc=%" PRIu64, tcntl->alloc); proto_item_append_text(top_ti, - ", Recv-Seq: %" G_GINT64_MODIFIER "u", tcntl->rseq); + ", Recv-Seq: %" PRIu64, tcntl->rseq); /** display **/ offset = start; @@ -673,12 +675,12 @@ dissect_xtp_cntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /** add summary **/ col_append_fstr(pinfo->cinfo, COL_INFO, - " Recv-Seq=%" G_GINT64_MODIFIER "u", cntl->rseq); + " Recv-Seq=%" PRIu64, cntl->rseq); col_append_fstr(pinfo->cinfo, COL_INFO, - " Alloc=%" G_GINT64_MODIFIER "u", cntl->alloc); + " Alloc=%" PRIu64, cntl->alloc); proto_item_append_text(top_ti, - ", Recv-Seq: %" G_GINT64_MODIFIER "u", cntl->rseq); + ", Recv-Seq: %" PRIu64, cntl->rseq); /** display **/ offset = start; @@ -763,12 +765,12 @@ dissect_xtp_ecntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /** add summary **/ col_append_fstr(pinfo->cinfo, COL_INFO, - " Recv-Seq=%" G_GINT64_MODIFIER "u", ecntl->rseq); + " Recv-Seq=%" PRIu64, ecntl->rseq); col_append_fstr(pinfo->cinfo, COL_INFO, - " Alloc=%" G_GINT64_MODIFIER "u", ecntl->alloc); + " Alloc=%" PRIu64, ecntl->alloc); proto_item_append_text(top_ti, - ", Recv-Seq: %" G_GINT64_MODIFIER "u", ecntl->rseq); + ", Recv-Seq: %" PRIu64, ecntl->rseq); /** display **/ offset = start; @@ -856,7 +858,7 @@ dissect_xtp_diag(tvbuff_t *tvb, proto_tree *tree, guint32 offset) { offset += 4; /* message(n) */ proto_tree_add_item(xtp_subtree, hf_xtp_diag_msg, - tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII|ENC_NA); + tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII); return; } @@ -941,7 +943,7 @@ dissect_xtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) for (i = 0; i < 16; i++) { bpos = 1 << (15 - i); if (cmd_options & bpos) { - returned_length = g_snprintf(&options[fpos], + returned_length = snprintf(&options[fpos], MAX_OPTIONS_LEN-fpos, "%s%s", fpos?", ":"", fstr[i]); @@ -954,16 +956,16 @@ dissect_xtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) pformat_vals, "Unknown pformat (%u)")); col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", options); col_append_fstr(pinfo->cinfo, COL_INFO, - " Seq=%" G_GINT64_MODIFIER "u", xtph->seq); + " Seq=%" PRIu64, xtph->seq); col_append_fstr(pinfo->cinfo, COL_INFO, " Len=%u", xtph->dlen); /* if (tree) */ { ti = proto_tree_add_item(tree, proto_xtp, tvb, 0, -1, ENC_NA); /** add summary **/ proto_item_append_text(ti, - ", Key: 0x%016" G_GINT64_MODIFIER "X", xtph->key); + ", Key: 0x%016" PRIX64, xtph->key); proto_item_append_text(ti, - ", Seq: %" G_GINT64_MODIFIER "u", xtph->seq); + ", Seq: %" PRIu64, xtph->seq); proto_item_append_text(ti, ", Len: %u", xtph->dlen); xtp_tree = proto_item_add_subtree(ti, ett_xtp); @@ -1373,14 +1375,12 @@ proto_register_xtp(void) expert_xtp = expert_register_protocol(proto_xtp); expert_register_field_array(expert_xtp, ei, array_length(ei)); + xtp_handle = register_dissector("xtp", dissect_xtp, proto_xtp); } void proto_reg_handoff_xtp(void) { - dissector_handle_t xtp_handle; - - xtp_handle = create_dissector_handle(dissect_xtp, proto_xtp); dissector_add_uint("ip.proto", IP_PROTO_XTP, xtp_handle); } |