wireshark/epan/dissectors/packet-ncp-int.h

173 lines
4.5 KiB
C
Raw Normal View History

/* packet-ncp-int.h
* Structures and functions for NetWare Core Protocol.
* Gilbert Ramirez <gram@alumni.rice.edu>
* Modified for NDS support by Greg Morris (gmorris@novell.com)
*
* Portions Copyright (c) Gilbert Ramirez 2000-2002
* Portions Copyright (c) Novell, Inc. 2000-2003
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __PACKET_NCP_INT_H__
#define __PACKET_NCP_INT_H__
#include <epan/expert.h>
#include <epan/ptvcursor.h>
typedef struct _ptvc_record ptvc_record;
typedef struct _sub_ptvc_record sub_ptvc_record;
typedef struct {
int *hf_ptr;
const char *first_string;
const char *repeat_string;
} info_string_t;
struct _ptvc_record {
int *hf_ptr;
gint length;
const sub_ptvc_record *sub_ptvc_rec;
const info_string_t *req_info_str;
unsigned int endianness;
unsigned int var_index : 2;
unsigned int repeat_index : 2;
unsigned int req_cond_index : 8;
};
/*
* Every NCP packet has this common header (except for burst packets).
*/
struct ncp_common_header {
guint16 type;
guint8 sequence;
guint8 conn_low;
guint8 task;
guint8 conn_high; /* type=0x5555 doesn't have this */
};
extern gboolean nds_defragment;
extern gboolean nds_echo_eid;
extern gboolean ncp_echo_err;
extern gboolean ncp_echo_conn;
extern gboolean ncp_echo_server;
From Greg Morris: Modification to (proto.h) is made to add an additional expert group type of PI_REQUEST_CODE to allow Request tag information to be passed to the expert tap. This is for such reasons where a dissector would like to echo specific information about certain types of requests. For example: NCP connection request is really a request not a REPLY_CODE. Same is true for the TCP SYN request. Changes to packet-ncp.c 1. Server broadcast message flag. Now indicates if the message is a pending message or an oplock clear notification. 2. Cleanup of packet signature detection process. Previous method had some flaws so I redesigned it. Appears to be solid now. 3. Echo NCP Server Session information to expert tap. Note on item #3: NCP Connection+Task = NCP Session, a Single connection can have many tasks. The server sees each connection/task as a unique session. For this reason the NCP session information is now echoed to the expert composite statistics so that you can easily identify the different NCP processes and sessions. It is important to NCP analysis to understand that each session is most likely a different program on the requesting host sharing the same NCP connection. Changes to packet-ncp2222.inc 1. Comment out the echo of NCP connection info to expert tap. Replaced by NCP sessions. 2. Add displayEID in request decode (resolves Coverity defect for dead code in NCP dissector) Changes to ncp2222.py 1. Fix for endian display of bindery object type in NCP 0x1720. 2. Fix for size of bindery object type to 2 bytes instead of 4 to match other bindery NCP's. svn path=/trunk/; revision=17636
2006-03-15 18:56:35 +00:00
extern gboolean ncp_echo_file;
Fixes and updated files: File NCP2222.py: 1. Added NCP service type 0xffff = All types 2. Added evaluation of task states. (following bits are defined. 0=normal, 1 = TTS explicit transaction in progress, 2= TTS implicit transaction in progress, 4 = Shared file ste lock in progress) 3. Reversed the Volume Request Flags, this was backwards (s/b 0=do not return name with volume number, 1=Return name with volume number) 4. Fixed endianess of Creator ID in NetWare Information Struct. 5. File information structure incorrectly defined Current Block Being Decompressed. 6. Logical Lock Status structure incorrectly identified Task Number as a byte. It should be two bytes "word". 7. Fixed endianess of Modifier ID in NetWare Information Struct. 8. Fixed Name Space Information structure (was defined as Name Space, changed to Creator Name Space Number). 9. Fixed Semaphore Structure (Task Number was incorrectly defined as a byte, should be two bytes "word"). 10. Added Task structure (Task Number, Task State) 11. Fixed Volume structure (incorrectly defined Volume Name) 12. Added VolumeWithName structure (This struct contains both volume number and volume name) 13. Added error 0x8901 - "No purgable files available" 14. Added error 0x8977 - "Buffer too small" 15. Added error 0x899c - "No more trustees found" 16. Added error 0x89d9 - "Queue station is not a server" 17. Added NCP connection status values (0=Ok, 1=Bad service connection, 10=File server is down, 40=Broadcast Message Pending) 18. Fixed error definitions for NCP 22/50. 19. Fixed reply packet for NCP 22/52 to properly display volume information depending on reply struct, Volume or volume with name. 20. Fixed error definitions for NCP 22/52 21. Fixed NCP 23/26 reply packet to properly return internet address and display correctly. 22. Fixed NCP 23/27 Reply packet structure to properly repeat connection numbers array. 23. Fixed error definitions for NCP 23/33 24. Fixed NCP 23/114 Request (improperly defined Charge Information as a long value, s/b word) 25. Fixed NCP 23/120 Reply (Improperly defined Job Number as a long value, s/b word) 26. Fixed error definitions for NCP 23/123 27. Fixed error definitions for NCP 23/124 28. Fixed error definitions for NCP 23/131 29. Fixed error definitions for NCP 23/132 30. Fixed error definitions for NCP 23/135 31. Fixed error definitions for NCP 23/137 32. Fixed error definitions for NCP 23/138 33. Fixed NCP 23/205 Reply (User Login Allowed incorrectly defined as long value, s/b byte value) 34. Fixed NCP 23/234 Reply (Reply structure incorrectly defined based on old NCP documentation. Corrected per new docs) 35. Fixed endianess of NCP 23/237 Reply on value Number of Locks. 36. Fixed endianess of NCP 23/238 Reply on value Number of Locks. 37. Fixed error definitions for NCP 30 38. Fixed error definitions for NCP 36/6 39. Fixed error definitions for NCP 86/2 40. Fixed error definitions for NCP 86/3 41. Fixed error definitions for NCP 86/4 42. Fixed error definitions for NCP 86/5 43. Fixed error definitions for NCP 87/1 44. Fixed error definitions for NCP 87/4 45. Fixed error definitions for NCP 87/5 46. Fixed error definitions for NCP 87/10 47. Fixed error definitions for NCP 87/11 48. Fixed error definitions for NCP 87/12 49. Fixed error definitions for NCP 87/17 50. Fixed error definitions for NCP 87/18 51. Fixed NCP 87/20 Reply to properly decode multiple entries returned. This used to only dissect the first entry. 52. Fixed error definitions for NCP 87/30 53. Fixed NCP 87/33 Reply to properly utilize the request flags to dissect the reply packet NetWare Info Struct 54. Fixed error definitions for NCP 87/33 55. Fixed error definitions for NCP 88/22 56. Fixed error definitions for NCP 89/1 57. Fixed error definitions for NCP 89/10 58. Fixed NCP 89/11 Request packet structure 59. Fixed error definitions for NCP 89/11 60. Fixed NCP 89/20 Reply to properly decode multiple entries returned. This used to only dissect the first entry. 61. Fixed error definitions for NCP 104/5 62. Added undefined NCP 112 63. Fixed NCP 123/11 Reply to properly dissect FileName, Name, and copyright. 64. Fixed NCP 123/17 Reply to properly display NCP Network Address values. 65. Fixed NCP 123/24 Reply to properly display Driver Board Name, Driver Short Name, and Dirver Logical Name. 66. Fixed error definitions for NCP 123/33 67. Fixed NCP 123/60 to properly display Set Command Name and Set Command Value. 68. Fixed error definitions for NCP 123/70 69. Fixed NCP 123/71 Reply to utilize new File Information Struct 70. Fixed error definitions for NCP 123/71 71. Fixed error definitions for NCP 123/72 72. Added NCP 123/249 73. Added NCP 123/251 74. Added NCP 123/252 75. Added NCP 123/253 76. Added NCP 123/254 77. Added NCP 123/255 78. Fixed error definitions for NCP 131/1 79. Fixed error definitions for NCP 131/2 File packet-ncp2222.inc 1. Added new NCP preference setting to tell Wireshark to decode the NetWare information structure as new or old style. 2. Set default NCP preference settings of echo connection and echo file to FALSE. 3. Added NDS verb 2 Request Flags (0=retain old object, 1=delete old object) 4. Fixed problem where NDS fragmentation could not be reassembled on reload. (fragment array needed to be re-initialized on reload) 5. Fixed NCP service types 1111, 5555, bbbb, and 1111/LIP to reflect real type number. (Was defined as 0xf1, 0xf2, 0xf3, etc... Now defined as 0x1, 0x5, 0xb, etc) 6. Fixed function build_expert_data to parse subtree memory structures to acquire NCP request value records 7. Fix NDS attribute type Boolean to byte value and properly aligned. 8. Fixed attribute zendmSearchOrder to display properly regardless of number or order of value entries. 9. Added check of length of packet prior to attempting to defragment 10. Added for Request packets logic to abort if NCP type isn't found. 11. Added logic to store packet length and then manually decode NCP function 123 based on length. 12. Added logic to manually dissect NCP 87/20 and 89/20 reply packets. 13. NDS resolve name replies with remote entry as the specifier should not store the EID returned (0x00000000) 14. Added logic to trap and echo to expert tap when connection status flags indicate an error. 15. Added manual dissect of NCP 23/26 replies 16. Added logic to Capture the EID returned form NCP 22/51 "Get vol info". 17. Fixed NDS verb 0x2a 18. Fixed NDS verb 0x2b File packet-ncp.c 1. Fix offset for packet signature. (This used to automatically set the offset to account for packet signature if it could not determine the correct NCP type. But for some failed fragment packets, retransmissions, etc, this would be wrongly identified. So first we check to see if we can read a valid type at the offset before we just automatically assume that packet signature is being used) 2. Register the new NCP preference for old/new NetWareInfoStruct. File packet-ncp-int.h 1. Add extern declaration for ncp_newstyle setting. 2. Add length, req_mask, and req_mast_ext to ncp_req_hash_value structure File packet-ncp-sss.c 1. Fix SecretStore request verb Write App Secrets, Client Put Data, to evaluate packet length. svn path=/trunk/; revision=19073
2006-08-29 08:45:53 +00:00
extern gboolean ncp_newstyle;
struct _sub_ptvc_record {
gint *ett;
const char *descr;
const ptvc_record *ptvc_rec;
};
typedef struct {
const char *dfilter_text;
struct epan_dfilter *dfilter;
} conditional_record;
struct novell_tap {
int stat;
int hdr;
};
typedef struct novell_tap _novell_tap;
typedef struct {
guint8 error_in_packet;
gint ncp_error_index;
} error_equivalency;
struct _ncp_record;
typedef void (ncp_expert_handler)(ptvcursor_t *ptvc, packet_info *pinfo, const struct _ncp_record *ncp_rec, gboolean request);
typedef struct _ncp_record {
guint8 func;
guint8 subfunc;
guint8 has_subfunc;
const gchar* name;
gint group;
const ptvc_record *request_ptvc;
const ptvc_record *reply_ptvc;
const error_equivalency *errors;
const int *req_cond_indexes;
unsigned int req_cond_size_type;
ncp_expert_handler *expert_handler_func;
} ncp_record;
typedef struct {
const ncp_record *ncp_rec;
gboolean *req_cond_results;
guint32 req_frame_num;
nstime_t req_frame_time;
guint16 length;
guint32 req_nds_flags;
guint32 req_nds_prot_flags;
guint8 nds_request_verb;
guint8 nds_version;
char object_name[256];
gboolean nds_frag;
guint32 nds_end_frag;
guint32 nds_frag_num;
guint16 req_mask;
guint16 req_mask_ext;
guint32 nds_frag_flags;
} ncp_req_hash_value;
WS_DLL_PUBLIC const value_string sss_verb_enum[];
WS_DLL_PUBLIC const value_string nmas_subverb_enum[];
WS_DLL_PUBLIC const value_string ncp_nds_verb_vals[];
void dissect_ncp_request(tvbuff_t*, packet_info*, guint32,
guint8, guint16, proto_tree *volatile);
void dissect_ncp_reply(tvbuff_t *, packet_info*, guint32, guint8,
guint16, proto_tree*, struct novell_tap*);
void dissect_ping_req(tvbuff_t *, packet_info*, guint32, guint8,
guint16, proto_tree*);
void dissect_nds_request(tvbuff_t*, packet_info*, guint32,
guint8, guint16, proto_tree*);
void nds_defrag(tvbuff_t*, packet_info*, guint32,
guint8, guint16, proto_tree*, struct novell_tap*);
extern int proto_ncp;
extern gint ett_ncp;
extern gint ett_nds;
extern gint ett_nds_segments;
extern gint ett_nds_segment;
/*extern dissector_handle_t nds_data_handle;*/
/*
* 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
#define NCP_BROADCAST_SLOT 0xbbbb
#define NCP_LIP_ECHO 0x4c69
#endif