|
|
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 */
34: #define MAX_LANA 12 /* lana's in range 0 to MAX_LANA */
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 root 183:
184: /****************************************************************
185: * *
186: * Special values and constants *
187: * *
188: ****************************************************************/
189:
190: /*
191: * NCB Command codes
192: */
193:
194: #define NCBCALL 0x10 /* NCB CALL */
195: #define NCBLISTEN 0x11 /* NCB LISTEN */
196: #define NCBHANGUP 0x12 /* NCB HANG UP */
197: #define NCBSEND 0x14 /* NCB SEND */
198: #define NCBRECV 0x15 /* NCB RECEIVE */
199: #define NCBRECVANY 0x16 /* NCB RECEIVE ANY */
200: #define NCBCHAINSEND 0x17 /* NCB CHAIN SEND */
201: #define NCBDGSEND 0x20 /* NCB SEND DATAGRAM */
202: #define NCBDGRECV 0x21 /* NCB RECEIVE DATAGRAM */
203: #define NCBDGSENDBC 0x22 /* NCB SEND BROADCAST DATAGRAM */
204: #define NCBDGRECVBC 0x23 /* NCB RECEIVE BROADCAST DATAGRAM */
205: #define NCBADDNAME 0x30 /* NCB ADD NAME */
206: #define NCBDELNAME 0x31 /* NCB DELETE NAME */
207: #define NCBRESET 0x32 /* NCB RESET */
208: #define NCBASTAT 0x33 /* NCB ADAPTER STATUS */
209: #define NCBSSTAT 0x34 /* NCB SESSION STATUS */
210: #define NCBCANCEL 0x35 /* NCB CANCEL */
211: #define NCBADDGRNAME 0x36 /* NCB ADD GROUP NAME */
212: #define NCBENUM 0x37 /* NCB ENUMERATE LANA NUMBERS */
213: #define NCBUNLINK 0x70 /* NCB UNLINK */
214: #define NCBSENDNA 0x71 /* NCB SEND NO ACK */
215: #define NCBCHAINSENDNA 0x72 /* NCB CHAIN SEND NO ACK */
216: #define NCBLANSTALERT 0x73 /* NCB LAN STATUS ALERT */
217: #define NCBFINDNAME 0x78 /* NCB FIND NAME */
218: #define NCBTRACE 0x79 /* NCB TRACE */
219:
220:
221: #define ASYNCH 0x80 /* high bit set == asynchronous */
222:
223: /*
224: * NCB Return codes
225: */
226:
227: #define NRC_GOODRET 0x00 /* good return */
228: /* also returned when ASYNCH request accepted */
229: #define NRC_BUFLEN 0x01 /* illegal buffer length */
230: #define NRC_ILLCMD 0x03 /* illegal command */
231: #define NRC_CMDTMO 0x05 /* command timed out */
232: #define NRC_INCOMP 0x06 /* message incomplete, issue another command */
233: #define NRC_BADDR 0x07 /* illegal buffer address */
234: #define NRC_SNUMOUT 0x08 /* session number out of range */
235: #define NRC_NORES 0x09 /* no resource available */
236: #define NRC_SCLOSED 0x0a /* session closed */
237: #define NRC_CMDCAN 0x0b /* command cancelled */
238: #define NRC_DUPNAME 0x0d /* duplicate name */
239: #define NRC_NAMTFUL 0x0e /* name table full */
240: #define NRC_ACTSES 0x0f /* no deletions, name has active sessions */
241: #define NRC_LOCTFUL 0x11 /* local session table full */
242: #define NRC_REMTFUL 0x12 /* remote session table full */
243: #define NRC_ILLNN 0x13 /* illegal name number */
244: #define NRC_NOCALL 0x14 /* no callname */
245: #define NRC_NOWILD 0x15 /* cannot put * in NCB_NAME */
246: #define NRC_INUSE 0x16 /* name in use on remote adapter */
247: #define NRC_NAMERR 0x17 /* name deleted */
248: #define NRC_SABORT 0x18 /* session ended abnormally */
249: #define NRC_NAMCONF 0x19 /* name conflict detected */
250: #define NRC_IFBUSY 0x21 /* interface busy, IRET before retrying */
251: #define NRC_TOOMANY 0x22 /* too many commands outstanding, retry later */
252: #define NRC_BRIDGE 0x23 /* ncb_lana_num field invalid */
253: #define NRC_CANOCCR 0x24 /* command completed while cancel occurring */
254: #define NRC_CANCEL 0x26 /* command not valid to cancel */
255: #define NRC_DUPENV 0x30 /* name defined by anther local process */
256: #define NRC_ENVNOTDEF 0x34 /* environment undefined. RESET required */
257: #define NRC_OSRESNOTAV 0x35 /* required OS resources exhausted */
258: #define NRC_MAXAPPS 0x36 /* max number of applications exceeded */
259: #define NRC_NOSAPS 0x37 /* no saps available for netbios */
260: #define NRC_NORESOURCES 0x38 /* requested resources are not available */
261: #define NRC_INVADDRESS 0x39 /* invalid ncb address or length > segment */
262: #define NRC_INVDDID 0x3B /* invalid NCB DDID */
263: #define NRC_LOCKFAIL 0x3C /* lock of user area failed */
264: #define NRC_OPENERR 0x3f /* NETBIOS not loaded */
265: #define NRC_SYSTEM 0x40 /* system error */
266:
267: #define NRC_PENDING 0xff /* asynchronous command is not yet finished */
268:
269: /****************************************************************
270: * *
271: * main user entry point for NetBIOS 3.0 *
272: * *
273: * Usage: result = Netbios( pncb ); *
274: ****************************************************************/
275:
276: UCHAR
277: APIENTRY
278: Netbios(
279: PNCB pncb
280: );
281:
282: /****************************************************************
283: * *
284: * Prefix for callback routines *
285: * *
286: * Usage in a declaration: NCB_POST MyPostRoutine( PNCB pncb ); *
287: ****************************************************************/
288:
289: #define NCB_POST
290:
291: #endif /* NCB_INCLUDED */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.