blob: e746dd944d7cbbfbfa24bd0bdea38f09f4c6aea0 [file] [log] [blame]
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00001/*
2 * Copyright (C) 2001 Mike McCormack
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
Mike McCormack2e40b962001-11-06 17:52:36 +000019#ifndef NCB_INCLUDED
20#define NCB_INCLUDED
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#define NCBNAMSZ 16
27#define MAX_LANA 0xfe
28
Juan Lange7fd6fd2003-11-29 00:19:19 +000029#define NCBCALL 0x10
30#define NCBLISTEN 0x11
31#define NCBHANGUP 0x12
Mike McCormack2e40b962001-11-06 17:52:36 +000032#define NCBSEND 0x14
33#define NCBRECV 0x15
Juan Lange7fd6fd2003-11-29 00:19:19 +000034#define NCBRECVANY 0x16
35#define NCBCHAINSEND 0x17
36#define NCBDGSEND 0x20
37#define NCBDGRECV 0x21
38#define NCBDGSENDBC 0x22
39#define NCBDGRECVBC 0x23
40#define NCBADDNAME 0x30
41#define NCBDELNAME 0x31
42#define NCBRESET 0x32
Mike McCormack2e40b962001-11-06 17:52:36 +000043#define NCBASTAT 0x33
Juan Lange7fd6fd2003-11-29 00:19:19 +000044#define NCBSSTAT 0x34
45#define NCBCANCEL 0x35
46#define NCBADDGRNAME 0x36
Mike McCormack2e40b962001-11-06 17:52:36 +000047#define NCBENUM 0x37
Juan Lange7fd6fd2003-11-29 00:19:19 +000048#define NCBUNLINK 0x70
49#define NCBSENDNA 0x71
50#define NCBCHAINSENDNA 0x72
51#define NCBLANSTALERT 0x73
52#define NCBACTION 0x77
53#define NCBFINDNAME 0x78
54#define NCBTRACE 0x79
55
56#define ASYNCH 0x80
Mike McCormack2e40b962001-11-06 17:52:36 +000057
Mike McCormack2e40b962001-11-06 17:52:36 +000058typedef struct _NCB
59{
60 UCHAR ncb_command;
61 UCHAR ncb_retcode;
62 UCHAR ncb_lsn;
63 UCHAR ncb_num;
64 PUCHAR ncb_buffer;
65 WORD ncb_length;
66 UCHAR ncb_callname[NCBNAMSZ];
67 UCHAR ncb_name[NCBNAMSZ];
68 UCHAR ncb_rto;
69 UCHAR ncb_sto;
Juan Lange7fd6fd2003-11-29 00:19:19 +000070 VOID (CALLBACK *ncb_post)(struct _NCB *);
Mike McCormack2e40b962001-11-06 17:52:36 +000071 UCHAR ncb_lana_num;
72 UCHAR ncb_cmd_cplt;
Steven Edwardsd8f9c1c2004-01-02 20:15:05 +000073#ifdef _WIN64
74 UCHAR ncb_reserve[18];
75#else
76 UCHAR ncb_reserve[10];
77#endif
Mike McCormack2e40b962001-11-06 17:52:36 +000078 HANDLE ncb_event;
79} NCB, *PNCB;
80
81typedef struct _ADAPTER_STATUS
82{
83 UCHAR adapter_address[6];
84 UCHAR rev_major;
85 UCHAR reserved0;
86 UCHAR adapter_type;
87 UCHAR rev_minor;
88 WORD duration;
89 WORD frmr_recv;
90 WORD frmr_xmit;
91 WORD iframe_recv_error;
92 WORD xmit_aborts;
Dmitry Timoshkov6b6596a2001-11-23 18:44:43 +000093 DWORD xmit_success;
94 DWORD recv_success;
Mike McCormack2e40b962001-11-06 17:52:36 +000095 WORD iframe_xmit_error;
96 WORD recv_buffer_unavail;
97 WORD t1_timeouts;
98 WORD ti_timeouts;
99 DWORD reserved1;
100 WORD free_ncbs;
101 WORD max_cfg_ncbs;
102 WORD max_ncbs;
103 WORD xmit_buf_unavail;
104 WORD max_dgram_size;
105 WORD pending_sess;
106 WORD max_cfg_sess;
107 WORD max_sess;
Steven Edwardsd8f9c1c2004-01-02 20:15:05 +0000108 WORD max_sess_pkt_size;
Mike McCormack2e40b962001-11-06 17:52:36 +0000109 WORD name_count;
110} ADAPTER_STATUS, *PADAPTER_STATUS;
111
Juan Lange7fd6fd2003-11-29 00:19:19 +0000112typedef struct _NAME_BUFFER
113{
114 UCHAR name[NCBNAMSZ];
115 UCHAR name_num;
116 UCHAR name_flags;
117} NAME_BUFFER, *PNAME_BUFFER;
118
119#define NAME_FLAGS_MASK 0x87
120#define GROUP_NAME 0x80
121#define UNIQUE_NAME 0x00
122#define REGISTERING 0x00
123#define REGISTERED 0x04
124#define DEREGISTERED 0x05
125#define DUPLICATE 0x06
126#define DUPLICATE_DEREG 0x07
127
Mike McCormack2e40b962001-11-06 17:52:36 +0000128typedef struct _LANA_ENUM
129{
130 UCHAR length;
131 UCHAR lana[MAX_LANA+1];
132} LANA_ENUM, *PLANA_ENUM;
133
Juan Lange7fd6fd2003-11-29 00:19:19 +0000134typedef struct _FIND_NAME_HEADER
135{
136 WORD node_count;
137 UCHAR reserved;
138 UCHAR unique_group;
139} FIND_NAME_HEADER, *PFIND_NAME_HEADER;
140
141typedef struct _FIND_NAME_BUFFER
142{
143 UCHAR length;
144 UCHAR access_control;
145 UCHAR frame_control;
146 UCHAR destination_addr[6];
147 UCHAR source_addr[6];
148 UCHAR routing_info[6];
149} FIND_NAME_BUFFER, *PFIND_NAME_BUFFER;
150
151typedef struct _SESSION_HEADER {
152 UCHAR sess_name;
153 UCHAR num_sess;
154 UCHAR rcv_dg_outstanding;
155 UCHAR rcv_any_outstanding;
156} SESSION_HEADER, *PSESSION_HEADER;
157
158typedef struct _SESSION_BUFFER {
159 UCHAR lsn;
160 UCHAR state;
161 UCHAR local_name[NCBNAMSZ];
162 UCHAR remote_name[NCBNAMSZ];
163 UCHAR rcvs_outstanding;
164 UCHAR sends_outstanding;
165} SESSION_BUFFER, *PSESSION_BUFFER;
166
167#define LISTEN_OUTSTANDING 0x01
168#define CALL_PENDING 0x02
169#define SESSION_ESTABLISHED 0x03
170#define HANGUP_PENDING 0x04
171#define HANGUP_COMPLETE 0x05
172#define SESSION_ABORTED 0x06
173
174#define ALL_TRANSPORTS "M\0\0\0"
175
176#define NRC_GOODRET 0x00
177#define NRC_BUFLEN 0x01
178#define NRC_ILLCMD 0x03
179#define NRC_CMDTMO 0x05
180#define NRC_INCOMP 0x06
181#define NRC_BADDR 0x07
182#define NRC_SNUMOUT 0x08
183#define NRC_NORES 0x09
184#define NRC_SCLOSED 0x0a
185#define NRC_CMDCAN 0x0b
186#define NRC_DUPNAME 0x0d
187#define NRC_NAMTFUL 0x0e
188#define NRC_ACTSES 0x0f
189#define NRC_LOCTFUL 0x11
190#define NRC_REMTFUL 0x12
191#define NRC_ILLNN 0x13
192#define NRC_NOCALL 0x14
193#define NRC_NOWILD 0x15
194#define NRC_INUSE 0x16
195#define NRC_NAMERR 0x17
196#define NRC_SABORT 0x18
197#define NRC_NAMCONF 0x19
198#define NRC_IFBUSY 0x21
199#define NRC_TOOMANY 0x22
200#define NRC_BRIDGE 0x23
201#define NRC_CANOCCR 0x24
202#define NRC_CANCEL 0x26
203#define NRC_DUPENV 0x30
204#define NRC_ENVNOTDEF 0x34
205#define NRC_OSRESNOTAV 0x35
206#define NRC_MAXAPPS 0x36
207#define NRC_NOSAPS 0x37
Juan Langc5e856a2003-06-16 01:23:20 +0000208#define NRC_NORESOURCES 0x38
Juan Lange7fd6fd2003-11-29 00:19:19 +0000209#define NRC_INVADDRESS 0x39
210#define NRC_INVDDID 0x3b
211#define NRC_LOCKFAIL 0x3c
212#define NRC_OPENERROR 0x3f
213#define NRC_SYSTEM 0x40
214#define NRC_PENDING 0xff
215
216UCHAR WINAPI Netbios(PNCB pncb);
Mike McCormack2e40b962001-11-06 17:52:36 +0000217
218#ifdef __cplusplus
219}
220#endif
221
222#endif /* NCB_INCLUDED */