Minor cleanup: whitespace, indentation, long-lines, style, typos, etc;

Also: remove unneeded #include <stdlib.h> in 2 cases.

svn path=/trunk/; revision=42226
This commit is contained in:
Bill Meier 2012-04-24 18:27:06 +00:00
parent 53738a1695
commit 1ec161eab8
11 changed files with 2225 additions and 2218 deletions

View File

@ -73,27 +73,27 @@ dissect_bofl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO);
if (tree) {
ti = proto_tree_add_item(tree, proto_bofl, tvb, 0, -1, ENC_NA);
bofl_tree = proto_item_add_subtree(ti, ett_bofl);
ti = proto_tree_add_item(tree, proto_bofl, tvb, 0, -1, ENC_NA);
bofl_tree = proto_item_add_subtree(ti, ett_bofl);
}
pdu = tvb_get_ntohl(tvb, 0);
col_add_fstr(pinfo->cinfo, COL_INFO,
"PDU: 0x%08x", pdu);
col_add_fstr(pinfo->cinfo, COL_INFO,
"PDU: 0x%08x", pdu);
if (tree)
proto_tree_add_uint(bofl_tree, hf_bofl_pdu, tvb, 0, 4, pdu);
proto_tree_add_uint(bofl_tree, hf_bofl_pdu, tvb, 0, 4, pdu);
sequence = tvb_get_ntohl(tvb, 4);
col_append_fstr(pinfo->cinfo, COL_INFO,
" Sequence: %u", sequence);
col_append_fstr(pinfo->cinfo, COL_INFO,
" Sequence: %u", sequence);
if (tree) {
proto_tree_add_uint(bofl_tree, hf_bofl_sequence, tvb, 4, 4, sequence);
proto_tree_add_uint(bofl_tree, hf_bofl_sequence, tvb, 4, 4, sequence);
len = tvb_length_remaining(tvb, 8);
if (len > 0)
proto_tree_add_text(bofl_tree, tvb, 8, len,
"Padding (%d byte)", len);
len = tvb_length_remaining(tvb, 8);
if (len > 0)
proto_tree_add_text(bofl_tree, tvb, 8, len,
"Padding (%d byte)", len);
}
}
@ -102,24 +102,24 @@ void
proto_register_bofl(void)
{
static hf_register_info hf[] = {
{ &hf_bofl_pdu,
{ "PDU", "bofl.pdu",
FT_UINT32, BASE_HEX, NULL, 0,
"PDU; normally equals 0x01010000 or 0x01011111", HFILL }
},
{ &hf_bofl_sequence,
{ "Sequence", "bofl.sequence",
FT_UINT32, BASE_DEC, NULL, 0,
"incremental counter", HFILL }
}
{ &hf_bofl_pdu,
{ "PDU", "bofl.pdu",
FT_UINT32, BASE_HEX, NULL, 0,
"PDU; normally equals 0x01010000 or 0x01011111", HFILL }
},
{ &hf_bofl_sequence,
{ "Sequence", "bofl.sequence",
FT_UINT32, BASE_DEC, NULL, 0,
"incremental counter", HFILL }
}
};
static gint *ett[] = {
&ett_bofl,
&ett_bofl,
};
proto_bofl = proto_register_protocol("Wellfleet Breath of Life",
"BOFL", "bofl");
"BOFL", "bofl");
proto_register_field_array(proto_bofl, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}

View File

@ -134,11 +134,11 @@ static int
dissect_brp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *brp_item = NULL;
proto_tree *brp_tree = NULL;
gint offset = 0;
guint8 type = 0;
guint8 packet_type = tvb_get_guint8(tvb, 0);
proto_item *brp_item = NULL;
proto_tree *brp_tree = NULL;
gint offset = 0;
guint8 type = 0;
guint8 packet_type = tvb_get_guint8(tvb, 0);
/* If there is a "tree" requested, we handle that request. */
@ -401,9 +401,9 @@ void proto_register_brp (void)
/* Register preferences */
prefs_register_uint_preference(brp_module, "port",
"BRP Port",
"Set the UDP port for BRP messages",
10, &global_brp_port);
"BRP Port",
"Set the UDP port for BRP messages",
10, &global_brp_port);
new_register_dissector("brp", dissect_brp, proto_brp);
}
@ -411,23 +411,23 @@ void proto_register_brp (void)
/*--- proto_reg_handoff_brp -------------------------------------------*/
void proto_reg_handoff_brp(void)
{
static gboolean initialized = FALSE;
static gboolean initialized = FALSE;
static dissector_handle_t brp_handle;
static guint saved_brp_port;
static guint saved_brp_port;
if (!initialized) {
brp_handle = new_create_dissector_handle(dissect_brp, proto_brp);
dissector_add_handle("udp.port", brp_handle);
initialized = TRUE;
brp_handle = new_create_dissector_handle(dissect_brp, proto_brp);
dissector_add_handle("udp.port", brp_handle);
initialized = TRUE;
} else {
if (saved_brp_port != 0) {
dissector_delete_uint("udp.port", saved_brp_port, brp_handle);
}
if (saved_brp_port != 0) {
dissector_delete_uint("udp.port", saved_brp_port, brp_handle);
}
}
/* Set the port number */
if (global_brp_port != 0) {
dissector_add_uint("udp.port", global_brp_port, brp_handle);
dissector_add_uint("udp.port", global_brp_port, brp_handle);
}
saved_brp_port = global_brp_port;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
/*
* See section 4.3.1 of RFC 1547, and
*
* http://www.nethelp.no/net/cisco-hdlc.txt
* http://www.nethelp.no/net/cisco-hdlc.txt
*/
static int proto_chdlc = -1;
@ -76,31 +76,31 @@ static dissector_handle_t data_handle;
* wouldn't be in the Ethernet dissector table, and check that
* table first and the Ethernet dissector table if that fails.
*/
#define CISCO_SLARP 0x8035 /* Cisco SLARP protocol */
#define CISCO_SLARP 0x8035 /* Cisco SLARP protocol */
static dissector_table_t subdissector_table;
static const value_string chdlc_address_vals[] = {
{CHDLC_ADDR_UNICAST, "Unicast"},
{CHDLC_ADDR_MULTICAST, "Multicast"},
{0, NULL}
{CHDLC_ADDR_UNICAST, "Unicast"},
{CHDLC_ADDR_MULTICAST, "Multicast"},
{0, NULL}
};
const value_string chdlc_vals[] = {
{0x2000, "Cisco Discovery Protocol"},
{ETHERTYPE_IP, "IP"},
{ETHERTYPE_IPv6, "IPv6"},
{CISCO_SLARP, "SLARP"},
{ETHERTYPE_DEC_LB, "DEC LanBridge"},
{CHDLCTYPE_BPDU, "Spanning Tree BPDU"},
{ETHERTYPE_ATALK, "Appletalk"},
{ETHERTYPE_AARP, "AARP"},
{ETHERTYPE_IPX, "Netware IPX/SPX"},
{ETHERTYPE_ETHBRIDGE, "Transparent Ethernet bridging" },
{CHDLCTYPE_OSI, "OSI" },
{ETHERTYPE_MPLS, "MPLS unicast"},
{ETHERTYPE_MPLS_MULTI, "MPLS multicast"},
{0, NULL}
{0x2000, "Cisco Discovery Protocol"},
{ETHERTYPE_IP, "IP"},
{ETHERTYPE_IPv6, "IPv6"},
{CISCO_SLARP, "SLARP"},
{ETHERTYPE_DEC_LB, "DEC LanBridge"},
{CHDLCTYPE_BPDU, "Spanning Tree BPDU"},
{ETHERTYPE_ATALK, "Appletalk"},
{ETHERTYPE_AARP, "AARP"},
{ETHERTYPE_IPX, "Netware IPX/SPX"},
{ETHERTYPE_ETHBRIDGE, "Transparent Ethernet bridging" },
{CHDLCTYPE_OSI, "OSI" },
{ETHERTYPE_MPLS, "MPLS unicast"},
{ETHERTYPE_MPLS_MULTI, "MPLS multicast"},
{0, NULL}
};
void
@ -121,15 +121,15 @@ capture_chdlc( const guchar *pd, int offset, int len, packet_counts *ld ) {
void
chdlctype(guint16 chdlc_type, tvbuff_t *tvb, int offset_after_chdlctype,
packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
int chdlctype_id)
packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
int chdlctype_id)
{
tvbuff_t *next_tvb;
int padbyte = 0;
tvbuff_t *next_tvb;
int padbyte = 0;
if (tree) {
proto_tree_add_uint(fh_tree, chdlctype_id, tvb,
offset_after_chdlctype - 2, 2, chdlc_type);
offset_after_chdlctype - 2, 2, chdlc_type);
}
padbyte = tvb_get_guint8(tvb, offset_after_chdlctype);
@ -147,7 +147,7 @@ chdlctype(guint16 chdlc_type, tvbuff_t *tvb, int offset_after_chdlctype,
/* do lookup with the subdissector table */
if (!dissector_try_uint(subdissector_table, chdlc_type, next_tvb, pinfo, tree)) {
col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", chdlc_type);
col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", chdlc_type);
call_dissector(data_handle,next_tvb, pinfo, tree);
}
}
@ -159,8 +159,8 @@ dissect_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
proto_tree *fh_tree = NULL;
guint8 addr;
guint16 proto;
guint8 addr;
guint16 proto;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CHDLC");
col_clear(pinfo->cinfo, COL_INFO);
@ -221,7 +221,7 @@ proto_register_chdlc(void)
/* subdissector code */
subdissector_table = register_dissector_table("chdlctype",
"Cisco HDLC frame type", FT_UINT16, BASE_HEX);
"Cisco HDLC frame type", FT_UINT16, BASE_HEX);
register_dissector("chdlc", dissect_chdlc, proto_chdlc);
@ -229,11 +229,11 @@ proto_register_chdlc(void)
chdlc_module = prefs_register_protocol(proto_chdlc, NULL);
prefs_register_enum_preference(chdlc_module,
"fcs_type",
"CHDLC Frame Checksum Type",
"The type of CHDLC frame checksum (none, 16-bit, 32-bit)",
&chdlc_fcs_decode,
fcs_options, ENC_BIG_ENDIAN);
"fcs_type",
"CHDLC Frame Checksum Type",
"The type of CHDLC frame checksum (none, 16-bit, 32-bit)",
&chdlc_fcs_decode,
fcs_options, ENC_BIG_ENDIAN);
}
@ -242,21 +242,24 @@ proto_reg_handoff_chdlc(void)
{
dissector_handle_t chdlc_handle;
data_handle = find_dissector("data");
data_handle = find_dissector("data");
chdlc_handle = find_dissector("chdlc");
dissector_add_uint("wtap_encap", WTAP_ENCAP_CHDLC, chdlc_handle);
dissector_add_uint("wtap_encap", WTAP_ENCAP_CHDLC_WITH_PHDR, chdlc_handle);
}
#define SLARP_REQUEST 0
#define SLARP_REPLY 1
#define SLARP_LINECHECK 2
#define SLARP_REQUEST 0
#define SLARP_REPLY 1
#define SLARP_LINECHECK 2
static const value_string slarp_ptype_vals[] = {
{SLARP_REQUEST, "Request"},
{SLARP_REPLY, "Reply"},
{SLARP_LINECHECK, "Line keepalive"},
{0, NULL}
{SLARP_REQUEST, "Request"},
{SLARP_REPLY, "Reply"},
{SLARP_LINECHECK, "Line keepalive"},
{0, NULL}
};
static void
@ -264,10 +267,10 @@ dissect_slarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
proto_tree *slarp_tree = NULL;
guint32 code;
guint32 addr;
guint32 mysequence;
guint32 yoursequence;
guint32 code;
guint32 addr;
guint32 mysequence;
guint32 yoursequence;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SLARP");
col_clear(pinfo->cinfo, COL_INFO);
@ -283,31 +286,31 @@ dissect_slarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case SLARP_REQUEST:
case SLARP_REPLY:
addr = tvb_get_ipv4(tvb, 4);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s, from %s, mask %s",
val_to_str(code, slarp_ptype_vals, "Unknown (%d)"),
get_hostname(addr), tvb_ip_to_str(tvb, 8));
addr = tvb_get_ipv4(tvb, 4);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s, from %s, mask %s",
val_to_str(code, slarp_ptype_vals, "Unknown (%d)"),
get_hostname(addr), tvb_ip_to_str(tvb, 8));
if (tree) {
proto_tree_add_uint(slarp_tree, hf_slarp_ptype, tvb, 0, 4, code);
proto_tree_add_item(slarp_tree, hf_slarp_address, tvb, 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_text(slarp_tree, tvb, 8, 4,
"Netmask: %s", tvb_ip_to_str(tvb, 8));
"Netmask: %s", tvb_ip_to_str(tvb, 8));
}
break;
case SLARP_LINECHECK:
mysequence = tvb_get_ntohl(tvb, 4);
yoursequence = tvb_get_ntohl(tvb, 8);
col_add_fstr(pinfo->cinfo, COL_INFO,
"%s, outgoing sequence %u, returned sequence %u",
val_to_str(code, slarp_ptype_vals, "Unknown (%d)"),
mysequence, yoursequence);
col_add_fstr(pinfo->cinfo, COL_INFO,
"%s, outgoing sequence %u, returned sequence %u",
val_to_str(code, slarp_ptype_vals, "Unknown (%d)"),
mysequence, yoursequence);
if (tree) {
proto_tree_add_uint(slarp_tree, hf_slarp_ptype, tvb, 0, 4, code);
proto_tree_add_uint(slarp_tree, hf_slarp_mysequence, tvb, 4, 4,
mysequence);
mysequence);
proto_tree_add_uint(slarp_tree, hf_slarp_mysequence, tvb, 8, 4,
yoursequence);
yoursequence);
}
break;
@ -316,7 +319,7 @@ dissect_slarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree) {
proto_tree_add_uint(slarp_tree, hf_slarp_ptype, tvb, 0, 4, code);
call_dissector(data_handle, tvb_new_subset_remaining(tvb, 4), pinfo,
slarp_tree);
slarp_tree);
}
break;
}

View File

@ -29,8 +29,8 @@
#endif
#include <glib.h>
#include <epan/prefs.h>
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
#include "packet-frame.h"
#include "packet-osi.h"
@ -188,33 +188,34 @@ static gboolean clnp_reassemble = TRUE;
* CLNP part / main entry point
*/
static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void
dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *clnp_tree = NULL;
proto_item *ti;
guint8 cnf_proto_id;
guint8 cnf_hdr_len;
guint8 cnf_vers;
guint8 cnf_ttl;
guint8 cnf_type;
char flag_string[6+1];
const char *pdu_type_string;
proto_tree *type_tree;
guint16 segment_length;
guint16 du_id = 0;
guint16 segment_offset = 0;
guint16 cnf_cksum;
cksum_status_t cksum_status;
int offset;
guchar src_len, dst_len, nsel, opt_len = 0;
const guint8 *dst_addr, *src_addr;
guint next_length;
proto_tree *discpdu_tree;
gboolean save_in_error_pkt;
fragment_data *fd_head;
tvbuff_t *next_tvb;
gboolean update_col_info = TRUE;
gboolean save_fragmented;
proto_tree *clnp_tree = NULL;
proto_item *ti;
guint8 cnf_proto_id;
guint8 cnf_hdr_len;
guint8 cnf_vers;
guint8 cnf_ttl;
guint8 cnf_type;
char flag_string[6+1];
const char *pdu_type_string;
proto_tree *type_tree;
guint16 segment_length;
guint16 du_id = 0;
guint16 segment_offset = 0;
guint16 cnf_cksum;
cksum_status_t cksum_status;
int offset;
guchar src_len, dst_len, nsel, opt_len = 0;
const guint8 *dst_addr, *src_addr;
guint next_length;
proto_tree *discpdu_tree;
gboolean save_in_error_pkt;
fragment_data *fd_head;
tvbuff_t *next_tvb;
gboolean update_col_info = TRUE;
gboolean save_fragmented;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CLNP");
col_clear(pinfo->cinfo, COL_INFO);
@ -510,7 +511,7 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
part of the discarded PDU", i.e. it's like an ICMP error;
dissect it as a CLNP PDU. */
col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string);
next_length = tvb_length_remaining(tvb, offset);
if (next_length != 0) {
/* We have payload; dissect it. */
@ -551,7 +552,8 @@ clnp_reassemble_init(void)
reassembled_table_init(&clnp_reassembled_table);
}
void proto_register_clnp(void)
void
proto_register_clnp(void)
{
static hf_register_info hf[] = {
{ &hf_clnp_id,

View File

@ -27,18 +27,16 @@
# include "config.h"
#endif
#include <stdlib.h>
#include <epan/packet.h>
#include <epan/dissectors/packet-tcp.h>
#define CMPP_FIX_HEADER_LENGTH 12
#define CMPP_FIX_HEADER_LENGTH 12
#define CMPP_DELIVER_REPORT_LEN 71
/* These are not registered with IANA */
#define CMPP_SP_LONG_PORT 7890
#define CMPP_SP_SHORT_PORT 7900
#define CMPP_ISMG_LONG_PORT 7930
#define CMPP_SP_LONG_PORT 7890
#define CMPP_SP_SHORT_PORT 7900
#define CMPP_ISMG_LONG_PORT 7930
#define CMPP_ISMG_SHORT_PORT 9168
/* Initialize the protocol and registered fields */
@ -152,39 +150,39 @@ static gboolean cmpp_desegment = TRUE;
#define CMPP_PUSH_MO_ROUTE_UPDATE_RESP 0x80000016
#define CMPP_GET_MO_ROUTE_RESP 0x80000017
static const value_string vals_command_Id[] = { /* Operation */
{ CMPP_CONNECT, "CMPP_CONNECT" },
{ CMPP_CONNECT_RESP, "CMPP_CONNECT_RESP" },
{ CMPP_TERMINATE, "CMPP_TERMINATE" },
{ CMPP_TERMINATE_RESP, "CMPP_TERMINATE_RESP" },
{ CMPP_SUBMIT, "CMPP_SUBMIT" },
{ CMPP_SUBMIT_RESP, "CMPP_SUBMIT_RESP" },
{ CMPP_DELIVER, "CMPP_DELIVER" },
{ CMPP_DELIVER_RESP, "CMPP_DELIVER_RESP" },
{ CMPP_QUERY, "CMPP_QUERY" },
{ CMPP_QUERY_RESP, "CMPP_QUERY" },
{ CMPP_CANCEL, "CMPP_CANCEL" },
{ CMPP_CANCEL_RESP, "CMPP_CANCEL_RESP" },
{ CMPP_ACTIVE_TEST, "CMPP_ACTIVE_TEST" },
{ CMPP_ACTIVE_TEST_RESP, "CMPP_ACTIVE_TEST_RESP" },
{ CMPP_FWD, "CMPP_FWD" },
{ CMPP_FWD_RESP, "CMPP_FWD_RESP" },
{ CMPP_MT_ROUTE, "CMPP_MT_ROUTE" },
{ CMPP_MO_ROUTE, "CMPP_MO_ROUTE" },
{ CMPP_GET_MT_ROUTE, "CMPP_GET_MT_ROUTE" },
{ CMPP_MT_ROUTE_UPDATE, "CMPP_MT_ROUTE_UPDATE" },
{ CMPP_MO_ROUTE_UPDATE, "CMPP_MO_ROUTE_UPDATE" },
{ CMPP_PUSH_MT_ROUTE_UPDATE, "CMPP_PUSH_MT_ROUTE_UPDATE" },
{ CMPP_PUSH_MO_ROUTE_UPDATE, "CMPP_PUSH_MO_ROUTE_UPDATE" },
{ CMPP_GET_MO_ROUTE, "CMPP_GET_MO_ROUTE" },
{ CMPP_MT_ROUTE_RESP, "CMPP_MT_ROUTE_RESP" },
{ CMPP_MO_ROUTE_RESP, "CMPP_MO_ROUTE_RESP" },
{ CMPP_GET_MT_ROUTE_RESP, "CMPP_GET_MT_ROUTE_RESP" },
{ CMPP_MT_ROUTE_UPDATE_RESP, "CMPP_MT_ROUTE_UPDATE_RESP" },
{ CMPP_MO_ROUTE_UPDATE_RESP, "CMPP_MO_ROUTE_UPDATE_RESP" },
{ CMPP_PUSH_MT_ROUTE_UPDATE_RESP, "CMPP_PUSH_MT_ROUTE_UPDATE_RESP" },
{ CMPP_PUSH_MO_ROUTE_UPDATE_RESP, "CMPP_PUSH_MO_ROUTE_UPDATE_RESP" },
{ CMPP_GET_MO_ROUTE_RESP, "CMPP_GET_MO_ROUTE_RESP" },
{ 0, NULL }
{ CMPP_CONNECT, "CMPP_CONNECT" },
{ CMPP_CONNECT_RESP, "CMPP_CONNECT_RESP" },
{ CMPP_TERMINATE, "CMPP_TERMINATE" },
{ CMPP_TERMINATE_RESP, "CMPP_TERMINATE_RESP" },
{ CMPP_SUBMIT, "CMPP_SUBMIT" },
{ CMPP_SUBMIT_RESP, "CMPP_SUBMIT_RESP" },
{ CMPP_DELIVER, "CMPP_DELIVER" },
{ CMPP_DELIVER_RESP, "CMPP_DELIVER_RESP" },
{ CMPP_QUERY, "CMPP_QUERY" },
{ CMPP_QUERY_RESP, "CMPP_QUERY" },
{ CMPP_CANCEL, "CMPP_CANCEL" },
{ CMPP_CANCEL_RESP, "CMPP_CANCEL_RESP" },
{ CMPP_ACTIVE_TEST, "CMPP_ACTIVE_TEST" },
{ CMPP_ACTIVE_TEST_RESP, "CMPP_ACTIVE_TEST_RESP" },
{ CMPP_FWD, "CMPP_FWD" },
{ CMPP_FWD_RESP, "CMPP_FWD_RESP" },
{ CMPP_MT_ROUTE, "CMPP_MT_ROUTE" },
{ CMPP_MO_ROUTE, "CMPP_MO_ROUTE" },
{ CMPP_GET_MT_ROUTE, "CMPP_GET_MT_ROUTE" },
{ CMPP_MT_ROUTE_UPDATE, "CMPP_MT_ROUTE_UPDATE" },
{ CMPP_MO_ROUTE_UPDATE, "CMPP_MO_ROUTE_UPDATE" },
{ CMPP_PUSH_MT_ROUTE_UPDATE, "CMPP_PUSH_MT_ROUTE_UPDATE" },
{ CMPP_PUSH_MO_ROUTE_UPDATE, "CMPP_PUSH_MO_ROUTE_UPDATE" },
{ CMPP_GET_MO_ROUTE, "CMPP_GET_MO_ROUTE" },
{ CMPP_MT_ROUTE_RESP, "CMPP_MT_ROUTE_RESP" },
{ CMPP_MO_ROUTE_RESP, "CMPP_MO_ROUTE_RESP" },
{ CMPP_GET_MT_ROUTE_RESP, "CMPP_GET_MT_ROUTE_RESP" },
{ CMPP_MT_ROUTE_UPDATE_RESP, "CMPP_MT_ROUTE_UPDATE_RESP" },
{ CMPP_MO_ROUTE_UPDATE_RESP, "CMPP_MO_ROUTE_UPDATE_RESP" },
{ CMPP_PUSH_MT_ROUTE_UPDATE_RESP, "CMPP_PUSH_MT_ROUTE_UPDATE_RESP" },
{ CMPP_PUSH_MO_ROUTE_UPDATE_RESP, "CMPP_PUSH_MO_ROUTE_UPDATE_RESP" },
{ CMPP_GET_MO_ROUTE_RESP, "CMPP_GET_MO_ROUTE_RESP" },
{ 0, NULL }
};
static const value_string vals_connect_resp_status[] = { /* Connection Status */
@ -266,13 +264,13 @@ cmpp_octet_string(proto_tree *tree, tvbuff_t *tvb, gint field, gint offset, gint
static char*
cmpp_version(proto_tree *tree, tvbuff_t *tvb, gint field, gint offset)
{
gint8 version, major, minor;
char *strval;
gint8 version, major, minor;
char *strval;
version = tvb_get_guint8(tvb, offset);
minor = version & 0x0F;
major = (version & 0xF0) >> 4;
strval = ep_strdup_printf("%02u.%02u", major, minor);
minor = version & 0x0F;
major = (version & 0xF0) >> 4;
strval = ep_strdup_printf("%02u.%02u", major, minor);
/* TODO: the version should be added as a uint_format */
proto_tree_add_string(tree, field, tvb, offset, 1, strval);
return strval;
@ -281,9 +279,9 @@ cmpp_version(proto_tree *tree, tvbuff_t *tvb, gint field, gint offset)
static char*
cmpp_timestamp(proto_tree *tree, tvbuff_t *tvb, gint field, gint offset)
{
gint8 month, day, hour, minute, second;
gint32 timevalue;
char *strval;
gint8 month, day, hour, minute, second;
gint32 timevalue;
char *strval;
timevalue = tvb_get_ntohl(tvb, offset);
second = timevalue % 100;
@ -344,11 +342,11 @@ cmpp_boolean(proto_tree *tree, tvbuff_t *tvb, gint field, gint offset)
static void
cmpp_msg_id(proto_tree *tree, tvbuff_t *tvb, gint field, gint offset)
{
guint8 month,day,hour,minute,second;
guint32 ismg_code;
guint8 month,day,hour,minute,second;
guint32 ismg_code;
proto_item *pi;
proto_tree *sub_tree;
char *strval;
char *strval;
pi = proto_tree_add_item(tree, field, tvb, offset, 8, ENC_BIG_ENDIAN);
sub_tree = proto_item_add_subtree(pi, ett_msg_id);
@ -398,7 +396,7 @@ cmpp_connect_resp(proto_tree *tree, tvbuff_t *tvb)
static void
cmpp_submit(proto_tree *tree, tvbuff_t *tvb)
{
int offset, i;
int offset, i;
guint8 destUsr, msgLen;
offset = CMPP_FIX_HEADER_LENGTH;
cmpp_msg_id(tree, tvb, hf_cmpp_msg_id, offset);
@ -493,7 +491,7 @@ cmpp_deliver_report(proto_tree *tree, tvbuff_t *tvb, gint field, guint offset)
static void
cmpp_deliver(proto_tree *tree, tvbuff_t *tvb)
{
guint offset, msgLen;
guint offset, msgLen;
gboolean report;
offset = CMPP_FIX_HEADER_LENGTH;
cmpp_msg_id(tree, tvb, hf_cmpp_msg_id, offset);
@ -541,11 +539,11 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
proto_tree *cmpp_tree;
guint command_id;
guint tvb_len;
guint total_length;
proto_item *ti;
proto_tree *cmpp_tree;
guint command_id;
guint tvb_len;
guint total_length;
const gchar *command_str; /* Header command string */
/* Get the length of the PDU */
@ -625,7 +623,7 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static guint
get_cmpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset)
{
return tvb_get_ntohl(tvb, offset);
return tvb_get_ntohl(tvb, offset);
}
@ -664,296 +662,293 @@ dissect_cmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Register the protocol with Wireshark */
/* this format is require because a script is used to build the C function
that calls all the protocol registration.
*/
void
proto_register_cmpp(void) {
/* Setup list of header fields See Section 1.6.1 for details*/
static hf_register_info hf[] = {
{ &hf_cmpp_Total_Length,
{ "Total Length", "cmpp.Total_Length",
FT_UINT32, BASE_DEC, NULL, 0x00,
"Total length of the CMPP PDU.",
HFILL }
{ "Total Length", "cmpp.Total_Length",
FT_UINT32, BASE_DEC, NULL, 0x00,
"Total length of the CMPP PDU.",
HFILL }
},
{ &hf_cmpp_Command_Id,
{ "Command Id", "cmpp.Command_Id",
FT_UINT32, BASE_HEX, VALS(vals_command_Id), 0x00,
"Command Id of the CMPP messages",
HFILL }
{ "Command Id", "cmpp.Command_Id",
FT_UINT32, BASE_HEX, VALS(vals_command_Id), 0x00,
"Command Id of the CMPP messages",
HFILL }
},
{ &hf_cmpp_Sequence_Id,
{ "Sequence Id", "cmpp.Sequence_Id",
FT_UINT32, BASE_DEC, NULL, 0x00,
"Sequence Id of the CMPP messages",
HFILL }
{ "Sequence Id", "cmpp.Sequence_Id",
FT_UINT32, BASE_DEC, NULL, 0x00,
"Sequence Id of the CMPP messages",
HFILL }
},
{ &hf_cmpp_connect_Source_Addr,
{ "Source Addr", "cmpp.connect.Source_Addr",
FT_STRING, BASE_NONE, NULL, 0x00,
"Source Address, the SP_Id",
HFILL }
{ "Source Addr", "cmpp.connect.Source_Addr",
FT_STRING, BASE_NONE, NULL, 0x00,
"Source Address, the SP_Id",
HFILL }
},
{ &hf_cmpp_connect_AuthenticatorSource,
{ "Authenticator Source", "cmpp.connect.AuthenticatorSource",
FT_STRING, BASE_NONE, NULL, 0x00,
"Authenticator source, MD5(Source_addr + 9 zero + shared secret + timestamp)",
HFILL }
{ "Authenticator Source", "cmpp.connect.AuthenticatorSource",
FT_STRING, BASE_NONE, NULL, 0x00,
"Authenticator source, MD5(Source_addr + 9 zero + shared secret + timestamp)",
HFILL }
},
{ &hf_cmpp_Version,
{ "Version", "cmpp.Version",
FT_STRING, BASE_NONE, NULL, 0x00,
"CMPP Version",
HFILL }
{ "Version", "cmpp.Version",
FT_STRING, BASE_NONE, NULL, 0x00,
"CMPP Version",
HFILL }
},
{ &hf_cmpp_connect_Timestamp,
{ "Timestamp", "cmpp.connect.Timestamp",
FT_STRING, BASE_NONE, NULL, 0x00,
"Timestamp MM/DD HH:MM:SS",
HFILL }
{ "Timestamp", "cmpp.connect.Timestamp",
FT_STRING, BASE_NONE, NULL, 0x00,
"Timestamp MM/DD HH:MM:SS",
HFILL }
},
{ &hf_cmpp_connect_resp_status,
{ "Connect Response Status", "cmpp.connect_resp.Status",
FT_UINT32, BASE_DEC, VALS(vals_connect_resp_status), 0x00,
"Response Status, Value higher then 4 means other error",
HFILL }
{ "Connect Response Status", "cmpp.connect_resp.Status",
FT_UINT32, BASE_DEC, VALS(vals_connect_resp_status), 0x00,
"Response Status, Value higher then 4 means other error",
HFILL }
},
{ &hf_cmpp_connect_resp_AuthenticatorISMG,
{ "SIMG Authenticate result", "cmpp.connect_resp.AuthenticatorISMG",
FT_STRING, BASE_NONE, NULL, 0x00,
"Authenticator result, MD5(Status + AuthenticatorSource + shared secret)",
HFILL }
{ "SIMG Authenticate result", "cmpp.connect_resp.AuthenticatorISMG",
FT_STRING, BASE_NONE, NULL, 0x00,
"Authenticator result, MD5(Status + AuthenticatorSource + shared secret)",
HFILL }
},
{ &hf_cmpp_msg_id,
{ "Msg_Id", "cmpp.Msg_Id",
FT_UINT64, BASE_HEX, NULL, 0x00,
"Message ID",
HFILL }
{ "Msg_Id", "cmpp.Msg_Id",
FT_UINT64, BASE_HEX, NULL, 0x00,
"Message ID",
HFILL }
},
{ &hf_cmpp_submit_pk_total,
{ "Number of Part", "cmpp.submit.Pk_total",
FT_UINT8, BASE_DEC, NULL, 0x00,
"Total number of parts of the message with the same Msg_Id, start from 1",
HFILL }
{ "Number of Part", "cmpp.submit.Pk_total",
FT_UINT8, BASE_DEC, NULL, 0x00,
"Total number of parts of the message with the same Msg_Id, start from 1",
HFILL }
},
{ &hf_cmpp_submit_pk_number,
{ "Part Number", "cmpp.submit.Pk_number",
FT_UINT8, BASE_DEC, NULL, 0x00,
"Part number of the message with the same Msg_Id, start from 1",
HFILL }
{ "Part Number", "cmpp.submit.Pk_number",
FT_UINT8, BASE_DEC, NULL, 0x00,
"Part number of the message with the same Msg_Id, start from 1",
HFILL }
},
{ &hf_msg_id_timestamp,
{ "Timestamp", "cmpp.Msg_Id.timestamp",
FT_STRING, BASE_NONE, NULL, 0x00,
"Timestamp MM/DD HH:MM:SS Bit 64 ~ 39",
HFILL }
{ "Timestamp", "cmpp.Msg_Id.timestamp",
FT_STRING, BASE_NONE, NULL, 0x00,
"Timestamp MM/DD HH:MM:SS Bit 64 ~ 39",
HFILL }
},
{ &hf_msg_id_ismg_code,
{ "ISMG Code", "cmpp.Msg_Id.ismg_code",
FT_UINT32, BASE_DEC, NULL, 0x00,
"ISMG Code, bit 38 ~ 17",
HFILL }
{ "ISMG Code", "cmpp.Msg_Id.ismg_code",
FT_UINT32, BASE_DEC, NULL, 0x00,
"ISMG Code, bit 38 ~ 17",
HFILL }
},
{ &hf_msg_id_sequence_id,
{ "Msg_Id sequence Id", "cmpp.Msg_Id.sequence_id",
FT_UINT16, BASE_DEC, NULL, 0x00,
"Msg_Id sequence Id, bit 16 ~ 1",
HFILL }
{ "Msg_Id sequence Id", "cmpp.Msg_Id.sequence_id",
FT_UINT16, BASE_DEC, NULL, 0x00,
"Msg_Id sequence Id, bit 16 ~ 1",
HFILL }
},
{ &hf_cmpp_submit_Registered_Delivery,
{ "Registered Delivery", "cmpp.submit.Registered_Delivery",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Registered Delivery flag",
HFILL }
{ "Registered Delivery", "cmpp.submit.Registered_Delivery",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Registered Delivery flag",
HFILL }
},
{ &hf_cmpp_submit_Msg_level,
{ "Message Level", "cmpp.submit.Msg_level",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL,
HFILL }
{ "Message Level", "cmpp.submit.Msg_level",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL,
HFILL }
},
{ &hf_cmpp_Service_Id,
{ "Service ID", "cmpp.Servicd_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"Service ID, a mix of characters, numbers and symbol",
HFILL }
{ "Service ID", "cmpp.Servicd_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"Service ID, a mix of characters, numbers and symbol",
HFILL }
},
{ &hf_cmpp_submit_Fee_UserType,
{ "Charging Informations", "cmpp.submit.Fee_UserType",
FT_UINT8, BASE_DEC, VALS(vals_submit_Fee_UserType), 0x00,
"Charging Informations, if value is 3, this field will not be used",
HFILL }
{ "Charging Informations", "cmpp.submit.Fee_UserType",
FT_UINT8, BASE_DEC, VALS(vals_submit_Fee_UserType), 0x00,
"Charging Informations, if value is 3, this field will not be used",
HFILL }
},
{ &hf_cmpp_submit_Fee_terminal_Id,
{ "Fee Terminal ID", "cmpp.submit.Fee_terminal_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"Fee Terminal ID, Valid only when Fee_UserType is 3",
HFILL }
{ "Fee Terminal ID", "cmpp.submit.Fee_terminal_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"Fee Terminal ID, Valid only when Fee_UserType is 3",
HFILL }
},
{ &hf_cmpp_submit_Fee_terminal_type,
{ "Fake Fee Terminal", "cmpp.submit.Fee_terminal_type",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Fee terminal type, 0 is real, 1 is fake",
HFILL }
{ "Fake Fee Terminal", "cmpp.submit.Fee_terminal_type",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Fee terminal type, 0 is real, 1 is fake",
HFILL }
},
{ &hf_cmpp_TP_pId,
{ "TP pId", "cmpp.TP_pId",
FT_UINT8, BASE_DEC, NULL, 0x00,
"GSM TP pId Field",
HFILL }
{ "TP pId", "cmpp.TP_pId",
FT_UINT8, BASE_DEC, NULL, 0x00,
"GSM TP pId Field",
HFILL }
},
{ &hf_cmpp_TP_udhi,
{ "TP udhi", "cmpp.TP_udhi",
FT_UINT8, BASE_DEC, NULL, 0x00,
"GSM TP udhi field",
HFILL }
{ "TP udhi", "cmpp.TP_udhi",
FT_UINT8, BASE_DEC, NULL, 0x00,
"GSM TP udhi field",
HFILL }
},
{ &hf_cmpp_Msg_Fmt,
{ "Message Format", "cmpp.Msg_Fmt",
FT_UINT8, BASE_DEC, VALS(vals_Msg_Fmt), 0x00,
NULL,
HFILL }
{ "Message Format", "cmpp.Msg_Fmt",
FT_UINT8, BASE_DEC, VALS(vals_Msg_Fmt), 0x00,
NULL,
HFILL }
},
{ &hf_cmpp_submit_Msg_src,
{ "Message Source SP_Id", "cmpp.submit.Msg_src",
FT_STRING, BASE_NONE, NULL, 0x00,
"Message source SP ID",
HFILL }
{ "Message Source SP_Id", "cmpp.submit.Msg_src",
FT_STRING, BASE_NONE, NULL, 0x00,
"Message source SP ID",
HFILL }
},
{ &hf_cmpp_submit_FeeType, /* TODO Replace this with a vals_string*/
{ "Fee Type", "cmpp.submit.FeeType",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
{ "Fee Type", "cmpp.submit.FeeType",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
},
{ &hf_cmpp_submit_FeeCode,
{ "Fee Code", "cmpp.submit.FeeCode",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
{ "Fee Code", "cmpp.submit.FeeCode",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
},
{ &hf_cmpp_submit_Valld_Time,
{ "Valid time", "cmpp.submit.Valld_Time",
FT_STRING, BASE_NONE, NULL, 0x00,
"Message Valid Time, format follow SMPP 3.3",
HFILL }
{ "Valid time", "cmpp.submit.Valld_Time",
FT_STRING, BASE_NONE, NULL, 0x00,
"Message Valid Time, format follow SMPP 3.3",
HFILL }
},
{ &hf_cmpp_submit_At_Time,
{ "Send time", "cmpp.submit.At_time",
FT_STRING, BASE_NONE, NULL, 0x00,
"Message send time, format following SMPP 3.3",
HFILL }
{ "Send time", "cmpp.submit.At_time",
FT_STRING, BASE_NONE, NULL, 0x00,
"Message send time, format following SMPP 3.3",
HFILL }
},
{ &hf_cmpp_submit_Src_Id,
{ "Source ID", "cmpp.submit.Src_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"This value matches SMPP submit_sm source_addr field",
HFILL }
{ "Source ID", "cmpp.submit.Src_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"This value matches SMPP submit_sm source_addr field",
HFILL }
},
{ &hf_cmpp_submit_DestUsr_tl,
{ "Destination Address Count", "cmpp.submit.DestUsr_tl",
FT_UINT8, BASE_DEC, NULL, 0x00,
"Number of destination address, must smaller then 100",
HFILL }
{ "Destination Address Count", "cmpp.submit.DestUsr_tl",
FT_UINT8, BASE_DEC, NULL, 0x00,
"Number of destination address, must smaller then 100",
HFILL }
},
{ &hf_cmpp_Dest_terminal_Id,
{ "Destination Address", "cmpp.Dest_terminal_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"MSISDN number which receive the SMS",
HFILL }
{ "Destination Address", "cmpp.Dest_terminal_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"MSISDN number which receive the SMS",
HFILL }
},
{ &hf_cmpp_submit_Dest_terminal_type,
{ "Fake Destination Terminal", "cmpp.submit.Dest_terminal_type",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"destination terminal type, 0 is real, 1 is fake",
HFILL }
{ "Fake Destination Terminal", "cmpp.submit.Dest_terminal_type",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"destination terminal type, 0 is real, 1 is fake",
HFILL }
},
{ &hf_cmpp_Msg_Length,
{ "Message length", "cmpp.Msg_Length",
FT_UINT8, BASE_DEC, NULL, 0x00,
"SMS Message length, ASCII must be <= 160 bytes, other must be <= 140 bytes",
HFILL }
{ "Message length", "cmpp.Msg_Length",
FT_UINT8, BASE_DEC, NULL, 0x00,
"SMS Message length, ASCII must be <= 160 bytes, other must be <= 140 bytes",
HFILL }
},
{ &hf_cmpp_Msg_Content,
{ "Message Content", "cmpp.Msg_Content",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
{ "Message Content", "cmpp.Msg_Content",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
},
{ &hf_cmpp_LinkID,
{ "Link ID", "cmpp.LinkID",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
{ "Link ID", "cmpp.LinkID",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
},
{ &hf_cmpp_submit_resp_Result,
{ "Result", "cmpp.submit_resp.Result",
FT_UINT32, BASE_DEC, VALS(vals_Submit_Resp_Result), 0x00,
"Submit Result",
HFILL }
{ "Result", "cmpp.submit_resp.Result",
FT_UINT32, BASE_DEC, VALS(vals_Submit_Resp_Result), 0x00,
"Submit Result",
HFILL }
},
{ &hf_cmpp_deliver_Dest_Id,
{ "Destination ID", "cmpp.deliver.Dest_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"SP Service ID or server number",
HFILL }
{ "Destination ID", "cmpp.deliver.Dest_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"SP Service ID or server number",
HFILL }
},
{ &hf_cmpp_deliver_Src_terminal_Id,
{ "Src_terminal_Id", "cmpp.deliver.Src_terminal_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"Source MSISDN number, if it is deliver report, this will be the CMPP_SUBMIT destination number",
HFILL }
{ "Src_terminal_Id", "cmpp.deliver.Src_terminal_Id",
FT_STRING, BASE_NONE, NULL, 0x00,
"Source MSISDN number, if it is deliver report, this will be the CMPP_SUBMIT destination number",
HFILL }
},
{ &hf_cmpp_deliver_Src_terminal_type,
{ "Fake source terminal type", "cmpp.deliver.Src_terminal_type",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Type of the source terminal, can be 0 (real) or 1 (fake)",
HFILL }
{ "Fake source terminal type", "cmpp.deliver.Src_terminal_type",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Type of the source terminal, can be 0 (real) or 1 (fake)",
HFILL }
},
{ &hf_cmpp_deliver_Registered_Delivery,
{ "Deliver Report", "cmpp.deliver.Registered_Delivery",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"The message is a deliver report if this value = 1",
HFILL }
{ "Deliver Report", "cmpp.deliver.Registered_Delivery",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"The message is a deliver report if this value = 1",
HFILL }
},
{ &hf_cmpp_deliver_Report,
{ "Detail Deliver Report", "cmpp.deliver.Report",
FT_NONE, BASE_NONE, NULL, 0x00,
"The detail report",
HFILL }
{ "Detail Deliver Report", "cmpp.deliver.Report",
FT_NONE, BASE_NONE, NULL, 0x00,
"The detail report",
HFILL }
},
{ &hf_cmpp_deliver_Report_Stat,
{ "Deliver Status", "cmpp.deliver.Report.Status",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
{ "Deliver Status", "cmpp.deliver.Report.Status",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL,
HFILL }
},
{ &hf_cmpp_deliver_Report_Submit_time,
{ "Submit_time", "cmpp.deliver.Report.Submit_time",
FT_STRING, BASE_NONE, NULL, 0x00,
"Format YYMMDDHHMM",
HFILL }
{ "Submit_time", "cmpp.deliver.Report.Submit_time",
FT_STRING, BASE_NONE, NULL, 0x00,
"Format YYMMDDHHMM",
HFILL }
},
{ &hf_cmpp_deliver_Report_Done_time,
{ "Done_time", "cmpp.deliver.Report.Done_time",
FT_STRING, BASE_NONE, NULL, 0x00,
"Format YYMMDDHHMM",
HFILL }
{ "Done_time", "cmpp.deliver.Report.Done_time",
FT_STRING, BASE_NONE, NULL, 0x00,
"Format YYMMDDHHMM",
HFILL }
},
{ &hf_cmpp_deliver_Report_SMSC_sequence,
{ "SMSC_sequence", "cmpp.Report.SMSC_sequence",
FT_UINT32, BASE_DEC, NULL, 0x00,
"Sequence number",
HFILL }
{ "SMSC_sequence", "cmpp.Report.SMSC_sequence",
FT_UINT32, BASE_DEC, NULL, 0x00,
"Sequence number",
HFILL }
},
{ &hf_cmpp_deliver_resp_Result,
{ "Result", "cmpp.deliver_resp.Result",
FT_UINT32, BASE_DEC, VALS(vals_Deliver_Resp_Result), 0x00,
"Deliver Result",
HFILL }
{ "Result", "cmpp.deliver_resp.Result",
FT_UINT32, BASE_DEC, VALS(vals_Deliver_Resp_Result), 0x00,
"Deliver Result",
HFILL }
}
};

View File

@ -55,9 +55,9 @@ static dissector_handle_t data_handle;
static void
dissect_cosine(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *fh_tree;
proto_item *ti;
union wtap_pseudo_header *pseudo_header = pinfo->pseudo_header;
proto_tree *fh_tree;
proto_item *ti;
union wtap_pseudo_header *pseudo_header = pinfo->pseudo_header;
/* load the top pane info. This should be overwritten by
the next protocol in the stack */
@ -70,8 +70,8 @@ dissect_cosine(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
layer (ie none) */
if(tree) {
ti = proto_tree_add_protocol_format(tree, proto_cosine, tvb, 0, 0,
"CoSine IPNOS L2 debug output (%s)",
pseudo_header->cosine.if_name);
"CoSine IPNOS L2 debug output (%s)",
pseudo_header->cosine.if_name);
fh_tree = proto_item_add_subtree(ti, ett_raw);
proto_tree_add_uint(fh_tree, hf_pro, tvb, 0, 0, pseudo_header->cosine.pro);
proto_tree_add_uint(fh_tree, hf_off, tvb, 0, 0, pseudo_header->cosine.off);
@ -80,65 +80,65 @@ dissect_cosine(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint(fh_tree, hf_err, tvb, 0, 0, pseudo_header->cosine.err);
switch (pseudo_header->cosine.encap) {
case COSINE_ENCAP_ETH:
break;
case COSINE_ENCAP_ATM:
case COSINE_ENCAP_PPoATM:
proto_tree_add_text(fh_tree, tvb, 0, 16, "SAR header");
break;
case COSINE_ENCAP_PPP:
case COSINE_ENCAP_FR:
case COSINE_ENCAP_PPoFR:
proto_tree_add_text(fh_tree, tvb, 0, 4, "Channel handle ID");
break;
case COSINE_ENCAP_HDLC:
if (pseudo_header->cosine.direction == COSINE_DIR_TX) {
proto_tree_add_text(fh_tree, tvb, 0, 2,
"Channel handle ID");
} else if (pseudo_header->cosine.direction == COSINE_DIR_RX) {
proto_tree_add_text(fh_tree, tvb, 0, 4,
"Channel handle ID");
}
break;
default:
break;
case COSINE_ENCAP_ETH:
break;
case COSINE_ENCAP_ATM:
case COSINE_ENCAP_PPoATM:
proto_tree_add_text(fh_tree, tvb, 0, 16, "SAR header");
break;
case COSINE_ENCAP_PPP:
case COSINE_ENCAP_FR:
case COSINE_ENCAP_PPoFR:
proto_tree_add_text(fh_tree, tvb, 0, 4, "Channel handle ID");
break;
case COSINE_ENCAP_HDLC:
if (pseudo_header->cosine.direction == COSINE_DIR_TX) {
proto_tree_add_text(fh_tree, tvb, 0, 2,
"Channel handle ID");
} else if (pseudo_header->cosine.direction == COSINE_DIR_RX) {
proto_tree_add_text(fh_tree, tvb, 0, 4,
"Channel handle ID");
}
break;
default:
break;
}
}
switch (pseudo_header->cosine.encap) {
case COSINE_ENCAP_ETH:
call_dissector(eth_withoutfcs_handle, tvb_new_subset_remaining(tvb, 0),
pinfo, tree);
break;
case COSINE_ENCAP_ATM:
case COSINE_ENCAP_PPoATM:
call_dissector(llc_handle, tvb_new_subset_remaining(tvb, 16),
pinfo, tree);
break;
case COSINE_ENCAP_PPP:
call_dissector(ppp_hdlc_handle, tvb_new_subset_remaining(tvb, 4),
pinfo, tree);
break;
case COSINE_ENCAP_HDLC:
if (pseudo_header->cosine.direction == COSINE_DIR_TX) {
call_dissector(chdlc_handle, tvb_new_subset_remaining(tvb, 2),
pinfo, tree);
} else if (pseudo_header->cosine.direction == COSINE_DIR_RX) {
call_dissector(chdlc_handle, tvb_new_subset_remaining(tvb, 4),
pinfo, tree);
}
break;
case COSINE_ENCAP_FR:
case COSINE_ENCAP_PPoFR:
call_dissector(fr_handle, tvb_new_subset_remaining(tvb, 4),
pinfo, tree);
break;
case COSINE_ENCAP_TEST:
case COSINE_ENCAP_UNKNOWN:
call_dissector(data_handle, tvb, pinfo, tree);
break;
default:
break;
case COSINE_ENCAP_ETH:
call_dissector(eth_withoutfcs_handle, tvb_new_subset_remaining(tvb, 0),
pinfo, tree);
break;
case COSINE_ENCAP_ATM:
case COSINE_ENCAP_PPoATM:
call_dissector(llc_handle, tvb_new_subset_remaining(tvb, 16),
pinfo, tree);
break;
case COSINE_ENCAP_PPP:
call_dissector(ppp_hdlc_handle, tvb_new_subset_remaining(tvb, 4),
pinfo, tree);
break;
case COSINE_ENCAP_HDLC:
if (pseudo_header->cosine.direction == COSINE_DIR_TX) {
call_dissector(chdlc_handle, tvb_new_subset_remaining(tvb, 2),
pinfo, tree);
} else if (pseudo_header->cosine.direction == COSINE_DIR_RX) {
call_dissector(chdlc_handle, tvb_new_subset_remaining(tvb, 4),
pinfo, tree);
}
break;
case COSINE_ENCAP_FR:
case COSINE_ENCAP_PPoFR:
call_dissector(fr_handle, tvb_new_subset_remaining(tvb, 4),
pinfo, tree);
break;
case COSINE_ENCAP_TEST:
case COSINE_ENCAP_UNKNOWN:
call_dissector(data_handle, tvb, pinfo, tree);
break;
default:
break;
}
}
@ -153,7 +153,7 @@ proto_register_cosine(void)
{ &hf_pri,
{ "Priority", "cosine.pri", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
{ &hf_rm,
{ "Rate Marking", "cosine.rm", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
{ "Rate Marking", "cosine.rm", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
{ &hf_err,
{ "Error Code", "cosine.err", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
};
@ -163,7 +163,7 @@ proto_register_cosine(void)
};
proto_cosine = proto_register_protocol("CoSine IPNOS L2 debug output",
"CoSine", "cosine");
"CoSine", "cosine");
proto_register_field_array(proto_cosine, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
@ -177,11 +177,11 @@ proto_reg_handoff_cosine(void)
* Get handles for dissectors.
*/
eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
ppp_hdlc_handle = find_dissector("ppp_hdlc");
llc_handle = find_dissector("llc");
chdlc_handle = find_dissector("chdlc");
fr_handle = find_dissector("fr");
data_handle = find_dissector("data");
ppp_hdlc_handle = find_dissector("ppp_hdlc");
llc_handle = find_dissector("llc");
chdlc_handle = find_dissector("chdlc");
fr_handle = find_dissector("fr");
data_handle = find_dissector("data");
cosine_handle = create_dissector_handle(dissect_cosine, proto_cosine);
dissector_add_uint("wtap_encap", WTAP_ENCAP_COSINE, cosine_handle);

File diff suppressed because it is too large Load Diff

View File

@ -405,7 +405,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{
if (remaining_bits_len >= pDescr->descr.crumb_spec[pDescr->i].crumb_bit_length)
{
proto_tree_add_split_bits_crumb(tree, *pDescr->serialize.hf_ptr, tvb, bit_offset,
proto_tree_add_split_bits_crumb(tree, *pDescr->serialize.hf_ptr, tvb, bit_offset,
pDescr->descr.crumb_spec, pDescr->i);
remaining_bits_len -= pDescr->descr.crumb_spec[pDescr->i].crumb_bit_length;
@ -624,7 +624,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s", pDescr->sz);
test_tree = proto_item_add_subtree(ti, ett_csn1);
} else {
test_tree = tree;
test_tree = tree;
}
csnStreamInit(&arT, bit_offset, remaining_bits_len);
@ -1594,7 +1594,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
no_of_bits = callback(tree, tvb, pvDATA(data, pDescr->i), pvDATA(data, pDescr->offset), bit_offset, ett_csn1);
bit_offset += no_of_bits;
pDescr++;
break;
}

View File

@ -254,13 +254,13 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Similar to the M_BIT except that not only bit 0 or 1 but also the
* end of the message may be encountered when looking for the next element in
* the message.
* Covers the case {null | 0 | 1}
* Covers the case {null | 0 | 1}
*****************************************************************************/
#define M_BIT_OR_NULL(_STRUCT, _MEMBER, _HF_PTR)\
{CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {(StreamSerializeFcn_t) _HF_PTR}}
/******************************************************************************
* M_NEXT_EXIST(Par1, Par2, Par3)
* Indicates whether the next element or a group of elements defined in the
* Indicates whether the next element or a group of elements defined in the
* structure is present or not.
* Par1: C structure name
* Par2: C structure element name
@ -274,7 +274,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* M_NEXT_EXIST_LH(Par1, Par2, Par3)
* similar to the M_NEXT_EXIST except that instead of bit 0/1 which is fetched
* from the message in order to find out whether the next element/elements are
* present in the message, the logical operation XOR with the background
* present in the message, the logical operation XOR with the background
* pattern 0x2B is performed on the read bit before the decision is made.
*****************************************************************************/
#define M_NEXT_EXIST_LH(_STRUCT, _MEMBER, _NoOfExisting)\
@ -283,9 +283,9 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
/******************************************************************************
* M_NEXT_EXIST_OR_NULL(Par1, Par2, Par3)
* Similar to the M_NEXT_EXIST except that not only bit 0 or 1 but also the end
* of the message may be encountered when looking for the next element in the
* of the message may be encountered when looking for the next element in the
* message.
* Covers the case {null | 0 | 1 < IE >}
* Covers the case {null | 0 | 1 < IE >}
*****************************************************************************/
#define M_NEXT_EXIST_OR_NULL(_STRUCT, _MEMBER, _NoOfExisting)\
{CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {(StreamSerializeFcn_t)0}}
@ -295,7 +295,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Similar to the M_NEXT_EXIST_LH except that not only bit 0 or 1 but also the
* end of the message may be encountered when looking for the next element in
* the message.
* Covers the case {null | L | H < IE >}
* Covers the case {null | L | H < IE >}
*****************************************************************************/
#define M_NEXT_EXIST_OR_NULL_LH(_STRUCT, _MEMBER, _NoOfExisting)\
{CSN_NEXT_EXIST_LH, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {(StreamSerializeFcn_t)0}}
@ -339,7 +339,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Similar to the M_UINT except that not only the request set of bits but also the
* end of the message may be encountered when looking for the next element in
* the message.
* Covers the case {null | 0 | 1 < IE >}
* Covers the case {null | 0 | 1 < IE >}
*****************************************************************************/
#define M_UINT_OR_NULL(_STRUCT, _MEMBER, _BITS, _HF_PTR)\
{CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {(StreamSerializeFcn_t) _HF_PTR}}
@ -347,8 +347,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
/******************************************************************************
* M_UINT_LH(Par1, Par2, Par3, Par4)
* This macro has the same functionality as M_UINT except that in addition the
* logical "exclusive or" operation with the background value "0x2B" is
* performed before the final value of the integer number is delivered from the
* logical "exclusive or" operation with the background value "0x2B" is
* performed before the final value of the integer number is delivered from the
* received CSN.1 message
*****************************************************************************/
#define M_UINT_LH(_STRUCT, _MEMBER, _BITS, _HF_PTR)\
@ -419,16 +419,16 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
/******************************************************************************
* M_REC_ARRAY(Par1, Par2, Par3, Par4)
* similar to the M_VAR_ARRAY. The difference is that the size of the array is
* similar to the M_VAR_ARRAY. The difference is that the size of the array is
* not known in advance and it has to be calculated during unpacking. Its value
* is stored in a variable which belongs to the same structure as the array.
* A zero element terminates the array. The CSN.1 syntax describes it
* is stored in a variable which belongs to the same structure as the array.
* A zero element terminates the array. The CSN.1 syntax describes it
* recursively as:
* <array> ::={1 <element> <array>| 0}
* <array> ::={1 <element> <array>| 0}
*
* Par1: C structure name
* Par2: C structure element name
* Par3: name of the structure member where the calculated the size of the
* Par3: name of the structure member where the calculated the size of the
* array will be stored
* Par4: length of each element in bits
*****************************************************************************/
@ -501,8 +501,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* M_UNION(Par1, Par2)
* Informs the CSN.1 library that a union follows and how many possible choices
* there are in the union. The actual value of the choice, which points out the
* chosen element of the union is stored in the uint8 variable and is usually
* called UnionType. The elements of the union have to be listed directly after
* chosen element of the union is stored in the uint8 variable and is usually
* called UnionType. The elements of the union have to be listed directly after
* the M_UNION statement.
* Par1: C structure name
* Par2: number of possible choice in the union
@ -519,12 +519,12 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
/******************************************************************************
* M_CHOICE(Par1, Par2, Par3, Par4)
* Similar to the M_UNION. In the M_UNION the selected element of all possible
* choices in the union is referred as a sequential numbers, i.e., the first
* choice is addressed as choice 0 the second as choice 1, the third as choice
* Similar to the M_UNION. In the M_UNION the selected element of all possible
* choices in the union is referred as a sequential numbers, i.e., the first
* choice is addressed as choice 0 the second as choice 1, the third as choice
* 2 and so on, both in the encoded message and in the variable UnionType which
* is the part of the message. In the CSN_CHOICE case, this rule does not
* apply. There is free but predefined mapping of the element of the union and
* is the part of the message. In the CSN_CHOICE case, this rule does not
* apply. There is free but predefined mapping of the element of the union and
* the value which addresses this element.
* The value of the address is called a selector.
* After unpacking, this value is then converted to the sequential number of the
@ -532,14 +532,14 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par1: C structure name
* Par2: C structure element name
* Par3: address of an array of type CSN_ChoiceElement_t where all possible
* values of the selector are provided, together with the selector
* length expressed in bits and the address of the CSN_DESCR type
* where the element is defined. For every element in the union
* there is one line in the Choice variable. These lines have to
* appear in the _CHOICE in the same order as the elements in the
* union. The element of the union selected in the message through
* the _CHOICE parameter is after unpacking translated to the
* corresponding sequential number of this element and stored in
* values of the selector are provided, together with the selector
* length expressed in bits and the address of the CSN_DESCR type
* where the element is defined. For every element in the union
* there is one line in the Choice variable. These lines have to
* appear in the _CHOICE in the same order as the elements in the
* union. The element of the union selected in the message through
* the _CHOICE parameter is after unpacking translated to the
* corresponding sequential number of this element and stored in
* the variable pointed out by the _MEMBER
* Par4: number of possible choices in the union
*****************************************************************************/
@ -552,15 +552,15 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* displayed to show there was a choice
*****************************************************************************/
#define M_CHOICE_IL(_STRUCT, _MEMBER, _CHOICE, _ElementCount)\
{CSN_CHOICE, _ElementCount, {(void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, NULL, {(StreamSerializeFcn_t)0}}
{CSN_CHOICE, _ElementCount, {(void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, NULL, {(StreamSerializeFcn_t)0}}
/******************************************************************************
* M_FIXED(Par1, Par2, Par3)
* Defines a fixed value of type integer which should be fetched from or stored
* Defines a fixed value of type integer which should be fetched from or stored
* in the message
* Par1: C structure name
* Par2: gives the length of the fixed number in bits.
* Par3: the value of the number. If the expected value is not present in
* Par3: the value of the number. If the expected value is not present in
* the message the unpacking procedure is aborted
*****************************************************************************/
#define M_FIXED(_STRUCT, _BITS, _BITVALUE)\
@ -571,21 +571,21 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Same as M_FIXED but allows to define a custom string for the subtree
* Par1: C structure name
* Par2: gives the length of the fixed number in bits.
* Par3: the value of the number. If the expected value is not present in
* Par3: the value of the number. If the expected value is not present in
* the message the unpacking procedure is aborted
* Par4: C string for the text
*****************************************************************************/
#define M_FIXED_LABEL(_STRUCT, _BITS, _BITVALUE, _LABEL)\
{CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, _LABEL, {(StreamSerializeFcn_t)0}}
{CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, _LABEL, {(StreamSerializeFcn_t)0}}
/******************************************************************************
* M_SERIALIZE(Par1, Par2, Par3)
* Allows using a complete free format of data being encoded or decoded.
* When the M_SERIALIZE is encounted during encoding or decoding of a message
* the CSNstream program passes the control over to the specified function
* together with all necessary parameters about the current position within
* the message being unpacked or packed. When transferring of "serialized"
* data to or from the message is finished by the function the CSNstream gets
* Allows using a complete free format of data being encoded or decoded.
* When the M_SERIALIZE is encounted during encoding or decoding of a message
* the CSNstream program passes the control over to the specified function
* together with all necessary parameters about the current position within
* the message being unpacked or packed. When transferring of "serialized"
* data to or from the message is finished by the function the CSNstream gets
* back control over the data stream and continues to work with the message.
*****************************************************************************/
#define M_SERIALIZE(_STRUCT, _MEMBER, _LENGTH_LEN, _SERIALIZEFCN)\
@ -596,7 +596,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
/******************************************************************************
* M_BITMAP(Par1, Par2, Par3)
* Defines a type which consists of a bitmap. The size of the bitmap in bits
* Defines a type which consists of a bitmap. The size of the bitmap in bits
* is fixed and provided by the parameter Par3
* Par1: C structure name
* Par2: C structure element name