Move the #defines for NCP packet types to "packet-ncp-int.h", and use

them in "packet-ncp2222.inc".

The page at

	http://www.odyssea.com/whats_new/tcpipnet/tcpipnet.html

indicates that a positive ACK (0x9999) NCP packet has the same
completion code and connection status fields as a reply (0x3333) packet
(but nothing after them); hand "dissect_ncp_reply()" the packet type as
one of its arguments, and have it handle positive ACK packets as well as
reply packets.

It also indicates that bit 4 of the connection status indicates that the
server is unavailable, and the page at

	http://www.unm.edu/~network/presentations/course/appendix/appendix_f/tsld088.htm

speaks of that and of the significance of other bits; put a comment in
"ncp2222.py", before the "hf_ncp_connection_status" field, about that.

From looking at a capture, it appears that a "destroy service
connection" (0x5555) packet should be treated like a "create service
connection" (0x1111) packet and be handed to "dissect_ncp_request()".

Note that perhaps watchdog packets should be handled by
"dissect_ncp_reply()" as well.

svn path=/trunk/; revision=5489
This commit is contained in:
Guy Harris 2002-05-16 09:59:52 +00:00
parent e39ee24b14
commit e1b2d0ef85
4 changed files with 73 additions and 27 deletions

View File

@ -24,7 +24,7 @@ http://developer.novell.com/ndk/doc/docui/index.htm#../ncp/ncp__enu/data/
for a badly-formatted HTML version of the same PDF.
$Id: ncp2222.py,v 1.19 2002/05/16 03:31:33 gram Exp $
$Id: ncp2222.py,v 1.20 2002/05/16 09:59:51 guy Exp $
Copyright (c) 2000-2002 by Gilbert Ramirez <gram@alumni.rice.edu>
@ -5611,6 +5611,29 @@ proto_register_ncp2222(void)
{ &hf_ncp_completion_code,
{ "Completion Code", "ncp.completion_code", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
/*
* XXX - the page at
*
* http://www.odyssea.com/whats_new/tcpipnet/tcpipnet.html
*
* says of the connection status "The Connection Code field may
* contain values that indicate the status of the client host to
* server connection. A value of 1 in the fourth bit of this data
* byte indicates that the server is unavailable (server was
* downed).
*
* The page at
*
* http://www.unm.edu/~network/presentations/course/appendix/appendix_f/tsld088.htm
*
* says that bit 0 is "bad service", bit 2 is "no connection
* available", bit 4 is "service down", and bit 6 is "server
* has a broadcast message waiting for the client".
*
* Should it be displayed in hex, and should those bits (and any
* other bits with significance) be displayed as bitfields
* underneath it?
*/
{ &hf_ncp_connection_status,
{ "Connection Status", "ncp.connection_status", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},

View File

@ -2,12 +2,11 @@
* Structures and functions for NetWare Core Protocol.
* Gilbert Ramirez <gram@alumni.rice.edu>
*
* $Id: packet-ncp-int.h,v 1.7 2002/05/09 23:50:25 gram Exp $
* $Id: packet-ncp-int.h,v 1.8 2002/05/16 09:59:52 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
@ -85,10 +84,21 @@ typedef struct {
void dissect_ncp_request(tvbuff_t*, packet_info*, guint16,
guint8, guint16, proto_tree*);
void dissect_ncp_reply(tvbuff_t *, packet_info*, guint16,
guint8, proto_tree*);
void dissect_ncp_reply(tvbuff_t *, packet_info*, guint16, guint8,
guint16, proto_tree*);
extern int proto_ncp;
extern gint ett_ncp;
/*
* NCP packet types.
*/
#define NCP_ALLOCATE_SLOT 0x1111
#define NCP_SERVICE_REQUEST 0x2222
#define NCP_SERVICE_REPLY 0x3333
#define NCP_WATCHDOG 0x3e3e
#define NCP_DEALLOCATE_SLOT 0x5555
#define NCP_BURST_MODE_XFER 0x7777
#define NCP_POSITIVE_ACK 0x9999
#endif

View File

@ -3,7 +3,7 @@
* 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.60 2002/05/15 21:37:19 guy Exp $
* $Id: packet-ncp.c,v 1.61 2002/05/16 09:59:52 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -141,14 +141,6 @@ struct ncp_common_header {
};
#define NCP_ALLOCATE_SLOT 0x1111
#define NCP_SERVICE_REQUEST 0x2222
#define NCP_SERVICE_REPLY 0x3333
#define NCP_WATCHDOG 0x3e3e
#define NCP_DEALLOCATE_SLOT 0x5555
#define NCP_BURST_MODE_XFER 0x7777
#define NCP_POSITIVE_ACK 0x9999
static value_string ncp_type_vals[] = {
{ NCP_ALLOCATE_SLOT, "Create a service connection" },
{ NCP_SERVICE_REQUEST, "Service request" },
@ -243,7 +235,7 @@ dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
switch (header.type) {
case NCP_ALLOCATE_SLOT: /* "Allocate Slot Request"? */
case NCP_ALLOCATE_SLOT: /* Allocate Slot Request */
case NCP_SERVICE_REQUEST: /* Server NCP Request */
case NCP_SERVICE_REPLY: /* Server NCP Reply */
case NCP_WATCHDOG: /* Watchdog Packet */
@ -356,20 +348,27 @@ dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
switch (header.type) {
case NCP_ALLOCATE_SLOT: /* "Allocate Slot Request"? */
case NCP_ALLOCATE_SLOT: /* Allocate Slot Request */
case NCP_SERVICE_REQUEST: /* Server NCP Request */
case NCP_DEALLOCATE_SLOT: /* Deallocate Slot Request */
next_tvb = tvb_new_subset(tvb, hdr_offset, -1, -1);
dissect_ncp_request(next_tvb, pinfo, nw_connection,
header.sequence, header.type, ncp_tree);
break;
case NCP_SERVICE_REPLY: /* Server NCP Reply */
case NCP_POSITIVE_ACK: /* Positive Acknowledgement */
next_tvb = tvb_new_subset(tvb, hdr_offset, -1, -1);
dissect_ncp_reply(next_tvb, pinfo, nw_connection,
header.sequence, ncp_tree);
header.sequence, header.type, ncp_tree);
break;
case NCP_WATCHDOG: /* Watchdog Packet */
/*
* XXX - should the completion code be interpreted as
* it is in "packet-ncp2222.inc"? If so, this
* packet should be handled by "dissect_ncp_reply()".
*/
proto_tree_add_item(ncp_tree, hf_ncp_completion_code,
tvb, commhdr + 6, 1, TRUE);
proto_tree_add_item(ncp_tree, hf_ncp_connection_status,
@ -423,8 +422,6 @@ dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
break;
case NCP_DEALLOCATE_SLOT: /* Deallocate Slot Request */
case NCP_POSITIVE_ACK: /* Positive Acknowledgement */
default:
if (tree) {
proto_tree_add_text(ncp_tree, tvb, commhdr + 6, -1,

View File

@ -7,7 +7,7 @@
*
* Gilbert Ramirez <gram@alumni.rice.edu>
*
* $Id: packet-ncp2222.inc,v 1.12 2002/05/16 03:31:34 gram Exp $
* $Id: packet-ncp2222.inc,v 1.13 2002/05/16 09:59:52 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -598,6 +598,10 @@ static const ncp_record ncp1111_request =
{ 0x01, 0x00, NO_SUBFUNC, "Create Connection Service", NCP_GROUP_CONNECTION,
NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
static const ncp_record ncp5555_request =
{ 0x01, 0x00, NO_SUBFUNC, "Destroy Connection Service", NCP_GROUP_CONNECTION,
NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
/* Wrapper around proto_tree_free() */
void free_proto_tree(void *tree)
{
@ -637,12 +641,15 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
/* Determine which ncp_record to use. */
switch (type) {
case 0x1111:
case NCP_ALLOCATE_SLOT:
ncp_rec = &ncp1111_request;
break;
case 0x2222:
case NCP_SERVICE_REQUEST:
ncp_rec = ncp_record_find(func, subfunc);
break;
case NCP_DEALLOCATE_SLOT:
ncp_rec = &ncp5555_request;
break;
default:
ncp_rec = NULL;
}
@ -750,11 +757,11 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
PT_NCP, nw_connection, nw_connection, 0);
switch (type) {
case 0x1111:
case NCP_ALLOCATE_SLOT:
; /* nothing */
break;
case 0x2222:
case NCP_SERVICE_REQUEST:
proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
func, "Function: %d (0x%02X), %s",
func, func, ncp_rec ? ncp_rec->name : "Unknown");
@ -860,7 +867,8 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
void
dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
guint16 nw_connection, guint8 sequence, proto_tree *ncp_tree)
guint16 nw_connection, guint8 sequence, guint16 type,
proto_tree *ncp_tree)
{
conversation_t *conversation;
ncp_req_hash_value *request_value = NULL;
@ -909,7 +917,9 @@ dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
}
if (check_col(pinfo->cinfo, COL_INFO)) {
col_add_fstr(pinfo->cinfo, COL_INFO, "R %s", error_string);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
type == NCP_SERVICE_REPLY ? "R" : "ACK",
error_string);
}
if (ncp_tree) {
@ -941,6 +951,12 @@ dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
proto_tree_add_item(ncp_tree, hf_ncp_connection_status, tvb, 7, 1, FALSE);
/*
* Unless this is a reply, that's all there is to parse.
*/
if (type != NCP_SERVICE_REPLY)
return;
length = tvb_length(tvb);
if (!ncp_rec && length > 8) {
proto_tree_add_text(ncp_tree, tvb, 8, length - 8,