1 // Copyright © 2015-2017 winapi-rs developers 2 // Licensed under the Apache License, Version 2.0 3 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 4 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. 5 // All files in the project carrying such notice may not be copied, modified, or distributed 6 // except according to those terms. 7 //! This module contains the definitions for portable NetBIOS 3.0 support. 8 use shared::minwindef::{DWORD, PUCHAR, UCHAR, ULONG, USHORT, WORD}; 9 use um::winnt::HANDLE; 10 pub const NCBNAMSZ: usize = 16; 11 pub const MAX_LANA: usize = 254; 12 FN!{stdcall PFPOST( 13 *mut NCB, 14 ) -> ()} 15 #[cfg(target_arch = "x86_64")] 16 STRUCT!{struct NCB { 17 ncb_command: UCHAR, 18 ncb_retcode: UCHAR, 19 ncb_lsn: UCHAR, 20 ncb_num: UCHAR, 21 ncb_buffer: PUCHAR, 22 ncb_length: WORD, 23 ncb_callname: [UCHAR; NCBNAMSZ], 24 ncb_name: [UCHAR; NCBNAMSZ], 25 ncb_rto: UCHAR, 26 ncb_sto: UCHAR, 27 ncb_post: PFPOST, 28 ncb_lana_num: UCHAR, 29 ncb_cmd_cplt: UCHAR, 30 ncb_reserve: [UCHAR; 18], 31 ncb_event: HANDLE, 32 }} 33 #[cfg(target_arch = "x86")] 34 STRUCT!{struct NCB { 35 ncb_command: UCHAR, 36 ncb_retcode: UCHAR, 37 ncb_lsn: UCHAR, 38 ncb_num: UCHAR, 39 ncb_buffer: PUCHAR, 40 ncb_length: WORD, 41 ncb_callname: [UCHAR; NCBNAMSZ], 42 ncb_name: [UCHAR; NCBNAMSZ], 43 ncb_rto: UCHAR, 44 ncb_sto: UCHAR, 45 ncb_post: PFPOST, 46 ncb_lana_num: UCHAR, 47 ncb_cmd_cplt: UCHAR, 48 ncb_reserve: [UCHAR; 10], 49 ncb_event: HANDLE, 50 }} 51 pub type PNCB = *mut NCB; 52 STRUCT!{struct ADAPTER_STATUS { 53 adapter_address: [UCHAR; 6], 54 rev_major: UCHAR, 55 reserved0: UCHAR, 56 adapter_type: UCHAR, 57 rev_minor: UCHAR, 58 duration: WORD, 59 frmr_recv: WORD, 60 frmr_xmit: WORD, 61 iframe_recv_err: WORD, 62 xmit_aborts: WORD, 63 xmit_success: DWORD, 64 recv_success: DWORD, 65 iframe_xmit_err: WORD, 66 recv_buff_unavail: WORD, 67 t1_timeouts: WORD, 68 ti_timeouts: WORD, 69 reserved1: DWORD, 70 free_ncbs: WORD, 71 max_cfg_ncbs: WORD, 72 max_ncbs: WORD, 73 xmit_buf_unavail: WORD, 74 max_dgram_size: WORD, 75 pending_sess: WORD, 76 max_cfg_sess: WORD, 77 max_sess: WORD, 78 max_sess_pkt_size: WORD, 79 name_count: WORD, 80 }} 81 pub type PADAPTER_STATUS = *mut ADAPTER_STATUS; 82 STRUCT!{struct NAME_BUFFER { 83 name: [UCHAR; NCBNAMSZ], 84 name_num: UCHAR, 85 name_flags: UCHAR, 86 }} 87 pub type PNAME_BUFFER = *mut NAME_BUFFER; 88 pub const NAME_FLAGS_MASK: UCHAR = 0x87; 89 pub const GROUP_NAME: UCHAR = 0x80; 90 pub const UNIQUE_NAME: UCHAR = 0x00; 91 pub const REGISTERING: UCHAR = 0x00; 92 pub const REGISTERED: UCHAR = 0x04; 93 pub const DEREGISTERED: UCHAR = 0x05; 94 pub const DUPLICATE: UCHAR = 0x06; 95 pub const DUPLICATE_DEREG: UCHAR = 0x07; 96 STRUCT!{struct SESSION_HEADER { 97 sess_name: UCHAR, 98 num_sess: UCHAR, 99 rcv_dg_outstanding: UCHAR, 100 rcv_any_outstanding: UCHAR, 101 }} 102 pub type PSESSION_HEADER = *mut SESSION_HEADER; 103 STRUCT!{struct SESSION_BUFFER { 104 lsn: UCHAR, 105 state: UCHAR, 106 local_name: [UCHAR; NCBNAMSZ], 107 remote_name: [UCHAR; NCBNAMSZ], 108 rcvs_outstanding: UCHAR, 109 sends_outstanding: UCHAR, 110 }} 111 pub type PSESSION_BUFFER = *mut SESSION_BUFFER; 112 pub const LISTEN_OUTSTANDING: UCHAR = 0x01; 113 pub const CALL_PENDING: UCHAR = 0x02; 114 pub const SESSION_ESTABLISHED: UCHAR = 0x03; 115 pub const HANGUP_PENDING: UCHAR = 0x04; 116 pub const HANGUP_COMPLETE: UCHAR = 0x05; 117 pub const SESSION_ABORTED: UCHAR = 0x06; 118 STRUCT!{struct LANA_ENUM { 119 length: UCHAR, 120 lana: [UCHAR; MAX_LANA + 1], 121 }} 122 pub type PLANA_ENUM = *mut LANA_ENUM; 123 STRUCT!{struct FIND_NAME_HEADER { 124 node_count: WORD, 125 reserved: UCHAR, 126 unique_group: UCHAR, 127 }} 128 pub type PFIND_NAME_HEADER = *mut FIND_NAME_HEADER; 129 STRUCT!{struct FIND_NAME_BUFFER { 130 length: UCHAR, 131 access_control: UCHAR, 132 frame_control: UCHAR, 133 destination_addr: [UCHAR; 6], 134 source_addr: [UCHAR; 6], 135 routing_info: [UCHAR; 18], 136 }} 137 pub type PFIND_NAME_BUFFER = *mut FIND_NAME_BUFFER; 138 STRUCT!{struct ACTION_HEADER { 139 transport_id: ULONG, 140 action_code: USHORT, 141 reserved: USHORT, 142 }} 143 pub type PACTION_HEADER = *mut ACTION_HEADER; 144 pub const ALL_TRANSPORTS: ULONG = 0x0000004d; 145 pub const MS_NBF: ULONG = 0x46424e4d; 146 pub const NCBCALL: UCHAR = 0x10; 147 pub const NCBLISTEN: UCHAR = 0x11; 148 pub const NCBHANGUP: UCHAR = 0x12; 149 pub const NCBSEND: UCHAR = 0x14; 150 pub const NCBRECV: UCHAR = 0x15; 151 pub const NCBRECVANY: UCHAR = 0x16; 152 pub const NCBCHAINSEND: UCHAR = 0x17; 153 pub const NCBDGSEND: UCHAR = 0x20; 154 pub const NCBDGRECV: UCHAR = 0x21; 155 pub const NCBDGSENDBC: UCHAR = 0x22; 156 pub const NCBADDNAME: UCHAR = 0x30; 157 pub const NCBDELNAME: UCHAR = 0x31; 158 pub const NCBRESET: UCHAR = 0x32; 159 pub const NCBASTAT: UCHAR = 0x33; 160 pub const NCBSSTAT: UCHAR = 0x34; 161 pub const NCBCANCEL: UCHAR = 0x35; 162 pub const NCBADDGRNAME: UCHAR = 0x36; 163 pub const NCBENUM: UCHAR = 0x37; 164 pub const NCBUNLINK: UCHAR = 0x70; 165 pub const NCBSENDNA: UCHAR = 0x71; 166 pub const NCBCHAINSENDNA: UCHAR = 0x72; 167 pub const NCBLANSTALERT: UCHAR = 0x73; 168 pub const NCBACTION: UCHAR = 0x77; 169 pub const NCBFINDNAME: UCHAR = 0x78; 170 pub const NCBTRACE: UCHAR = 0x79; 171 pub const ASYNCH: UCHAR = 0x80; 172 pub const NRC_GOODRET: UCHAR = 0x00; 173 pub const NRC_BUFLEN: UCHAR = 0x01; 174 pub const NRC_ILLCMD: UCHAR = 0x03; 175 pub const NRC_CMDTMO: UCHAR = 0x05; 176 pub const NRC_INCOMP: UCHAR = 0x06; 177 pub const NRC_BADDR: UCHAR = 0x07; 178 pub const NRC_SNUMOUT: UCHAR = 0x08; 179 pub const NRC_NORES: UCHAR = 0x09; 180 pub const NRC_SCLOSED: UCHAR = 0x0a; 181 pub const NRC_CMDCAN: UCHAR = 0x0b; 182 pub const NRC_DUPNAME: UCHAR = 0x0d; 183 pub const NRC_NAMTFUL: UCHAR = 0x0e; 184 pub const NRC_ACTSES: UCHAR = 0x0f; 185 pub const NRC_LOCTFUL: UCHAR = 0x11; 186 pub const NRC_REMTFUL: UCHAR = 0x12; 187 pub const NRC_ILLNN: UCHAR = 0x13; 188 pub const NRC_NOCALL: UCHAR = 0x14; 189 pub const NRC_NOWILD: UCHAR = 0x15; 190 pub const NRC_INUSE: UCHAR = 0x16; 191 pub const NRC_NAMERR: UCHAR = 0x17; 192 pub const NRC_SABORT: UCHAR = 0x18; 193 pub const NRC_NAMCONF: UCHAR = 0x19; 194 pub const NRC_IFBUSY: UCHAR = 0x21; 195 pub const NRC_TOOMANY: UCHAR = 0x22; 196 pub const NRC_BRIDGE: UCHAR = 0x23; 197 pub const NRC_CANOCCR: UCHAR = 0x24; 198 pub const NRC_CANCEL: UCHAR = 0x26; 199 pub const NRC_DUPENV: UCHAR = 0x30; 200 pub const NRC_ENVNOTDEF: UCHAR = 0x34; 201 pub const NRC_OSRESNOTAV: UCHAR = 0x35; 202 pub const NRC_MAXAPPS: UCHAR = 0x36; 203 pub const NRC_NOSAPS: UCHAR = 0x37; 204 pub const NRC_NORESOURCES: UCHAR = 0x38; 205 pub const NRC_INVADDRESS: UCHAR = 0x39; 206 pub const NRC_INVDDID: UCHAR = 0x3B; 207 pub const NRC_LOCKFAIL: UCHAR = 0x3C; 208 pub const NRC_OPENERR: UCHAR = 0x3f; 209 pub const NRC_SYSTEM: UCHAR = 0x40; 210 pub const NRC_PENDING: UCHAR = 0xff; 211 extern "system" { Netbios( pncb: PNCB, ) -> UCHAR212 pub fn Netbios( 213 pncb: PNCB, 214 ) -> UCHAR; 215 } 216