nb30.h 5.2 KB

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