|
|
1.1 root 1: //*++
2: //
3: // Copyright (c) 1991 Microsoft Corporation
4: //
5: // Module Name:
6: //
7: // nb30.h
8: //
9: // Abstract:
10: //
11: // This module contains the definitions for portable NetBIOS 3.0
12: // support.
13: //
14: // Author:
15: //
16: // Colin Watson (ColinW) 06-Jun-1991
17: //
18: // Revision History:
19: //
20: //--*/
21:
22: #ifndef NCB_INCLUDED
23:
24: #define NCB_INCLUDED
25:
26:
27: /****************************************************************
28: * *
29: * Data structure templates *
30: * *
31: ****************************************************************/
32:
33: #define NCBNAMSZ 16 /* absolute length of a net name */
1.1.1.3 ! root 34: #define MAX_LANA 32 /* lana's in range 0 to MAX_LANA */
1.1 root 35:
36: /*
37: * Network Control Block
38: */
39:
40: typedef struct _NCB {
41: UCHAR ncb_command; /* command code */
42: UCHAR ncb_retcode; /* return code */
43: UCHAR ncb_lsn; /* local session number */
44: UCHAR ncb_num; /* number of our network name */
45: PUCHAR ncb_buffer; /* address of message buffer */
46: WORD ncb_length; /* size of message buffer */
47: UCHAR ncb_callname[NCBNAMSZ]; /* blank-padded name of remote */
48: UCHAR ncb_name[NCBNAMSZ]; /* our blank-padded netname */
49: UCHAR ncb_rto; /* rcv timeout/retry count */
50: UCHAR ncb_sto; /* send timeout/sys timeout */
51: void (*ncb_post)( struct _NCB * ); /* POST routine address */
52: UCHAR ncb_lana_num; /* lana (adapter) number */
53: UCHAR ncb_cmd_cplt; /* 0xff => commmand pending */
54: UCHAR ncb_reserve[10]; /* reserved, used by BIOS */
55: HANDLE ncb_event; /* HANDLE to Win32 event which */
56: /* will be set to the signalled */
57: /* state when an ASYNCH command */
58: /* completes */
59: } NCB, *PNCB;
60:
61: /*
62: * Structure returned to the NCB command NCBASTAT is ADAPTER_STATUS followed
63: * by an array of NAME_BUFFER structures.
64: */
65:
66: typedef struct _ADAPTER_STATUS {
67: UCHAR adapter_address[6];
68: UCHAR rev_major;
69: UCHAR reserved0;
70: UCHAR adapter_type;
71: UCHAR rev_minor;
72: WORD duration;
73: WORD frmr_recv;
74: WORD frmr_xmit;
75:
76: WORD iframe_recv_err;
77:
78: WORD xmit_aborts;
79: DWORD xmit_success;
80: DWORD recv_success;
81:
82: WORD iframe_xmit_err;
83:
84: WORD recv_buff_unavail;
85: WORD t1_timeouts;
86: WORD ti_timeouts;
87: DWORD reserved1;
88: WORD free_ncbs;
89: WORD max_cfg_ncbs;
90: WORD max_ncbs;
91: WORD xmit_buf_unavail;
92: WORD max_dgram_size;
93: WORD pending_sess;
94: WORD max_cfg_sess;
95: WORD max_sess;
96: WORD max_sess_pkt_size;
97: WORD name_count;
98: } ADAPTER_STATUS, *PADAPTER_STATUS;
99:
100: typedef struct _NAME_BUFFER {
101: UCHAR name[NCBNAMSZ];
102: UCHAR name_num;
103: UCHAR name_flags;
104: } NAME_BUFFER, *PNAME_BUFFER;
105:
106: // values for name_flags bits.
107:
108: #define NAME_FLAGS_MASK 0x87
109:
110: #define GROUP_NAME 0x80
111: #define UNIQUE_NAME 0x00
112:
113: #define REGISTERING 0x00
114: #define REGISTERED 0x04
115: #define DEREGISTERED 0x05
116: #define DUPLICATE 0x06
117: #define DUPLICATE_DEREG 0x07
118:
119: /*
120: * Structure returned to the NCB command NCBSSTAT is SESSION_HEADER followed
121: * by an array of SESSION_BUFFER structures. If the NCB_NAME starts with an
122: * asterisk then an array of these structures is returned containing the
123: * status for all names.
124: */
125:
126: typedef struct _SESSION_HEADER {
127: UCHAR sess_name;
128: UCHAR num_sess;
129: UCHAR rcv_dg_outstanding;
130: UCHAR rcv_any_outstanding;
131: } SESSION_HEADER, *PSESSION_HEADER;
132:
133: typedef struct _SESSION_BUFFER {
134: UCHAR lsn;
135: UCHAR state;
136: UCHAR local_name[NCBNAMSZ];
137: UCHAR remote_name[NCBNAMSZ];
138: UCHAR rcvs_outstanding;
139: UCHAR sends_outstanding;
140: } SESSION_BUFFER, *PSESSION_BUFFER;
141:
142: // Values for state
143:
144: #define LISTEN_OUTSTANDING 0x01
145: #define CALL_PENDING 0x02
146: #define SESSION_ESTABLISHED 0x03
147: #define HANGUP_PENDING 0x04
148: #define HANGUP_COMPLETE 0x05
149: #define SESSION_ABORTED 0x06
150:
151: /*
152: * Structure returned to the NCB command NCBENUM.
153: *
154: * On a system containing lana's 0, 2 and 3, a structure with
155: * length =3, lana[0]=0, lana[1]=2 and lana[2]=3 will be returned.
156: */
157:
158: typedef struct _LANA_ENUM {
159: UCHAR length; // Number of valid entries in lana[]
160: UCHAR lana[MAX_LANA];
161: } LANA_ENUM, *PLANA_ENUM;
162:
1.1.1.2 root 163: /*
164: * Structure returned to the NCB command NCBFINDNAME is FIND_NAME_HEADER followed
165: * by an array of FIND_NAME_BUFFER structures.
166: */
167:
168: typedef struct _FIND_NAME_HEADER {
169: WORD node_count;
170: UCHAR reserved;
171: UCHAR unique_group;
172: } FIND_NAME_HEADER, *PFIND_NAME_HEADER;
173:
174: typedef struct _FIND_NAME_BUFFER {
175: UCHAR length;
176: UCHAR access_control;
177: UCHAR frame_control;
178: UCHAR destination_addr[6];
179: UCHAR source_addr[6];
180: UCHAR routing_info[18];
181: } FIND_NAME_BUFFER, *PFIND_NAME_BUFFER;
182:
1.1.1.3 ! root 183: /*
! 184: * Structure provided with NCBACTION. The purpose of NCBACTION is to provide
! 185: * transport specific extensions to netbios.
! 186: */
! 187:
! 188: typedef struct _ACTION_HEADER {
! 189: ULONG transport_id;
! 190: USHORT action_code;
! 191: USHORT reserved;
! 192: } ACTION_HEADER, *PACTION_HEADER;
! 193:
! 194: // Values for transport_id
! 195:
! 196: #define ALL_TRANSPORTS "M\0\0\0"
! 197: #define MS_NBF "MNBF"
! 198:
1.1 root 199:
200: /****************************************************************
201: * *
202: * Special values and constants *
203: * *
204: ****************************************************************/
205:
206: /*
207: * NCB Command codes
208: */
209:
210: #define NCBCALL 0x10 /* NCB CALL */
211: #define NCBLISTEN 0x11 /* NCB LISTEN */
212: #define NCBHANGUP 0x12 /* NCB HANG UP */
213: #define NCBSEND 0x14 /* NCB SEND */
214: #define NCBRECV 0x15 /* NCB RECEIVE */
215: #define NCBRECVANY 0x16 /* NCB RECEIVE ANY */
216: #define NCBCHAINSEND 0x17 /* NCB CHAIN SEND */
217: #define NCBDGSEND 0x20 /* NCB SEND DATAGRAM */
218: #define NCBDGRECV 0x21 /* NCB RECEIVE DATAGRAM */
219: #define NCBDGSENDBC 0x22 /* NCB SEND BROADCAST DATAGRAM */
220: #define NCBDGRECVBC 0x23 /* NCB RECEIVE BROADCAST DATAGRAM */
221: #define NCBADDNAME 0x30 /* NCB ADD NAME */
222: #define NCBDELNAME 0x31 /* NCB DELETE NAME */
223: #define NCBRESET 0x32 /* NCB RESET */
224: #define NCBASTAT 0x33 /* NCB ADAPTER STATUS */
225: #define NCBSSTAT 0x34 /* NCB SESSION STATUS */
226: #define NCBCANCEL 0x35 /* NCB CANCEL */
227: #define NCBADDGRNAME 0x36 /* NCB ADD GROUP NAME */
228: #define NCBENUM 0x37 /* NCB ENUMERATE LANA NUMBERS */
229: #define NCBUNLINK 0x70 /* NCB UNLINK */
230: #define NCBSENDNA 0x71 /* NCB SEND NO ACK */
231: #define NCBCHAINSENDNA 0x72 /* NCB CHAIN SEND NO ACK */
232: #define NCBLANSTALERT 0x73 /* NCB LAN STATUS ALERT */
1.1.1.3 ! root 233: #define NCBACTION 0x77 /* NCB ACTION */
1.1 root 234: #define NCBFINDNAME 0x78 /* NCB FIND NAME */
235: #define NCBTRACE 0x79 /* NCB TRACE */
236:
237:
238: #define ASYNCH 0x80 /* high bit set == asynchronous */
239:
240: /*
241: * NCB Return codes
242: */
243:
244: #define NRC_GOODRET 0x00 /* good return */
245: /* also returned when ASYNCH request accepted */
246: #define NRC_BUFLEN 0x01 /* illegal buffer length */
247: #define NRC_ILLCMD 0x03 /* illegal command */
248: #define NRC_CMDTMO 0x05 /* command timed out */
249: #define NRC_INCOMP 0x06 /* message incomplete, issue another command */
250: #define NRC_BADDR 0x07 /* illegal buffer address */
251: #define NRC_SNUMOUT 0x08 /* session number out of range */
252: #define NRC_NORES 0x09 /* no resource available */
253: #define NRC_SCLOSED 0x0a /* session closed */
254: #define NRC_CMDCAN 0x0b /* command cancelled */
255: #define NRC_DUPNAME 0x0d /* duplicate name */
256: #define NRC_NAMTFUL 0x0e /* name table full */
257: #define NRC_ACTSES 0x0f /* no deletions, name has active sessions */
258: #define NRC_LOCTFUL 0x11 /* local session table full */
259: #define NRC_REMTFUL 0x12 /* remote session table full */
260: #define NRC_ILLNN 0x13 /* illegal name number */
261: #define NRC_NOCALL 0x14 /* no callname */
262: #define NRC_NOWILD 0x15 /* cannot put * in NCB_NAME */
263: #define NRC_INUSE 0x16 /* name in use on remote adapter */
264: #define NRC_NAMERR 0x17 /* name deleted */
265: #define NRC_SABORT 0x18 /* session ended abnormally */
266: #define NRC_NAMCONF 0x19 /* name conflict detected */
267: #define NRC_IFBUSY 0x21 /* interface busy, IRET before retrying */
268: #define NRC_TOOMANY 0x22 /* too many commands outstanding, retry later */
269: #define NRC_BRIDGE 0x23 /* ncb_lana_num field invalid */
270: #define NRC_CANOCCR 0x24 /* command completed while cancel occurring */
271: #define NRC_CANCEL 0x26 /* command not valid to cancel */
272: #define NRC_DUPENV 0x30 /* name defined by anther local process */
273: #define NRC_ENVNOTDEF 0x34 /* environment undefined. RESET required */
274: #define NRC_OSRESNOTAV 0x35 /* required OS resources exhausted */
275: #define NRC_MAXAPPS 0x36 /* max number of applications exceeded */
276: #define NRC_NOSAPS 0x37 /* no saps available for netbios */
277: #define NRC_NORESOURCES 0x38 /* requested resources are not available */
278: #define NRC_INVADDRESS 0x39 /* invalid ncb address or length > segment */
279: #define NRC_INVDDID 0x3B /* invalid NCB DDID */
280: #define NRC_LOCKFAIL 0x3C /* lock of user area failed */
281: #define NRC_OPENERR 0x3f /* NETBIOS not loaded */
282: #define NRC_SYSTEM 0x40 /* system error */
283:
284: #define NRC_PENDING 0xff /* asynchronous command is not yet finished */
285:
286: /****************************************************************
287: * *
288: * main user entry point for NetBIOS 3.0 *
289: * *
290: * Usage: result = Netbios( pncb ); *
291: ****************************************************************/
292:
293: UCHAR
294: APIENTRY
295: Netbios(
296: PNCB pncb
297: );
298:
299: /****************************************************************
300: * *
301: * Prefix for callback routines *
302: * *
303: * Usage in a declaration: NCB_POST MyPostRoutine( PNCB pncb ); *
304: ****************************************************************/
305:
306: #define NCB_POST
307:
308: #endif /* NCB_INCLUDED */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.