/* packet-ncp.c
* Routines for NetWare Core Protocol
- * Gilbert Ramirez <gram@xiexie.org>
+ * Gilbert Ramirez <gram@alumni.rice.edu>
* Modified to allow NCP over TCP/IP decodes by James Coe <jammer@cin.net>
*
- * $Id: packet-ncp.c,v 1.46 2001/01/09 06:31:39 guy Exp $
+ * $Id: packet-ncp.c,v 1.52 2001/12/10 00:25:31 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 2000 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
guint16 nw_connection;
int hdr_offset = 0;
int commhdr;
+ tvbuff_t *next_tvb;
- CHECK_DISPLAY_AS_DATA(proto_ncp, tvb, pinfo, tree);
-
- pinfo->current_proto = "NCP";
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "NCP");
- if (check_col(pinfo->fd, COL_INFO))
- col_clear(pinfo->fd, COL_INFO);
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NCP");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_clear(pinfo->cinfo, COL_INFO);
- if ( pi.ptype == PT_TCP || pi.ptype == PT_UDP ) {
+ if ( pinfo->ptype == PT_TCP || pinfo->ptype == PT_UDP ) {
ncpiph.signature = tvb_get_ntohl(tvb, 0);
ncpiph.length = tvb_get_ntohl(tvb, 4);
hdr_offset += 8;
ti = proto_tree_add_item(tree, proto_ncp, tvb, 0, tvb_length(tvb), FALSE);
ncp_tree = proto_item_add_subtree(ti, ett_ncp);
- if ( pi.ptype == PT_TCP || pi.ptype == PT_UDP ) {
+ if ( pinfo->ptype == PT_TCP || pinfo->ptype == PT_UDP ) {
proto_tree_add_uint(ncp_tree, hf_ncp_ip_sig, tvb, 0, 4, ncpiph.signature);
proto_tree_add_uint(ncp_tree, hf_ncp_ip_length, tvb, 4, 4, ncpiph.length);
if ( ncpiph.signature == NCPIP_RQST ) {
if (header.type == 0x1111 || header.type == 0x2222) {
- dissect_ncp_request(tvb, pinfo, nw_connection,
+ next_tvb = tvb_new_subset( tvb, hdr_offset, -1, -1 );
+ dissect_ncp_request(next_tvb, pinfo, nw_connection,
header.sequence, header.type, ncp_tree, tree);
}
else if (header.type == 0x3333) {
- dissect_ncp_reply(tvb, pinfo, nw_connection,
+ next_tvb = tvb_new_subset( tvb, hdr_offset, -1, -1 );
+ dissect_ncp_reply(next_tvb, pinfo, nw_connection,
header.sequence, ncp_tree, tree);
}
else if ( header.type == 0x5555 ||
header.type == 0x7777 ||
header.type == 0x9999 ) {
- if (check_col(pinfo->fd, COL_INFO)) {
- col_add_fstr(pinfo->fd, COL_INFO, "Type 0x%04x", header.type);
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Type 0x%04x", header.type);
}
if (tree) {
{ &hf_ncp_ip_sig,
{ "NCP over IP signature", "ncp.ip.signature",
FT_UINT32, BASE_HEX, VALS(ncp_ip_signature), 0x0,
- "" }},
+ "", HFILL }},
{ &hf_ncp_ip_length,
{ "NCP over IP length", "ncp.ip.length",
FT_UINT32, BASE_HEX, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_ncp_ip_ver,
{ "NCP over IP Version", "ncp.ip.version",
FT_UINT32, BASE_DEC, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_ncp_ip_rplybufsize,
{ "NCP over IP Reply Buffer Size", "ncp.ip.replybufsize",
FT_UINT32, BASE_DEC, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_ncp_type,
{ "Type", "ncp.type",
FT_UINT16, BASE_HEX, VALS(ncp_type_vals), 0x0,
- "NCP message type" }},
+ "NCP message type", HFILL }},
{ &hf_ncp_seq,
{ "Sequence Number", "ncp.seq",
FT_UINT8, BASE_DEC, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_ncp_connection,
{ "Connection Number", "ncp.connection",
FT_UINT16, BASE_DEC, NULL, 0x0,
- "" }},
+ "", HFILL }},
{ &hf_ncp_task,
{ "Task Number", "ncp.task",
FT_UINT8, BASE_DEC, NULL, 0x0,
- "" }}
+ "", HFILL }}
};
static gint *ett[] = {
&ett_ncp,
void
proto_reg_handoff_ncp(void)
{
- dissector_add("tcp.port", TCP_PORT_NCP, dissect_ncp, proto_ncp);
- dissector_add("udp.port", UDP_PORT_NCP, dissect_ncp, proto_ncp);
- dissector_add("ipx.packet_type", IPX_PACKET_TYPE_NCP, dissect_ncp,
- proto_ncp);
- dissector_add("ipx.socket", IPX_SOCKET_NCP, dissect_ncp, proto_ncp);
+ dissector_handle_t ncp_handle;
+
+ ncp_handle = create_dissector_handle(dissect_ncp, proto_ncp);
+ dissector_add("tcp.port", TCP_PORT_NCP, ncp_handle);
+ dissector_add("udp.port", UDP_PORT_NCP, ncp_handle);
+ dissector_add("ipx.packet_type", IPX_PACKET_TYPE_NCP, ncp_handle);
+ dissector_add("ipx.socket", IPX_SOCKET_NCP, ncp_handle);
}