1 | /**
|
---|
2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
3 | * This file is part of the mingw-w64 runtime package.
|
---|
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
5 | */
|
---|
6 | #ifndef NCB_INCLUDED
|
---|
7 | #define NCB_INCLUDED
|
---|
8 |
|
---|
9 | #ifdef __cplusplus
|
---|
10 | extern "C" {
|
---|
11 | #endif
|
---|
12 |
|
---|
13 | #define NCBNAMSZ 16
|
---|
14 | #define MAX_LANA 254
|
---|
15 |
|
---|
16 | typedef struct _NCB {
|
---|
17 | UCHAR ncb_command;
|
---|
18 | UCHAR ncb_retcode;
|
---|
19 | UCHAR ncb_lsn;
|
---|
20 | UCHAR ncb_num;
|
---|
21 | PUCHAR ncb_buffer;
|
---|
22 | WORD ncb_length;
|
---|
23 | UCHAR ncb_callname[NCBNAMSZ];
|
---|
24 | UCHAR ncb_name[NCBNAMSZ];
|
---|
25 | UCHAR ncb_rto;
|
---|
26 | UCHAR ncb_sto;
|
---|
27 | void (CALLBACK *ncb_post)(struct _NCB *);
|
---|
28 | UCHAR ncb_lana_num;
|
---|
29 | UCHAR ncb_cmd_cplt;
|
---|
30 | #ifdef _WIN64
|
---|
31 | UCHAR ncb_reserve[18];
|
---|
32 | #else
|
---|
33 | UCHAR ncb_reserve[10];
|
---|
34 | #endif
|
---|
35 | HANDLE ncb_event;
|
---|
36 |
|
---|
37 | } NCB,*PNCB;
|
---|
38 |
|
---|
39 | typedef struct _ADAPTER_STATUS {
|
---|
40 | UCHAR adapter_address[6];
|
---|
41 | UCHAR rev_major;
|
---|
42 | UCHAR reserved0;
|
---|
43 | UCHAR adapter_type;
|
---|
44 | UCHAR rev_minor;
|
---|
45 | WORD duration;
|
---|
46 | WORD frmr_recv;
|
---|
47 | WORD frmr_xmit;
|
---|
48 | WORD iframe_recv_err;
|
---|
49 | WORD xmit_aborts;
|
---|
50 | DWORD xmit_success;
|
---|
51 | DWORD recv_success;
|
---|
52 | WORD iframe_xmit_err;
|
---|
53 | WORD recv_buff_unavail;
|
---|
54 | WORD t1_timeouts;
|
---|
55 | WORD ti_timeouts;
|
---|
56 | DWORD reserved1;
|
---|
57 | WORD free_ncbs;
|
---|
58 | WORD max_cfg_ncbs;
|
---|
59 | WORD max_ncbs;
|
---|
60 | WORD xmit_buf_unavail;
|
---|
61 | WORD max_dgram_size;
|
---|
62 | WORD pending_sess;
|
---|
63 | WORD max_cfg_sess;
|
---|
64 | WORD max_sess;
|
---|
65 | WORD max_sess_pkt_size;
|
---|
66 | WORD name_count;
|
---|
67 | } ADAPTER_STATUS,*PADAPTER_STATUS;
|
---|
68 |
|
---|
69 | typedef struct _NAME_BUFFER {
|
---|
70 | UCHAR name[NCBNAMSZ];
|
---|
71 | UCHAR name_num;
|
---|
72 | UCHAR name_flags;
|
---|
73 | } NAME_BUFFER,*PNAME_BUFFER;
|
---|
74 |
|
---|
75 | #define NAME_FLAGS_MASK 0x87
|
---|
76 |
|
---|
77 | #define GROUP_NAME 0x80
|
---|
78 | #define UNIQUE_NAME 0x00
|
---|
79 |
|
---|
80 | #define REGISTERING 0x00
|
---|
81 | #define REGISTERED 0x04
|
---|
82 | #define DEREGISTERED 0x05
|
---|
83 | #define DUPLICATE 0x06
|
---|
84 | #define DUPLICATE_DEREG 0x07
|
---|
85 |
|
---|
86 | typedef struct _SESSION_HEADER {
|
---|
87 | UCHAR sess_name;
|
---|
88 | UCHAR num_sess;
|
---|
89 | UCHAR rcv_dg_outstanding;
|
---|
90 | UCHAR rcv_any_outstanding;
|
---|
91 | } SESSION_HEADER,*PSESSION_HEADER;
|
---|
92 |
|
---|
93 | typedef struct _SESSION_BUFFER {
|
---|
94 | UCHAR lsn;
|
---|
95 | UCHAR state;
|
---|
96 | UCHAR local_name[NCBNAMSZ];
|
---|
97 | UCHAR remote_name[NCBNAMSZ];
|
---|
98 | UCHAR rcvs_outstanding;
|
---|
99 | UCHAR sends_outstanding;
|
---|
100 | } SESSION_BUFFER,*PSESSION_BUFFER;
|
---|
101 |
|
---|
102 | #define LISTEN_OUTSTANDING 0x01
|
---|
103 | #define CALL_PENDING 0x02
|
---|
104 | #define SESSION_ESTABLISHED 0x03
|
---|
105 | #define HANGUP_PENDING 0x04
|
---|
106 | #define HANGUP_COMPLETE 0x05
|
---|
107 | #define SESSION_ABORTED 0x06
|
---|
108 |
|
---|
109 | typedef struct _LANA_ENUM {
|
---|
110 | UCHAR length;
|
---|
111 | UCHAR lana[MAX_LANA+1];
|
---|
112 | } LANA_ENUM,*PLANA_ENUM;
|
---|
113 |
|
---|
114 | typedef struct _FIND_NAME_HEADER {
|
---|
115 | WORD node_count;
|
---|
116 | UCHAR reserved;
|
---|
117 | UCHAR unique_group;
|
---|
118 | } FIND_NAME_HEADER,*PFIND_NAME_HEADER;
|
---|
119 |
|
---|
120 | typedef struct _FIND_NAME_BUFFER {
|
---|
121 | UCHAR length;
|
---|
122 | UCHAR access_control;
|
---|
123 | UCHAR frame_control;
|
---|
124 | UCHAR destination_addr[6];
|
---|
125 | UCHAR source_addr[6];
|
---|
126 | UCHAR routing_info[18];
|
---|
127 | } FIND_NAME_BUFFER,*PFIND_NAME_BUFFER;
|
---|
128 |
|
---|
129 | typedef struct _ACTION_HEADER {
|
---|
130 | ULONG transport_id;
|
---|
131 | USHORT action_code;
|
---|
132 | USHORT reserved;
|
---|
133 | } ACTION_HEADER,*PACTION_HEADER;
|
---|
134 |
|
---|
135 | #define ALL_TRANSPORTS "M\0\0\0"
|
---|
136 | #define MS_NBF "MNBF"
|
---|
137 |
|
---|
138 | #define NCBCALL 0x10
|
---|
139 | #define NCBLISTEN 0x11
|
---|
140 | #define NCBHANGUP 0x12
|
---|
141 | #define NCBSEND 0x14
|
---|
142 | #define NCBRECV 0x15
|
---|
143 | #define NCBRECVANY 0x16
|
---|
144 | #define NCBCHAINSEND 0x17
|
---|
145 | #define NCBDGSEND 0x20
|
---|
146 | #define NCBDGRECV 0x21
|
---|
147 | #define NCBDGSENDBC 0x22
|
---|
148 | #define NCBDGRECVBC 0x23
|
---|
149 | #define NCBADDNAME 0x30
|
---|
150 | #define NCBDELNAME 0x31
|
---|
151 | #define NCBRESET 0x32
|
---|
152 | #define NCBASTAT 0x33
|
---|
153 | #define NCBSSTAT 0x34
|
---|
154 | #define NCBCANCEL 0x35
|
---|
155 | #define NCBADDGRNAME 0x36
|
---|
156 | #define NCBENUM 0x37
|
---|
157 | #define NCBUNLINK 0x70
|
---|
158 | #define NCBSENDNA 0x71
|
---|
159 | #define NCBCHAINSENDNA 0x72
|
---|
160 | #define NCBLANSTALERT 0x73
|
---|
161 | #define NCBACTION 0x77
|
---|
162 | #define NCBFINDNAME 0x78
|
---|
163 | #define NCBTRACE 0x79
|
---|
164 |
|
---|
165 | #define ASYNCH 0x80
|
---|
166 |
|
---|
167 | #define NRC_GOODRET 0x00
|
---|
168 |
|
---|
169 | #define NRC_BUFLEN 0x01
|
---|
170 | #define NRC_ILLCMD 0x03
|
---|
171 | #define NRC_CMDTMO 0x05
|
---|
172 | #define NRC_INCOMP 0x06
|
---|
173 | #define NRC_BADDR 0x07
|
---|
174 | #define NRC_SNUMOUT 0x08
|
---|
175 | #define NRC_NORES 0x09
|
---|
176 | #define NRC_SCLOSED 0x0a
|
---|
177 | #define NRC_CMDCAN 0x0b
|
---|
178 | #define NRC_DUPNAME 0x0d
|
---|
179 | #define NRC_NAMTFUL 0x0e
|
---|
180 | #define NRC_ACTSES 0x0f
|
---|
181 | #define NRC_LOCTFUL 0x11
|
---|
182 | #define NRC_REMTFUL 0x12
|
---|
183 | #define NRC_ILLNN 0x13
|
---|
184 | #define NRC_NOCALL 0x14
|
---|
185 | #define NRC_NOWILD 0x15
|
---|
186 | #define NRC_INUSE 0x16
|
---|
187 | #define NRC_NAMERR 0x17
|
---|
188 | #define NRC_SABORT 0x18
|
---|
189 | #define NRC_NAMCONF 0x19
|
---|
190 | #define NRC_IFBUSY 0x21
|
---|
191 | #define NRC_TOOMANY 0x22
|
---|
192 | #define NRC_BRIDGE 0x23
|
---|
193 | #define NRC_CANOCCR 0x24
|
---|
194 | #define NRC_CANCEL 0x26
|
---|
195 | #define NRC_DUPENV 0x30
|
---|
196 | #define NRC_ENVNOTDEF 0x34
|
---|
197 | #define NRC_OSRESNOTAV 0x35
|
---|
198 | #define NRC_MAXAPPS 0x36
|
---|
199 | #define NRC_NOSAPS 0x37
|
---|
200 | #define NRC_NORESOURCES 0x38
|
---|
201 | #define NRC_INVADDRESS 0x39
|
---|
202 | #define NRC_INVDDID 0x3B
|
---|
203 | #define NRC_LOCKFAIL 0x3C
|
---|
204 | #define NRC_OPENERR 0x3f
|
---|
205 | #define NRC_SYSTEM 0x40
|
---|
206 |
|
---|
207 | #define NRC_PENDING 0xff
|
---|
208 |
|
---|
209 | UCHAR WINAPI Netbios(PNCB pncb);
|
---|
210 |
|
---|
211 | #define NCB_POST void CALLBACK
|
---|
212 |
|
---|
213 | #ifdef __cplusplus
|
---|
214 | }
|
---|
215 | #endif
|
---|
216 | #endif
|
---|