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