From Mark C. Brown:

Add support for the new NS_LS_SCTP tracing subsystem.

svn path=/trunk/; revision=23290
This commit is contained in:
Anders Broman 2007-10-27 15:44:12 +00:00
parent a07530ab2b
commit e6fc9efb62
3 changed files with 68 additions and 9 deletions

View File

@ -52,6 +52,7 @@ static dissector_handle_t eth_withoutfcs_handle;
static dissector_handle_t tr_handle;
static dissector_handle_t lapb_handle;
static dissector_handle_t x25_handle;
static dissector_handle_t sctp_handle;
static dissector_handle_t data_handle;
static dissector_table_t wtap_dissector_table;
static dissector_table_t ip_proto_dissector_table;
@ -72,9 +73,9 @@ static const value_string trace_kind[] = {
{ 0x20000000, "PDUIN" },
{ 0x10000000, "Outgoing PDU - PDUOUT" },
{ 0x10000000, "PDUOUT" },
{ 0x08000000, "Procedure" },
{ 0x04000000, "State" },
{ 0x02000000, "Error" },
{ 0x08000000, "Procedure Trace" },
{ 0x04000000, "State Trace" },
{ 0x02000000, "Error Trace" },
{ 0x01000000, "Logging" },
{ 0x00800000, "Loopback" },
{ 0, NULL }
@ -113,12 +114,21 @@ static const value_string subsystem[] = {
{ 29, "NS_LS_IGMP" },
{ 31, "TOKEN" },
{ 32, "HIPPI" },
{ 33, "FC" },
{ 33, "EISA_FC" },
{ 34, "SX25L2" },
{ 35, "SX25L3" },
{ 36, "NS_LS_SX25" },
{ 37, "100VG" },
{ 38, "ATM" },
{ 38, "EISA_ATM" },
{ 39, "SEAH_FDDI" },
{ 40, "TELECOM_HLR" },
{ 41, "TELECOM_SCE" },
{ 42, "TELECOM_SMS" },
{ 43, "TELECOM_NEM" },
{ 50, "FORE_ATM" },
{ 60, "TMOS_TOB" },
{ 62, "TELECOM_SCP" },
{ 63, "TELECOM_SS7" },
{ 64, "FTAM_INIT" },
{ 65, "FTAM_RESP" },
{ 70, "FTAM_VFS" },
@ -147,13 +157,14 @@ static const value_string subsystem[] = {
{ 178, "GSC100BT" },
{ 179, "PCI100BT" },
{ 180, "SPP100BT" },
{ 181, "GLE" },
{ 182, "FQE" },
{ 185, "GELAN" },
{ 187, "PCITR" },
{ 188, "HP_APA" },
{ 189, "HP_APAPORT" },
{ 190, "HP_APALACP" },
{ 210, "BTLAN" },
{ 227, "NS_LS_SCTP" },
{ 233, "INTL100" },
{ 244, "NS_LS_IPV6" },
{ 245, "NS_LS_ICMPV6" },
@ -165,6 +176,7 @@ static const value_string subsystem[] = {
{ 253, "IETHER" },
{ 265, "IXGBE" },
{ 267, "NS_LS_TELNET" },
{ 268, "NS_LS_SCTP" },
{ 513, "KL_VM" },
{ 514, "KL_PKM" },
{ 515, "KL_DLKM" },
@ -215,7 +227,7 @@ dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint_format(nettl_tree, hf_nettl_kind, tvb,
0, 0, pinfo->pseudo_header->nettl.kind,
"Trace Kind: 0x%08x (%s)", pinfo->pseudo_header->nettl.kind,
val_to_str(pinfo->pseudo_header->nettl.kind, trace_kind, "Unknown"));
val_to_str(pinfo->pseudo_header->nettl.kind & ~NETTL_HDR_SUBSYSTEM_BITS_MASK, trace_kind, "Unknown"));
proto_tree_add_int(nettl_tree, hf_nettl_pid, tvb,
0, 0, pinfo->pseudo_header->nettl.pid);
proto_tree_add_uint(nettl_tree, hf_nettl_uid, tvb,
@ -236,7 +248,16 @@ dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(data_handle, tvb, pinfo, tree);
break;
case WTAP_ENCAP_NETTL_RAW_IP:
if (!dissector_try_port(wtap_dissector_table,
if ( ( (pinfo->pseudo_header->nettl.kind
& ~NETTL_HDR_SUBSYSTEM_BITS_MASK)
& (NETTL_HDR_PROCEDURE_TRACE |
NETTL_HDR_STATE_TRACE |
NETTL_HDR_ERROR_TRACE) ) != 0)
/* not really a data packet */
call_dissector(data_handle, tvb, pinfo, tree);
else if (pinfo->pseudo_header->nettl.subsys == NETTL_SUBSYS_NS_LS_SCTP )
call_dissector(sctp_handle, tvb, pinfo, tree);
else if (!dissector_try_port(wtap_dissector_table,
WTAP_ENCAP_RAW_IP, tvb, pinfo, tree))
call_dissector(data_handle, tvb, pinfo, tree);
break;
@ -339,6 +360,7 @@ proto_reg_handoff_nettl(void)
tr_handle = find_dissector("tr");
lapb_handle = find_dissector("lapb");
x25_handle = find_dissector("x.25");
sctp_handle = find_dissector("sctp");
data_handle = find_dissector("data");
wtap_dissector_table = find_dissector_table("wtap_encap");
ip_proto_dissector_table = find_dissector_table("ip.proto");
@ -354,4 +376,5 @@ proto_reg_handoff_nettl(void)
dissector_add("wtap_encap", WTAP_ENCAP_NETTL_RAW_TELNET, nettl_handle);
dissector_add("wtap_encap", WTAP_ENCAP_NETTL_X25, nettl_handle);
dissector_add("wtap_encap", WTAP_ENCAP_NETTL_UNKNOWN, nettl_handle);
}

View File

@ -410,7 +410,16 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
return -1;
offset += hdr_len;
switch (subsys) {
if ( ( (pntohl(&rec_hdr.kind) & ~NETTL_HDR_SUBSYSTEM_BITS_MASK)
& (NETTL_HDR_PROCEDURE_TRACE |
NETTL_HDR_STATE_TRACE |
NETTL_HDR_ERROR_TRACE) ) != 0) {
/* not actually a packet trace record */
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_IP;
length = pntohl(&rec_hdr.length);
caplen = pntohl(&rec_hdr.caplen);
padlen = 0;
} else switch (subsys) {
case NETTL_SUBSYS_LAN100 :
case NETTL_SUBSYS_EISA100BT :
case NETTL_SUBSYS_BASE100 :
@ -440,10 +449,12 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
case NETTL_SUBSYS_NS_LS_ICMPV6 :
case NETTL_SUBSYS_NS_LS_ICMP :
case NETTL_SUBSYS_NS_LS_TELNET :
case NETTL_SUBSYS_NS_LS_SCTP :
if( (subsys == NETTL_SUBSYS_NS_LS_IP)
|| (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK)
|| (subsys == NETTL_SUBSYS_NS_LS_UDP)
|| (subsys == NETTL_SUBSYS_NS_LS_TCP)
|| (subsys == NETTL_SUBSYS_NS_LS_SCTP)
|| (subsys == NETTL_SUBSYS_NS_LS_IPV6)) {
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_IP;
} else if (subsys == NETTL_SUBSYS_NS_LS_ICMP) {
@ -506,6 +517,21 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
return -1;
padlen = 26;
offset += padlen;
} else if (subsys == NETTL_SUBSYS_NS_LS_SCTP) {
/*
* SCTP 8 byte header that we will ignore...
* 32 bit integer defines format
* 1 = Log
* 2 = ASCII
* 3 = Binary (PDUs should be Binary format)
* 32 bit integer defines type
* 1 = Inbound
* 2 = Outbound
*/
if (file_seek(fh, 8, SEEK_CUR, err) == -1)
return -1;
padlen = 8;
offset += padlen;
} else {
padlen = 0;
}

View File

@ -76,6 +76,7 @@
#define NETTL_SUBSYS_NS_LS_IPV6 244
#define NETTL_SUBSYS_NS_LS_ICMPV6 245
#define NETTL_SUBSYS_NS_LS_TELNET 267
#define NETTL_SUBSYS_NS_LS_SCTP 268
/* Ethernet cards */
#define NETTL_SUBSYS_100VG 37
@ -104,8 +105,17 @@
/* from /usr/include/sys/subsys_id.h */
#define NETTL_HDR_HDRIN 0x80000000
#define NETTL_HDR_HDROUT 0x40000000
#define NETTL_HDR_PDUIN 0x20000000
#define NETTL_HDR_PDUOUT 0x10000000
#define NETTL_HDR_PROCEDURE_TRACE 0x08000000
#define NETTL_HDR_STATE_TRACE 0x04000000
#define NETTL_HDR_ERROR_TRACE 0x02000000
#define NETTL_HDR_LOG_TRACE 0x01000000
#define NETTL_HDR_LOOPBACK 0x00800000
#define NETTL_HDR_PTOP 0x00400000
#define NETTL_HDR_SUBSYSTEM_BITS_MASK 0x000fffff
int nettl_open(wtap *wth, int *err, gchar **err_info);
gboolean nettl_dump_open(wtap_dumper *wdh, gboolean cant_seek _U_, int *err);