3 * Copyright 2012, 2013 MinGW.org project
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
26 #pragma GCC system_header
35 #define NAME_FLAGS_MASK 0x87
36 #define GROUP_NAME 0x80
37 #define UNIQUE_NAME 0x00
38 #define REGISTERING 0x00
39 #define REGISTERED 0x04
40 #define DEREGISTERED 0x05
41 #define DUPLICATE 0x06
42 #define DUPLICATE_DEREG 0x07
43 #define LISTEN_OUTSTANDING 0x01
44 #define CALL_PENDING 0x02
45 #define SESSION_ESTABLISHED 0x03
46 #define HANGUP_PENDING 0x04
47 #define HANGUP_COMPLETE 0x05
48 #define SESSION_ABORTED 0x06
49 #define ALL_TRANSPORTS "M\0\0\0"
52 #define NCBLISTEN 0x11
53 #define NCBHANGUP 0x12
56 #define NCBRECVANY 0x16
57 #define NCBCHAINSEND 0x17
58 #define NCBDGSEND 0x20
59 #define NCBDGRECV 0x21
60 #define NCBDGSENDBC 0x22
61 #define NCBDGRECVBC 0x23
62 #define NCBADDNAME 0x30
63 #define NCBDELNAME 0x31
67 #define NCBCANCEL 0x35
68 #define NCBADDGRNAME 0x36
70 #define NCBUNLINK 0x70
71 #define NCBSENDNA 0x71
72 #define NCBCHAINSENDNA 0x72
73 #define NCBLANSTALERT 0x73
74 #define NCBACTION 0x77
75 #define NCBFINDNAME 0x78
78 #define NRC_GOODRET 0x00
79 #define NRC_BUFLEN 0x01
80 #define NRC_ILLCMD 0x03
81 #define NRC_CMDTMO 0x05
82 #define NRC_INCOMP 0x06
83 #define NRC_BADDR 0x07
84 #define NRC_SNUMOUT 0x08
85 #define NRC_NORES 0x09
86 #define NRC_SCLOSED 0x0a
87 #define NRC_CMDCAN 0x0b
88 #define NRC_DUPNAME 0x0d
89 #define NRC_NAMTFUL 0x0e
90 #define NRC_ACTSES 0x0f
91 #define NRC_LOCTFUL 0x11
92 #define NRC_REMTFUL 0x12
93 #define NRC_ILLNN 0x13
94 #define NRC_NOCALL 0x14
95 #define NRC_NOWILD 0x15
96 #define NRC_INUSE 0x16
97 #define NRC_NAMERR 0x17
98 #define NRC_SABORT 0x18
99 #define NRC_NAMCONF 0x19
100 #define NRC_IFBUSY 0x21
101 #define NRC_TOOMANY 0x22
102 #define NRC_BRIDGE 0x23
103 #define NRC_CANOCCR 0x24
104 #define NRC_CANCEL 0x26
105 #define NRC_DUPENV 0x30
106 #define NRC_ENVNOTDEF 0x34
107 #define NRC_OSRESNOTAV 0x35
108 #define NRC_MAXAPPS 0x36
109 #define NRC_NOSAPS 0x37
110 #define NRC_NORESOURCES 0x38
111 #define NRC_INVADDRESS 0x39
112 #define NRC_INVDDID 0x3B
113 #define NRC_LOCKFAIL 0x3C
114 #define NRC_OPENERR 0x3f
115 #define NRC_SYSTEM 0x40
116 #define NRC_PENDING 0xff
117 #define NCB_POST void CALLBACK
118 typedef struct _ACTION_HEADER {
122 } ACTION_HEADER,*PACTION_HEADER;
123 typedef struct _ADAPTER_STATUS {
124 UCHAR adapter_address[6];
132 WORD iframe_recv_err;
136 WORD iframe_xmit_err;
137 WORD recv_buff_unavail;
144 WORD xmit_buf_unavail;
149 WORD max_sess_pkt_size;
151 } ADAPTER_STATUS,*PADAPTER_STATUS;
152 typedef struct _FIND_NAME_BUFFER {
154 UCHAR access_control;
156 UCHAR destination_addr[6];
157 UCHAR source_addr[6];
158 UCHAR routing_info[18];
159 } FIND_NAME_BUFFER,*PFIND_NAME_BUFFER;
160 typedef struct _FIND_NAME_HEADER {
164 } FIND_NAME_HEADER,*PFIND_NAME_HEADER;
165 typedef struct _LANA_ENUM {
167 UCHAR lana[MAX_LANA+1];
168 } LANA_ENUM,*PLANA_ENUM;
169 typedef struct _NAME_BUFFER {
170 UCHAR name[NCBNAMSZ];
173 } NAME_BUFFER,*PNAME_BUFFER;
174 typedef struct _NCB {
181 UCHAR ncb_callname[NCBNAMSZ];
182 UCHAR ncb_name[NCBNAMSZ];
185 void (CALLBACK *ncb_post)(struct _NCB*);
188 UCHAR ncb_reserve[10];
191 typedef struct _SESSION_BUFFER {
194 UCHAR local_name[NCBNAMSZ];
195 UCHAR remote_name[NCBNAMSZ];
196 UCHAR rcvs_outstanding;
197 UCHAR sends_outstanding;
198 } SESSION_BUFFER,*PSESSION_BUFFER;
199 typedef struct _SESSION_HEADER {
202 UCHAR rcv_dg_outstanding;
203 UCHAR rcv_any_outstanding;
204 } SESSION_HEADER,*PSESSION_HEADER;
205 UCHAR WINAPI Netbios(PNCB);