nwprot.pp 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350
  1. {
  2. Netware Server Imports for FreePascal, contains definitions for the
  3. netware server protocol library
  4. Initial Version 2003/02/23 Armin ([email protected] or [email protected])
  5. The C-NDK and Documentation can be found here:
  6. http://developer.novell.com
  7. This program is distributed in the hope that it will be useful,but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE.
  10. Do not blame Novell if there are errors in this file, instead
  11. contact me and i will se what i can do.
  12. This module is untested, for the socket functions please use winsock
  13. }
  14. {$IFNDEF FPC_DOTTEDUNITS}
  15. unit nwprot;
  16. {$ENDIF FPC_DOTTEDUNITS}
  17. interface
  18. {$mode objfpc}
  19. {$packrecords C}
  20. const
  21. O_RDONLY = $0000;
  22. O_WRONLY = $0001;
  23. O_RDWR = $0002;
  24. O_ACCMODE = $0003;
  25. O_APPEND = $0010;
  26. O_CREAT = $0020;
  27. O_TRUNC = $0040;
  28. O_EXCL = $0080;
  29. O_TEXT = $0100;
  30. O_BINARY = $0200;
  31. O_NDELAY = $0400;
  32. O_NOCTTY = $0800;
  33. O_NONBLOCK = O_NDELAY;
  34. {-ip_route.h-------------------------------------------------------------------}
  35. // dont know where the symbols came from, may be TCPIP.NLM, for now we
  36. // define 'clib'
  37. { total size of an IP address in bytes }
  38. const
  39. IP_ADDR_SZ = 4;
  40. type
  41. Pip_addr = ^Tip_addr;
  42. Tip_addr = record
  43. case longint of
  44. 0 : ( ip_array : array[0..(IP_ADDR_SZ)-1] of byte );
  45. 1 : ( ip_short : array[0..(IP_ADDR_SZ DIV 2)-1] of word );
  46. 2 : ( ip_long : dword );
  47. end;
  48. const
  49. SNPA_MX = 10; // maximum address mapping size is that largest we currently use
  50. // Simple IP interface information block --
  51. type
  52. Pip_if_info = ^Tip_if_info;
  53. Tip_if_info = record
  54. ifi_local_addr : Tip_addr; // interface's IP address
  55. ifi_net_mask : Tip_addr; // Netmask
  56. ifi_broadcast : Tip_addr; // Broadcast
  57. end;
  58. // Extended IP interface information block
  59. Pip_extended_if_info = ^Tip_extended_if_info;
  60. Tip_extended_if_info = record
  61. iex_signature : dword; // API signature
  62. iex_version : dword; // API version
  63. iex_length : dword; // bufsize
  64. iex_flags : dword;
  65. iex_if_id : dword; // Interface-ID
  66. iex_timestamp : dword; // creation time
  67. iex_local_addr : Tip_addr; // IP Address
  68. iex_net_mask : Tip_addr; // Netmask
  69. iex_broadcast : Tip_addr; // Broadcast Address
  70. iex_packet_mx : dword; // max out packet size
  71. iex_packet_opt : dword; // optimum packet size
  72. iex_reasm_mx : dword; // maximum reassembled packet
  73. iex_net_type : longint; // Network type
  74. iex_board_num : dword; // ODLI voardnumber
  75. iex_our_snpa : array[0..(SNPA_MX)-1] of byte; // SNPA for interface
  76. end;
  77. function IPExtendedIFInfo(info_pt:Pip_extended_if_info):longint;cdecl;external 'clib' name 'IPExtendedIFInfo';
  78. function IPExtendedIFInfo(var info_t:Tip_extended_if_info):longint;cdecl;external 'clib' name 'IPExtendedIFInfo';
  79. function IPGetIFInfo(if_info_pt:Pip_if_info):longint;cdecl;external 'clib' name 'IPGetIFInfo';
  80. function IPGetIFInfo(var if_info_t:Tip_if_info):longint;cdecl;external 'clib' name 'IPGetIFInfo';
  81. function IPGetLocalAddr(last_addr:dword):dword;cdecl;external 'clib' name 'IPGetLocalAddr';function IPGetLocalAddrIncludingAux(last_addr:dword):dword;cdecl;external 'clib' name 'IPGetLocalAddrIncludingAux';
  82. {-netdb.h----------------------------------------------------------------------}
  83. // Macros mapping the standard 4.3BSD names are not implemented in pascal
  84. {
  85. $Abstract:
  86. Standard definitions for accessing the socket interface's network
  87. database in Novell's NetWare 386 TCP/IP. Since process context is
  88. limited in NetWare 386, we need to play some games to provide context
  89. to the database.
  90. $
  91. $Implementation Notes:
  92. The actual NetWare 386 TCP/IP routines take an additional parameter
  93. to provide them a block for maintaining context. The normal routines
  94. are actually macros which call the context aware routines.
  95. One modification is required for porting an NLM the NetWare 386
  96. versions of the database routines: a context block must be defined.
  97. This is done by using the macro NETDB_DEFINE_CONTEXT in any one
  98. module linked into the NLM.
  99. If the preprocessor symbol NOT_NETWARE_386 is defined, this becomes
  100. the standard netdb.h from 4.3BSD for use in more typical environments.
  101. $
  102. The HOSTS database macros (i.e. gethostxxx) have the capability to
  103. evaluate either to the routines that access just the local /etc/hosts
  104. file (i.e. NWgethostxxx), or else the routines that automatically access
  105. a combination of local file, DNS, and NIS (i.e. NetDBgethostxxx). The
  106. former case is the way previous SDK usage of the macro was implemented.
  107. The latter case is a newer option that utilizes network name services
  108. transparent to the NLM, but it requires NETDB.NLM (which is also provided
  109. in this SDK). NETDB.NLM is an extension to TCP/IP and may be freely
  110. distributed with your product.
  111. The developer may choose which routines to use by directly calling the
  112. routines desired (either NWgethostxxx or NetDBgethostxxx). If the macros
  113. are used, then the macros will call the local-file-only versions of the
  114. calls (i.e. NWgethostxxx) unless the symbol NETDB_USE_INTERNET is
  115. defined below. If you wish to use the internet name services such as
  116. NIS or DNS in addition to the local hosts file for host access, then this
  117. symbol must be defined (either here or in your source file).
  118. }
  119. {$define NETDB_USE_INTERNET}
  120. const
  121. HOST_NOT_FOUND = 1;
  122. TRY_AGAIN = 2;
  123. NO_RECOVERY = 3;
  124. NO_ADDRESS = 4;
  125. { Structures returned by network
  126. data base library. All addresses
  127. are supplied in host order, and
  128. returned in network order (suitable
  129. for use in system calls). }
  130. { define h_addr h_addr_list[0] /* address, for backward compatiblity */ }
  131. type
  132. Phostent = ^Thostent;
  133. Thostent = record
  134. h_name : PAnsiChar; // official name of host
  135. h_aliases : ^PAnsiChar; // alias list
  136. h_addrtype : longint;
  137. h_length : longint; // length of address
  138. h_addr_list : ^PAnsiChar; // list of addresses from name server
  139. end;
  140. // Assumption here is that a network number fits in 32 bits -- probably a poor one.
  141. Pnetent = ^Tnetent;
  142. Tnetent = record
  143. n_name : PAnsiChar; // official name of net
  144. n_aliases : ^PAnsiChar; // alias list
  145. n_addrtype : longint;
  146. n_net : dword;
  147. n_mask : dword; // Netmask, Novell extension
  148. end;
  149. Pservent = ^Tservent;
  150. Tservent = record
  151. s_name : PAnsiChar; // official service name
  152. s_aliases : ^PAnsiChar; // alias list
  153. s_port : longint; // portnumber
  154. s_proto : PAnsiChar; // protocol to use
  155. end;
  156. Pprotoent = ^Tprotoent;
  157. Tprotoent = record
  158. p_name : PAnsiChar; // official protocol name
  159. p_aliases : ^PAnsiChar;
  160. p_proto : longint;
  161. end;
  162. // var h_errno : longint;cvar;external;
  163. const
  164. SCRATCHBUFSIZE = 1024;
  165. MAXALIASES = 10;
  166. MAXALIASSIZE = 64;
  167. MAXNAMESIZE = 64;
  168. MAXADDRSIZE = 19;
  169. MAXHOSTADDR = 1;
  170. { Special Novell structure for providing context in the otherwise
  171. context-free NetWare 386 environment. The applications SHOULD NOT
  172. access this structure ! }
  173. type
  174. Pnwsockent = ^Tnwsockent;
  175. Tnwsockent = record
  176. nse_hostctx : pointer; // PFILE;
  177. nse_netctx : pointer; // PFILE;
  178. nse_protoctx : pointer; // PFILE;
  179. nse_servctx : pointer; // PFILE;
  180. nse_h_errno : longint;
  181. nse_sockent_un : record
  182. case longint of
  183. 0 : ( nsu_hst : Thostent );
  184. 1 : ( nsu_net : Tnetent );
  185. 2 : ( nsu_proto : Tprotoent );
  186. 3 : ( nsu_serv : Tservent );
  187. end;
  188. nse_scratch : array[0..(SCRATCHBUFSIZE)-1] of AnsiChar;
  189. end;
  190. { Declare the context block. The client must supply the actual
  191. block by placing NETDB_DEFINE_CONTEXT in one of the C modules
  192. in the link. }
  193. // var nwSocketCtx : longint;cvar;external;
  194. { ------------------------------------------------------------------------
  195. Host file examination
  196. ------------------------------------------------------------------------ }
  197. { Local-file-only routines }
  198. function NWgethostbyname(nwsktctx:Pnwsockent; name:PAnsiChar):Phostent;cdecl;external {'tcpip'} name 'NWgethostbyname';
  199. function NWgethostbyname(var nwsktctx:Tnwsockent; name:PAnsiChar):Phostent;cdecl;external {'tcpip'} name 'NWgethostbyname';
  200. function NWgethostbyaddr(nwsktctx:Pnwsockent; addr:PAnsiChar; length:longint; _type:longint):Phostent;cdecl;external {'tcpip'} name 'NWgethostbyaddr';
  201. function NWgethostbyaddr(var nwsktctx:Tnwsockent; addr:PAnsiChar; length:longint; _type:longint):Phostent;cdecl;external {'tcpip'} name 'NWgethostbyaddr';
  202. function NWgethostent(nwsktctx:Pnwsockent):Phostent;cdecl;external {'tcpip'} name 'NWgethostent';
  203. function NWgethostent(var nwsktctx:Tnwsockent):Phostent;cdecl;external {'tcpip'} name 'NWgethostent';
  204. procedure NWsethostent(nwsktctx:Pnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NWsethostent';
  205. procedure NWsethostent(var nwsktctx:Tnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NWsethostent';
  206. procedure NWendhostent(nwsktctx:Pnwsockent);cdecl;external {'tcpip'} name 'NWendhostent';
  207. procedure NWendhostent(var nwsktctx:Tnwsockent);cdecl;external {'tcpip'} name 'NWendhostent';
  208. { Internet Name Service routines }
  209. {
  210. NetDBgethostbyname() -- returns the host entry (struct hostent ) given
  211. the name of a host.
  212. The local file sys:/etc/hosts is consulted first to see if the entry
  213. exists there. If so, then that is returned. If not, then if DNS is
  214. installed on the machine, it will be consulted to perform the lookup.
  215. If the host still is not found, then NIS will be consulted if at all
  216. possible.
  217. This function returns NULL when an error occurs. The integer
  218. nwsktent->nse_h_errno can be checked to determine the nature of the
  219. error.
  220. The integer nwsktent->nse_h_errno can have the following values:
  221. HOST_NOT_FOUND No such host exists.
  222. If the NetDBgethostbyname function succeeds, it will return a pointer
  223. to a structure of type struct hostent.
  224. Syntax:
  225. struct hostent NetDBgethostbyname(struct nwsockent nwsktent,
  226. AnsiChar name);
  227. nwskent: Points to a context block.
  228. name: Official name of the host.
  229. Returns:
  230. A pointer to the appropriate struct hostent if any that matches.
  231. NULL if no match found.
  232. }
  233. function NetDBgethostbyname(nwskent:Pnwsockent; name:PAnsiChar):Phostent;cdecl;external {'tcpip'} name 'NetDBgethostbyname';
  234. function NetDBgethostbyname(var nwskent:Tnwsockent; name:PAnsiChar):Phostent;cdecl;external {'tcpip'} name 'NetDBgethostbyname';
  235. {
  236. NetDBgethostbyaddr() -- returns the host entry (struct hostent ) given
  237. the address of a host.
  238. The local file sys:/etc/hosts is consulted first to see if the entry
  239. exists there. If so, then that is returned. If not, then if DNS is
  240. installed on the machine, it will be consulted to perform the lookup.
  241. If the host still is not found, then NIS will be consulted if at all
  242. possible.
  243. This function returns NULL when an error occurs. The integer
  244. nwsktent->nse_h_errno can be checked to determine the nature of the
  245. error.
  246. The integer nwsktent->nse_h_errno can have the following values:
  247. HOST_NOT_FOUND No such host exists.
  248. If the NetDBgethostbyaddr function succeeds, it will return a pointer
  249. to a structure of type struct hostent.
  250. Syntax:
  251. struct hostent NetDBgethostbyaddr(struct nwsockent nwskent,
  252. AnsiChar addr, int len, int type);
  253. nwsktent: (Input) Points to a context block.
  254. addr: (Input) Internet address of the host.
  255. len: (Input) Length of the Internet address, in bytes.
  256. type: (Input) Value corresponding to the type of Internet
  257. address. Currently, the type is always AF_INET.
  258. Returns:
  259. A pointer to the appropriate struct hostent if any that matches.
  260. NULL if no match found.
  261. }
  262. function NetDBgethostbyaddr(nwsktent:Pnwsockent; addr:PAnsiChar; len:longint; _type:longint):Phostent;cdecl;external {'tcpip'} name 'NetDBgethostbyaddr';
  263. function NetDBgethostbyaddr(var nwsktent:Tnwsockent; addr:PAnsiChar; len:longint; _type:longint):Phostent;cdecl;external {'tcpip'} name 'NetDBgethostbyaddr';
  264. {
  265. NetDBgethostent() -- returns the next sequential entry from the
  266. SYS:ETC/HOSTS file, opening the file it it is not already open. Once
  267. the local file is depleted, all of the NIS host entries will be
  268. retrieved until those are depleted.
  269. Note that there may be duplicate entries in the local and NIS databases.
  270. The caller should handle these appropriately.
  271. This function returns NULL when an error occurs. The integer
  272. nwsktent->nse_h_errno can be checked to determine the nature of the
  273. error.
  274. The integer nwsktent->nse_h_errno can have the following values:
  275. HOST_NOT_FOUND No more hosts exist in either SYS:ETC/HOSTS or
  276. NIS.
  277. Syntax:
  278. struct hostent NetDBgethostent(struct nwsockent nwsktent,
  279. short ploc);
  280. nwsktent: (Input) Points to a context block.
  281. ploc: (Output) If non-NULL, this short will indicate if this
  282. entry is from the local sys:etc/hosts file (NETDB_LOC_LOCAL)
  283. or from the NIS database (NETDB_LOC_NIS).
  284. Pass in NULL if you're not interested in this information.
  285. Returns:
  286. A pointer to the next host entry if the function is successful.
  287. NULL if no more entries or an error occurred.
  288. }
  289. function NetDBgethostent(nwsktent:Pnwsockent; ploc:Psmallint):Phostent;cdecl;external {'tcpip'} name 'NetDBgethostent';
  290. function NetDBgethostent(var nwsktent:Tnwsockent; ploc:Psmallint):Phostent;cdecl;external {'tcpip'} name 'NetDBgethostent';
  291. {
  292. NetDBsethostent() -- rewinds the SYS:ETC/HOSTS file if the file is
  293. already open. This call guarantees that the next call to
  294. NetDBgethostent() will return the FIRST record in the local hosts file,
  295. regardless of whether the LAST call returned an entry from the local
  296. file or from NIS.
  297. If the stayopen flag is set (nonzero), the SYS:ETC/HOSTS file is NOT
  298. closed after each call made to NetDBgethostbyname() or
  299. NetDBgethostbyaddr().
  300. Syntax:
  301. void NetDBsethostent(struct nwsockent nwsktent, int stayopen);
  302. nwsktent: (Input) Points to a context block.
  303. stayopen: (Input) If nonzero, causes SYS:ETC/HOSTS to remain open
  304. after a call to NetDBgethostbyname() or
  305. NetDBgethostbyaddr().
  306. Returns:
  307. Nothing.
  308. }
  309. procedure NetDBsethostent(nwsktent:Pnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NetDBsethostent';
  310. procedure NetDBsethostent(var nwsktent:Tnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NetDBsethostent';
  311. {
  312. NetDBendhostent() -- closes the SYS:ETC/HOSTS file. Also ends access
  313. to the NIS database. After this call, the next call to
  314. NetDBgethostent() will be from the beginning of the local file again.
  315. Syntax:
  316. void NetDBendhostent(struct nwsockent nwsktent);
  317. nwsktent: (Input) Points to a context block.
  318. Returns:
  319. Nothing.
  320. }
  321. procedure NetDBendhostent(nwsktent:Pnwsockent);cdecl;external {'tcpip'} name 'NetDBendhostent';
  322. procedure NetDBendhostent(var nwsktent:Tnwsockent);cdecl;external {'tcpip'} name 'NetDBendhostent';
  323. {
  324. NetDBgethostname() -- this gets the current machine's host name into the
  325. passed in buffer (if it is large enough).
  326. This will use the local hosts file if it exists, otherwise it will then
  327. try both DNS and NIS if available in order to get the official name of
  328. our own machine.
  329. Syntax:
  330. int NetDBgethostname(struct nwsockent nwsktent, AnsiChar name,
  331. int namelen);
  332. nwsktent: (Input) Points to a context block.
  333. name: (Output) Official name of the host.
  334. namelen: (Input) Specifies the size of the array pointed to by name.
  335. Returns:
  336. 0: The call succeeded.
  337. -1: The call failed.
  338. }
  339. function NetDBgethostname(nwsktent:Pnwsockent; name:PAnsiChar; namelen:longint):longint;cdecl;external {'tcpip'} name 'NetDBgethostname';
  340. function NetDBgethostname(var nwsktent:Tnwsockent; name:PAnsiChar; namelen:longint):longint;cdecl;external {'tcpip'} name 'NetDBgethostname';
  341. // Network file examination
  342. function NWgetnetbyname(nwsktctx:Pnwsockent; name:PAnsiChar):Pnetent;cdecl;external {'tcpip'} name 'NWgetnetbyname';
  343. function NWgetnetbyname(var nwsktctx:Tnwsockent; name:PAnsiChar):Pnetent;cdecl;external {'tcpip'} name 'NWgetnetbyname';
  344. function NWgetnetbyaddr(nwsktctx:Pnwsockent; net:longint; _type:longint):Pnetent;cdecl;external {'tcpip'} name 'NWgetnetbyaddr';
  345. function NWgetnetbyaddr(var nwsktctx:Tnwsockent; net:longint; _type:longint):Pnetent;cdecl;external {'tcpip'} name 'NWgetnetbyaddr';
  346. function NWgetnetent(nwsktctx:Pnwsockent):Pnetent;cdecl;external {'tcpip'} name 'NWgetnetent';
  347. function NWgetnetent(var nwsktctx:Tnwsockent):Pnetent;cdecl;external {'tcpip'} name 'NWgetnetent';
  348. procedure NWsetnetent(nwsktctx:Pnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NWsetnetent';
  349. procedure NWsetnetent(var nwsktctx:Tnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NWsetnetent';
  350. procedure NWendnetent(nwsktctx:Pnwsockent);cdecl;external {'tcpip'} name 'NWendnetent';
  351. procedure NWendnetent(var nwsktctx:Tnwsockent);cdecl;external {'tcpip'} name 'NWendnetent';
  352. // Service file examination
  353. function NWgetservbyname(nwsktctx:Pnwsockent; name:PAnsiChar; protocol:PAnsiChar):Pservent;cdecl;external {'tcpip'} name 'NWgetservbyname';
  354. function NWgetservbyname(var nwsktctx:Tnwsockent; name:PAnsiChar; protocol:PAnsiChar):Pservent;cdecl;external {'tcpip'} name 'NWgetservbyname';
  355. function NWgetservbyport(nwsktctx:Pnwsockent; port:longint; protocol:PAnsiChar):Pservent;cdecl;external {'tcpip'} name 'NWgetservbyport';
  356. function NWgetservbyport(var nwsktctx:Tnwsockent; port:longint; protocol:PAnsiChar):Pservent;cdecl;external {'tcpip'} name 'NWgetservbyport';
  357. function NWgetservent(nwsktctx:Pnwsockent):Pservent;cdecl;external {'tcpip'} name 'NWgetservent';
  358. function NWgetservent(var nwsktctx:Tnwsockent):Pservent;cdecl;external {'tcpip'} name 'NWgetservent';
  359. procedure NWsetservent(nwsktctx:Pnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NWsetservent';
  360. procedure NWsetservent(var nwsktctx:Tnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NWsetservent';
  361. procedure NWendservent(nwsktctx:Pnwsockent);cdecl;external {'tcpip'} name 'NWendservent';
  362. procedure NWendservent(var nwsktctx:Tnwsockent);cdecl;external {'tcpip'} name 'NWendservent';
  363. // Protocol file examination
  364. function NWgetprotobyname(nwsktctx:Pnwsockent; name:PAnsiChar):Pprotoent;cdecl;external {'tcpip'} name 'NWgetprotobyname';
  365. function NWgetprotobyname(var nwsktctx:Tnwsockent; name:PAnsiChar):Pprotoent;cdecl;external {'tcpip'} name 'NWgetprotobyname';
  366. function NWgetprotobynumber(nwsktctx:Pnwsockent; protocol:longint):Pprotoent;cdecl;external {'tcpip'} name 'NWgetprotobynumber';
  367. function NWgetprotobynumber(var nwsktctx:Tnwsockent; protocol:longint):Pprotoent;cdecl;external {'tcpip'} name 'NWgetprotobynumber';
  368. function NWgetprotoent(nwsktctx:Pnwsockent):Pprotoent;cdecl;external {'tcpip'} name 'NWgetprotoent';
  369. function NWgetprotoent(var nwsktctx:Tnwsockent):Pprotoent;cdecl;external {'tcpip'} name 'NWgetprotoent';
  370. procedure NWsetprotoent(nwsktctx:Pnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NWsetprotoent';
  371. procedure NWsetprotoent(var nwsktctx:Tnwsockent; stayopen:longint);cdecl;external {'tcpip'} name 'NWsetprotoent';
  372. procedure NWendprotoent(nwsktctx:Pnwsockent);cdecl;external {'tcpip'} name 'NWendprotoent';
  373. procedure NWendprotoent(var nwsktctx:Tnwsockent);cdecl;external {'tcpip'} name 'NWendprotoent';
  374. function gethostname(name:PAnsiChar; namelen:longint):longint;cdecl;external {'tcpip'} name 'gethostname';
  375. function gethostid:longint;cdecl;external {'tcpip'} name 'gethostid';
  376. {-tiuser.h---------------------------------------------------------------------}
  377. const
  378. EAGAIN = -(1);
  379. { Error values }
  380. TACCES = 1;
  381. TBADADDR = 2;
  382. TBADDATA = 3;
  383. TBADF = 4;
  384. TBADFLAG = 5;
  385. TBADOPT = 6;
  386. TBADSEQ = 7;
  387. TBUFOVFLW = 8;
  388. TFLOW = 9;
  389. TLOOK = 10;
  390. TNOADDR = 11;
  391. TNODATA = 12;
  392. TNOREL = 13;
  393. TNOTSUPPORT = 14;
  394. TOUTSTATE = 15;
  395. TSTATECHNG = 16;
  396. TSYSERR = 17;
  397. TNOUDERR = 18;
  398. TNODIS = 19;
  399. TNOSTRUCTYPE = 20;
  400. TBADNAME = 21;
  401. TBADQLEN = 22;
  402. TADDRBUSY = 23;
  403. { t_look events }
  404. _T_LISTEN = 1;
  405. _T_CONNECT = 2;
  406. _T_DATA = 3;
  407. _T_EXDATA = 4;
  408. _T_DISCONNECT = 5;
  409. _T_ORDREL = 6;
  410. _T_ERROR = 7;
  411. _T_UDERR = 8;
  412. _T_GODATA = 9;
  413. _T_GOEXDATA = 10;
  414. _T_EVENTS = 11;
  415. { Flag definitions }
  416. _T_EXPEDITED = $01;
  417. _T_MORE = $02;
  418. _T_NEGOTIATE = $04;
  419. _T_CHECK = $08;
  420. _T_DEFAULT = $10;
  421. _T_SUCCESS = $20;
  422. _T_FAILURE = $40;
  423. var t_errno : longint;cvar;external;
  424. type
  425. Pt_info = ^Tt_info;
  426. Tt_info = record
  427. addr : longint;
  428. options : longint;
  429. tsdu : longint;
  430. etsdu : longint;
  431. connect : longint;
  432. discon : longint;
  433. servtype : longint;
  434. end;
  435. { Service types }
  436. { Connection-mode service }
  437. const
  438. T_COTS = 1;
  439. { Connection service with orderly release }
  440. T_COTS_ORD = 2;
  441. { Connectionless-mode service }
  442. T_CLTS = 3;
  443. type
  444. Pnetbuf = ^Tnetbuf;
  445. Tnetbuf = record
  446. maxlen : dword;
  447. len : dword;
  448. buf : PAnsiChar;
  449. end;
  450. Pt_bind = ^Tt_bind;
  451. Tt_bind = record
  452. addr : Tnetbuf;
  453. qlen : dword;
  454. end;
  455. Pt_optmgmt = ^Tt_optmgmt;
  456. Tt_optmgmt = record
  457. opt : Tnetbuf;
  458. flags : longint;
  459. end;
  460. Pt_discon = ^Tt_discon;
  461. Tt_discon = record
  462. udata : Tnetbuf;
  463. reason : longint;
  464. sequence : longint;
  465. end;
  466. Pt_call = ^Tt_call;
  467. Tt_call = record
  468. addr : Tnetbuf;
  469. opt : Tnetbuf;
  470. udata : Tnetbuf;
  471. sequence : longint;
  472. end;
  473. Pt_unitdata = ^Tt_unitdata;
  474. Tt_unitdata = record
  475. addr : Tnetbuf;
  476. opt : Tnetbuf;
  477. udata : Tnetbuf;
  478. end;
  479. Pt_uderr = ^Tt_uderr;
  480. Tt_uderr = record
  481. addr : Tnetbuf;
  482. opt : Tnetbuf;
  483. error : longint;
  484. end;
  485. // t_alloc structure types, had to prefix with _ because some
  486. // names conflict with functions
  487. const
  488. _T_BIND = $1;
  489. _T_CALL = $2;
  490. _T_OPTMGMT = $4;
  491. _T_DIS = $8;
  492. _T_UNITDATA = $10;
  493. _T_UDERROR = $20;
  494. _T_INFO = $40;
  495. { XTI names for t_alloc structure types }
  496. _T_BIND_STR = _T_BIND;
  497. _T_OPTMGMT_STR = _T_OPTMGMT;
  498. _T_CALL_STR = _T_CALL;
  499. _T_DIS_STR = _T_DIS;
  500. _T_UNITDATA_STR = _T_UNITDATA;
  501. _T_UDERROR_STR = _T_UDERROR;
  502. _T_INFO_STR = _T_INFO;
  503. { t_alloc field identifiers }
  504. _T_ADDR = $1000;
  505. _T_OPT = $2000;
  506. _T_UDATA = $4000;
  507. _T_ALL = $8000;
  508. { State values }
  509. { added to match xti state tables }
  510. _T_UNINIT = 0;
  511. { unbound }
  512. _T_UNBND = 1;
  513. { idle }
  514. _T_IDLE = 2;
  515. { outgoing connection pending }
  516. _T_OUTCON = 3;
  517. { incoming connection pending }
  518. _T_INCON = 4;
  519. { data transfer }
  520. _T_DATAXFER = 5;
  521. { outgoing orderly release }
  522. _T_OUTREL = 6;
  523. { incoming orderly release }
  524. _T_INREL = 7;
  525. { general purpose defines }
  526. _T_YES = 1;
  527. _T_NO = 0;
  528. _T_UNUSED = -(1);
  529. _T_NULL = 0;
  530. _T_ABSREQ = $8000;
  531. var
  532. t_errlist : array of PAnsiChar;cvar;external;
  533. t_nerr : longint;cvar;external;
  534. {---------------------TCP specific Options-------------------------- }
  535. { TCP Precedence Levels }
  536. const
  537. _T_ROUTINE = 0;
  538. _T_PRIORITY = 1;
  539. _T_IMMEDIATE = 2;
  540. _T_FLASH = 3;
  541. _T_OVERRIDEFLASH = 4;
  542. _T_CRITIC_ECP = 5;
  543. _T_INETCONTROL = 6;
  544. _T_NETCONTROL = 7;
  545. type
  546. Psecoptions = ^Tsecoptions;
  547. Tsecoptions = record
  548. security : smallint;
  549. compartment : smallint;
  550. handling : smallint;
  551. tcc : longint;
  552. end;
  553. Ptcp_options = ^Ttcp_options;
  554. Ttcp_options = record
  555. precedence : smallint; // TCP options
  556. timeout : longint; // abort timeout
  557. max_seg_size : longint;
  558. secopt : Tsecoptions; // security options
  559. end;
  560. function t_accept(fd:longint; resfd:longint; call:Pt_call):longint;cdecl;external 'tli' name 't_accept';
  561. function t_alloc(fd:longint; struct_type:longint; fields:longint):PAnsiChar;cdecl;external 'tli' name 't_alloc';
  562. function t_bind(fd:longint; req:Pt_bind; ret:Pt_bind):longint;cdecl;external 'tli' name 't_bind';
  563. function t_blocking(fd:longint):longint;cdecl;external 'tli' name 't_blocking';
  564. function t_close(fd:longint):longint;cdecl;external 'tli' name 't_close';
  565. function t_connect(fd:longint; sndcall:Pt_call; rcvcall:Pt_call):longint;cdecl;external 'tli' name 't_connect';
  566. procedure t_error(errmsg:PAnsiChar);cdecl;external 'tli' name 't_error';
  567. function t_free(ptr:PAnsiChar; struct_type:longint):longint;cdecl;external 'tli' name 't_free';
  568. function t_getinfo(fd:longint; info:Pt_info):longint;cdecl;external 'tli' name 't_getinfo';
  569. function t_getstate(fd:longint):longint;cdecl;external 'tli' name 't_getstate';
  570. function t_listen(fd:longint; call:Pt_call):longint;cdecl;external 'tli' name 't_listen';
  571. function t_look(fd:longint):longint;cdecl;external 'tli' name 't_look';
  572. function t_nonblocking(fd:longint):longint;cdecl;external 'tli' name 't_nonblocking';
  573. function t_open(path:PAnsiChar; oflag:longint; info:Pt_info):longint;cdecl;external 'tli' name 't_open';
  574. function t_optmgmt(fd:longint; req:Pt_optmgmt; ret:Pt_optmgmt):longint;cdecl;external 'tli' name 't_optmgmt';
  575. function t_rcv(fd:longint; buf:PAnsiChar; nbytes:dword; flags:Plongint):longint;cdecl;external 'tli' name 't_rcv';
  576. function t_rcvconnect(fd:longint; call:Pt_call):longint;cdecl;external 'tli' name 't_rcvconnect';
  577. function t_rcvdis(fd:longint; discon:Pt_discon):longint;cdecl;external 'tli' name 't_rcvdis';
  578. function t_rcvrel(fd:longint):longint;cdecl;external 'tli' name 't_rcvrel';
  579. function t_rcvudata(fd:longint; unitdata:Pt_unitdata; flags:Plongint):longint;cdecl;external 'tli' name 't_rcvudata';
  580. function t_rcvuderr(fd:longint; uderr:Pt_uderr):longint;cdecl;external 'tli' name 't_rcvuderr';
  581. function t_snd(fd:longint; buf:PAnsiChar; nbytes:dword; flags:longint):longint;cdecl;external 'tli' name 't_snd';
  582. function t_snddis(fd:longint; call:Pt_call):longint;cdecl;external 'tli' name 't_snddis';
  583. function t_sndrel(fd:longint):longint;cdecl;external 'tli' name 't_sndrel';
  584. function t_sndudata(fd:longint; unitdata:Pt_unitdata):longint;cdecl;external 'tli' name 't_sndudata';
  585. function t_sync(fd:longint):longint;cdecl;external 'tli' name 't_sync';
  586. function t_unbind(fd:longint):longint;cdecl;external 'tli' name 't_unbind';
  587. // havent found the declaration for __get_t_errno_ptr, hope that is correct:
  588. function __get_t_errno_ptr:plongint; cdecl;external 'clib' name '__get_t_errno_ptr';
  589. function t_error : longint;
  590. {-ositli.h---------------------------------------------------------------------}
  591. const
  592. TPDR_NORMAL = 128 + 0;
  593. TPDR_CRCONG = 128 + 1;
  594. TPDR_CONNEG = 128 + 2;
  595. TPDR_DUPSR = 128 + 3;
  596. TPDR_MMREF = 128 + 4;
  597. TPDR_PE = 128 + 5;
  598. TPDR_REOVFL = 128 + 7;
  599. TPDR_NWREF = 128 + 8;
  600. TPDR_INVHD = 128 + 10;
  601. TPDR_RNS = 0;
  602. TPDR_CONG = 1;
  603. TPDR_NOSESS = 2;
  604. TPDR_UNKADDR = 3; // Address unknown
  605. // Options management pre-defined values.
  606. T_YES = 1;
  607. T_NO = 0;
  608. T_UNUSED = -(1);
  609. T_NULL = 0;
  610. T_ABSREQ = $8000;
  611. T_PRIDFLT = 4;
  612. T_PRILOW = 3;
  613. T_PRIMID = 2;
  614. T_PRIHIGH = 1;
  615. T_PRITOP = 0;
  616. T_NOPROTECT = 1;
  617. T_PASSIVEPROTECT = 2;
  618. T_ACTIVEPROTECT = 4;
  619. T_LTPDUDFLT = 2048;
  620. T_CLASS0 = 0;
  621. T_CLASS1 = 1;
  622. T_CLASS2 = 2;
  623. T_CLASS3 = 3;
  624. T_CLASS4 = 4;
  625. // Options Management structures.
  626. type
  627. Prate = ^Trate;
  628. Trate = record
  629. targetvalue : longint; // target value
  630. minacceptvalue : longint; // minimum acceptable value
  631. end;
  632. Preqvalue = ^Treqvalue;
  633. Treqvalue = record
  634. called : Trate; // called rate
  635. calling : Trate; // calling rate
  636. end;
  637. Pthrpt = ^Tthrpt;
  638. Tthrpt = record
  639. maxthrpt : Treqvalue; // maximum throughput
  640. avgthrpt : Treqvalue; // average throughput
  641. end;
  642. Pmanagement = ^Tmanagement;
  643. Tmanagement = record
  644. dflt : smallint;
  645. ltpdu : longint;
  646. reastime : smallint;
  647. _class : AnsiChar;
  648. altclass : AnsiChar;
  649. extform : AnsiChar;
  650. flowctrl : AnsiChar;
  651. checksum : AnsiChar;
  652. netexp : AnsiChar;
  653. netrecptcf: AnsiChar;
  654. end;
  655. // Connection oriented options.
  656. Pisoco_options = ^Tisoco_options;
  657. Tisoco_options = record
  658. throughput : Tthrpt;
  659. transdel : Treqvalue;
  660. reserrorrate : Trate;
  661. transffailprob : Trate;
  662. estfailprob : Trate;
  663. relfailprob : Trate;
  664. estdelay : Trate;
  665. reldelay : Trate;
  666. connresil : Tnetbuf;
  667. protection : word;
  668. priority : smallint;
  669. mngmt : Tmanagement; // management parameters
  670. expd : AnsiChar; // expedited data: T_YES or T_NO
  671. end;
  672. // Connectionless options.
  673. Pisocl_options = ^Tisocl_options;
  674. Tisocl_options = record
  675. transdel : Trate; // transit delay
  676. reserrorrate : Trate; // residual error rate
  677. protection : word;
  678. priority : smallint;
  679. end;
  680. // Novell connectionless options.
  681. Pnovell_isocl_options = ^Tnovell_isocl_options;
  682. Tnovell_isocl_options = record
  683. transdel : Trate; // transit delay
  684. reserrorrate : Trate; // residual error rate
  685. protection : word;
  686. priority : smallint;
  687. checksum : longint;
  688. end;
  689. {-param.h----------------------------------------------------------------------}
  690. const
  691. HZ = 18;
  692. NULL = 0;
  693. PZERO = 20;
  694. PCATCH = $8000;
  695. {-poll.h-----------------------------------------------------------------------}
  696. const
  697. NPOLLFILE = 65535;
  698. POLLIN = 1;
  699. POLLPRI = 2;
  700. POLLOUT = 4;
  701. POLLERR = 10;
  702. POLLHUP = 20;
  703. POLLNVAL = 40;
  704. { array of streams to poll }
  705. { Internal "fd" for the benefit of the kernel }
  706. type
  707. Ppollfd = ^Tpollfd;
  708. Tpollfd = record
  709. fd : longint;
  710. events : smallint;
  711. revents : smallint;
  712. _ifd : longint;
  713. end;
  714. { I_POLL structure for ioctl on non-5.3 systems }
  715. Pstrpoll = ^Tstrpoll;
  716. Tstrpoll = record
  717. nfds : dword;
  718. pollfdp : Ppollfd;
  719. timeout : longint;
  720. end;
  721. function poll(const fds:array of Tpollfd; nfds:dword; timeout:longint):longint;cdecl;external 'clib' name 'poll';
  722. {-proc.h-----------------------------------------------------------------------}
  723. type
  724. Pproc = ^Tproc;
  725. Tproc = record
  726. p_pid : smallint;
  727. p_pgrp : smallint;
  728. end;
  729. {-strlog.h---------------------------------------------------------------------}
  730. const
  731. SL_FATAL = $1;
  732. SL_NOTIFY = $2;
  733. SL_ERROR = $4;
  734. SL_TRACE = $8;
  735. I_TRCLOG = 1;
  736. I_ERRLOG = 2;
  737. LOGMSGSZ = 128;
  738. type
  739. Plog_ctl = ^Tlog_ctl;
  740. Tlog_ctl = record
  741. mid : smallint;
  742. sid : smallint;
  743. level : AnsiChar;
  744. flags : smallint;
  745. ltime : longint;
  746. ttime : longint;
  747. seq_no: longint;
  748. end;
  749. Ptrace_ids = ^Ttrace_ids;
  750. Ttrace_ids = record
  751. ti_mid : smallint;
  752. ti_sid : smallint;
  753. ti_level : AnsiChar;
  754. ti_flags : smallint;
  755. end;
  756. {-strstat.h--------------------------------------------------------------------}
  757. type
  758. Pmodule_stat = ^Tmodule_stat;
  759. Tmodule_stat = record
  760. ms_pcnt : longint;
  761. ms_scnt : longint;
  762. ms_ocnt : longint;
  763. ms_ccnt : longint;
  764. ms_acnt : longint;
  765. ms_xptr : PAnsiChar;
  766. ms_xsize: smallint;
  767. end;
  768. {-user.h-----------------------------------------------------------------------}
  769. type
  770. Puser = ^Tuser;
  771. Tuser = record
  772. u_error : longint;
  773. u_uid : longint;
  774. u_gid : longint;
  775. u_ruid : longint;
  776. u_rgid : longint;
  777. u_ttyp : Psmallint;
  778. u_procp : Pproc;
  779. end;
  780. {-stream.h---------------------------------------------------------------------}
  781. type
  782. Pmodule_info = ^Tmodule_info;
  783. Tmodule_info = record
  784. mi_idnum : word;
  785. mi_idname : PAnsiChar;
  786. mi_minpsz : smallint;
  787. mi_maxpsz : smallint;
  788. mi_hiwat : smallint;
  789. mi_lowat : smallint;
  790. end;
  791. Pqinit = ^Tqinit;
  792. Tqinit = record
  793. qi_putp : function :longint;cdecl;
  794. qi_srvp : function :longint;
  795. qi_qopen : function :longint;
  796. qi_qclose : function :longint;
  797. qi_qadmin : function :longint;
  798. qi_minfo : Pmodule_info;
  799. qi_mstat : Pmodule_stat;
  800. end;
  801. Pdatab = ^Tdatab;
  802. Tdatab = record
  803. db_freep : Pdatab;
  804. db_base : Pbyte;
  805. db_lim : Pbyte;
  806. db_ref : byte;
  807. db_type : byte;
  808. db_class : byte;
  809. db_pad : array[0..0] of byte;
  810. end;
  811. Tdblk_t = Tdatab;
  812. type
  813. Pmsgb = ^Tmsgb;
  814. Tmsgb = record
  815. b_next : Pmsgb; // next message on queue
  816. b_prev : Pmsgb; // previous message on queue
  817. b_cont : Pmsgb; // next message block of message
  818. b_rptr : PAnsiChar; // first unread data byte in buffer
  819. b_wptr : PAnsiChar; // first unwritten data byte
  820. b_datap : Pdatab; // data block
  821. end;
  822. Tmblk_t = Tmsgb;
  823. Pmblk_t = Pmsgb;
  824. Pq_xtra = pointer; // dont know where this is defined
  825. Pqueue = ^Tqueue;
  826. Tqueue = record
  827. q_qinfo : Pqinit;
  828. q_first : Pmsgb;
  829. q_last : Pmsgb;
  830. q_next : Pqueue;
  831. q_link : Pqueue;
  832. q_ptr : PAnsiChar;
  833. q_count : byte; //ushort;
  834. q_flag : byte; // ushort;
  835. q_minpsz: smallint;
  836. q_maxpsz: smallint;
  837. q_hiwat : byte; // ushort;
  838. q_lowat : byte; // ushort;
  839. q_osx : Pq_xtra;
  840. q_ffcp : Pqueue;
  841. q_bfcp : Pqueue;
  842. end;
  843. Tqueue_t = Tqueue;
  844. Pqueue_t = Pqueue;
  845. { Q state defines }
  846. const
  847. F_Q_IS_WRITE_Q = $1;
  848. F_Q_DISABLED = $2;
  849. F_Q_FULL = $4;
  850. F_Q_TO_SCHEDULE = $8;
  851. F_Q_PUT_STOPPED = $10;
  852. F_Q_WELDED = $20;
  853. F_Q_SEQUENT_SYNCH = $40;
  854. { Q state defines for 5.4 compatibility }
  855. QREADR = $80;
  856. QFULL = F_Q_FULL;
  857. QENAB = F_Q_TO_SCHEDULE;
  858. { Used in M_IOCTL mblks to muxes (ioc_cmd I_LINK) }
  859. { lowest level write queue of upper stream }
  860. { highest level write queue of lower stream }
  861. { system-unique index for lower stream }
  862. type
  863. Plinkblk = ^Tlinkblk;
  864. Tlinkblk = record
  865. l_qtop : Pqueue_t;
  866. l_qbot : Pqueue_t;
  867. l_index : longint;
  868. end;
  869. { Message types }
  870. const
  871. QNORM = 0;
  872. { Ordinary data }
  873. M_DATA = 0;
  874. { Internal control info and data }
  875. M_PROTO = 1;
  876. { Request a driver to send a break }
  877. M_BREAK = 010;
  878. { Used to pass a file pointer }
  879. M_PASSFP = 011;
  880. { Requests a signal to be sent }
  881. M_SIG = 013;
  882. { Request a real-time delay }
  883. M_DELAY = 014;
  884. { For inter-module communication }
  885. M_CTL = 015;
  886. { Used internally for I_STR requests }
  887. M_IOCTL = 016;
  888. { Alters characteristics of stream head }
  889. M_SETOPTS = 020;
  890. { Priority messages types }
  891. QPCTL = 0200;
  892. { Positive ack of previous M_IOCTL }
  893. M_IOCACK = 0201;
  894. { Previous M_IOCTL failed }
  895. M_IOCNAK = 0202;
  896. { Same as M_PROTO except for priority }
  897. M_PCPROTO = 0203;
  898. { Priority signal }
  899. M_PCSIG = 0204;
  900. { Requests modules to flush queues }
  901. M_FLUSH = 0206;
  902. { Request drivers to stop output }
  903. M_STOP = 0207;
  904. { Request drivers to start output }
  905. M_START = 0210;
  906. { Driver can no longer produce data }
  907. M_HANGUP = 0211;
  908. { Reports downstream error condition }
  909. M_ERROR = 0212;
  910. { Reports client read at stream head }
  911. M_READ = 0213;
  912. { PSE-private type; high priority data }
  913. M_HPDATA = 0214;
  914. FLUSHALL = 1;
  915. FLUSHDATA = 0;
  916. type
  917. Piocblk = ^Tiocblk;
  918. Tiocblk = record
  919. ioc_cmd : longint;
  920. ioc_uid : word;
  921. ioc_gid : word;
  922. ioc_id : dword;
  923. ioc_count : dword;
  924. ioc_error : longint;
  925. ioc_rval : longint;
  926. end;
  927. Pstrpfp = ^Tstrpfp;
  928. Tstrpfp = record
  929. pass_file_cookie : dword;
  930. pass_uid : word;
  931. pass_gid : word;
  932. pass_sth : pointer;
  933. end;
  934. Pstroptions = ^Tstroptions;
  935. Tstroptions = record
  936. so_flags : smallint;
  937. so_readopt : smallint;
  938. so_wroff : word;
  939. so_minpsz : smallint;
  940. so_maxpsz : smallint;
  941. so_hiwat : word;
  942. so_lowat : word;
  943. end;
  944. const
  945. SO_ALL = 0377;
  946. SO_READOPT = 01;
  947. SO_WROFF = 02;
  948. SO_MINPSZ = 04;
  949. SO_MAXPSZ = 010;
  950. SO_HIWAT = 020;
  951. SO_LOWAT = 040;
  952. SO_MREADON = 0100;
  953. SO_MREADOFF = 0200;
  954. BPRI_LO = 1;
  955. BPRI_MED = 2;
  956. BPRI_HI = 3;
  957. INFPSZ = -(1);
  958. const
  959. MAXMSGSIZE = 4096;
  960. OPENFAIL = -(1);
  961. CLONEOPEN = $2;
  962. MODOPEN = $1;
  963. NSTREVENT = 40;
  964. STRMSGSZ = MAXMSGSIZE;
  965. STRCTLSZ = 1024;
  966. STRLOFRAC = 80;
  967. STRMEDFRAC = 90;
  968. MAXBSIZE = MAXMSGSIZE;
  969. type TFuncLongCdecl = function : longint; cdecl;
  970. function allocb(size:longint; pri:longint):Pmblk_t;cdecl;external 'streams' name 'allocb';
  971. function allocq:Pqueue_t;cdecl;external 'streams' name 'allocq';
  972. function adjmsg(mp:Pmblk_t; len_param:longint):longint;cdecl;external 'streams' name 'adjmsg';
  973. function backq(q:Pqueue_t):Pqueue_t;cdecl;external 'streams' name 'backq';
  974. function bufcall(size:longint; pri:longint; func:TFuncLongCdecl; arg:longint):longint;cdecl;external 'streams' name 'bufcall';
  975. procedure bcopy(src:PAnsiChar; dst:PAnsiChar; len:longint);cdecl;external 'streams' name 'bcopy';
  976. procedure bzero(buffer:PAnsiChar; nbytes:longint);cdecl;external 'streams' name 'bzero';
  977. function canput(q:Pqueue_t):longint;cdecl;external 'streams' name 'canput';
  978. function copyb(mp:Pmblk_t):Pmblk_t;cdecl;external 'streams' name 'copyb';
  979. function copymsg(mp:Pmblk_t):Pmblk_t;cdecl;external 'streams' name 'copymsg';
  980. function dupb(bp:Pmblk_t):Pmblk_t;cdecl;external 'streams' name 'dupb';
  981. function dupmsg(mp:Pmblk_t):Pmblk_t;cdecl;external 'streams' name 'dupmsg';
  982. function flushq(q:Pqueue_t; flag:longint):longint;cdecl;external 'streams' name 'flushq';
  983. function freeb(bp:Pmblk_t):longint;cdecl;external 'streams' name 'freeb';
  984. function freemsg(mp:Pmblk_t):longint;cdecl;external 'streams' name 'freemsg';
  985. function freeq(q:Pqueue_t):longint;cdecl;external 'streams' name 'freeq';
  986. function getq(q:Pqueue_t):Pmblk_t;cdecl;external 'streams' name 'getq';
  987. function insq(q:Pqueue_t; emp:Pmblk_t; nmp:Pmblk_t):longint;cdecl;external 'streams' name 'insq';
  988. function linkb(mp1:Pmblk_t; mp2:Pmblk_t):longint;cdecl;external 'streams' name 'linkb';
  989. function msgdsize(mp:Pmblk_t):longint;cdecl;external 'streams' name 'msgdsize';
  990. function pullupmsg(mp:Pmblk_t; len:longint):longint;cdecl;external 'streams' name 'pullupmsg';
  991. function putbq(q:Pqueue_t; mp:Pmblk_t):longint;cdecl;external 'streams' name 'putbq';
  992. function putctl(q:Pqueue_t; _type:longint):longint;cdecl;external 'streams' name 'putctl';
  993. function putctl1(q:Pqueue_t; _type:longint; c:longint):longint;cdecl;external 'streams' name 'putctl1';
  994. function putq(q:Pqueue_t; mp:Pmblk_t):longint;cdecl;external 'streams' name 'putq';
  995. function qenable(q:Pqueue_t):longint;cdecl;external 'streams' name 'qenable';
  996. function qreply(q:Pqueue_t; mp:Pmblk_t):longint;cdecl;external 'streams' name 'qreply';
  997. function qsize(q:Pqueue_t):longint;cdecl;external 'streams' name 'qsize';
  998. function rmvb(mp:Pmblk_t; bp:Pmblk_t):Pmblk_t;cdecl;external 'streams' name 'rmvb';
  999. function rmvq(q:Pqueue_t; mp:Pmblk_t):longint;cdecl;external 'streams' name 'rmvq';
  1000. function strlog(sid:smallint; mid:smallint; level:AnsiChar; aflags:smallint; args:array of const):longint;cdecl;external 'streams' name 'strlog';
  1001. function strlog(sid:smallint; mid:smallint; level:AnsiChar; aflags:smallint):longint;cdecl;external 'streams' name 'strlog';
  1002. function testb(size:longint; pri:longint):longint;cdecl;external 'streams' name 'testb';
  1003. function timeout(func:TFuncLongCdecl; arg:pointer; ticks:longint):longint;cdecl;external 'streams' name 'timeout';
  1004. function unlinkb(mp:Pmblk_t):Pmblk_t;cdecl;external 'streams' name 'unlinkb';
  1005. function unbufcall(id:longint):longint;cdecl;external 'streams' name 'unbufcall';
  1006. {-tispxipx.h-------------------------------------------------------------------}
  1007. type
  1008. Pipxaddr_s = ^Tipxaddr_s;
  1009. Tipxaddr_s = record
  1010. ipxa_net : array[0..3] of byte;
  1011. ipxa_node : array[0..5] of byte;
  1012. ipxa_socket : array[0..1] of byte;
  1013. end;
  1014. TIPX_ADDR = Tipxaddr_s;
  1015. PIPX_ADDR = ^TIPX_ADDR;
  1016. Pipxopt_s = ^Tipxopt_s;
  1017. Tipxopt_s = record
  1018. ipx_type : byte;
  1019. ipx_pad1 : array[0..2] of byte;
  1020. ipx_hops : byte;
  1021. ipx_pad2 : array[0..2] of byte;
  1022. end;
  1023. TIPX_OPTS = Tipxopt_s;
  1024. PIPX_OPTS = ^TIPX_OPTS;
  1025. Pspxopt_s = ^Tspxopt_s;
  1026. Tspxopt_s = record
  1027. spx_connectionID : array[0..1] of byte;
  1028. spx_allocationNumber : array[0..1] of byte;
  1029. spx_pad1 : array[0..3] of byte;
  1030. end;
  1031. TSPX_OPTS = Tspxopt_s;
  1032. PSPX_OPTS = ^TSPX_OPTS;
  1033. Pspx_optmgmt = ^Tspx_optmgmt;
  1034. Tspx_optmgmt = record
  1035. spxo_retry_count : byte;
  1036. spxo_watchdog_flag : byte;
  1037. spxo_min_retry_delay : dword;
  1038. spxo_pad2 : array[0..1] of byte;
  1039. end;
  1040. const
  1041. OPTIONS_VERSION = 1;
  1042. function OPTIONS_SIZE : longint;
  1043. type
  1044. Pspx2_options = ^Tspx2_options;
  1045. Tspx2_options = record
  1046. versionNumber : dword;
  1047. spxIIOptionNegotiate : dword;
  1048. spxIIRetryCount : dword;
  1049. spxIIMinimumRetryDelay : dword;
  1050. spxIIMaximumRetryDelta : dword;
  1051. spxIIWatchdogTimeout : dword;
  1052. spxIIConnectTimeout : dword;
  1053. spxIILocalWindowSize : dword;
  1054. spxIIRemoteWindowSize : dword;
  1055. spxIIConnectionID : dword;
  1056. spxIIInboundPacketSize : dword;
  1057. spxIIOutboundPacketSize: dword;
  1058. spxIISessionFlags : dword;
  1059. end;
  1060. const
  1061. SPX_WATCHDOG_OFF = 0;
  1062. SPX_WATCHDOG_ON = not (SPX_WATCHDOG_OFF);
  1063. SPX_WATCHDOG_DEFAULT = SPX_WATCHDOG_ON;
  1064. SPX_RETRY_MIN = 3;
  1065. SPX_RETRY_MAX = 50;
  1066. SPX_RETRY_DEFAULT = 10;
  1067. SPX_WATCHDOG_TIMEOUT_MIN = 3000;
  1068. SPX_WATCHDOG_TIMEOUT_MAX = 300000;
  1069. SPX_WATCHDOG_TIMEOUT_DEFAULT = 60000;
  1070. SPX_MIN_RETRY_DELAY_MIN = 1;
  1071. SPX_MIN_RETRY_DELAY_MAX = 60000;
  1072. SPX_MIN_RETRY_DELAY_DEFAULT = 0;
  1073. SPX_MAX_RETRY_DELTA_MIN = 1000;
  1074. SPX_MAX_RETRY_DELTA_MAX = 60000;
  1075. SPX_MAX_RETRY_DELTA_DEFAULT = 5000;
  1076. SPX_OPTION_NEGOTIATE_OFF = 0;
  1077. SPX_OPTION_NEGOTIATE_ON = not (SPX_OPTION_NEGOTIATE_OFF);
  1078. SPX_OPTION_NEGOTIATE_DEFAULT = SPX_OPTION_NEGOTIATE_ON;
  1079. SPX_CONNECT_TIMEOUT_MIN = 1000;
  1080. SPX_CONNECT_TIMEOUT_MAX = 120000;
  1081. SPX_CONNECT_TIMEOUT_DEFAULT = 0;
  1082. SPX_LOCAL_WINDOW_SIZE_MIN = 1;
  1083. SPX_LOCAL_WINDOW_SIZE_MAX = 8;
  1084. SPX_LOCAL_WINDOW_SIZE_DEFAULT = 0;
  1085. SPX2_SF_NONE = $00;
  1086. SPX2_SF_IPX_CHECKSUM = $01;
  1087. SPX2_SF_SPX2_SESSION = $02;
  1088. TLI_SPX_CONNECTION_FAILED = $ed;
  1089. TLI_SPX_CONNECTION_TERMINATED = $ec;
  1090. TLI_SPX_MALFORMED_PACKET = $fe;
  1091. TLI_SPX_PACKET_OVERFLOW = $fd;
  1092. TLI_SPX_UNREACHABLE_DEST = $70;
  1093. TLI_IPX_MALFORMED_ADDRESS = $fe;
  1094. TLI_IPX_PACKET_OVERFLOW = $fd;
  1095. {-in.pp------------------------------------------------------------------------}
  1096. const
  1097. IPPROTO_IP = 0;
  1098. IPPROTO_ICMP = 1;
  1099. IPPROTO_IGMP = 2;
  1100. IPPROTO_GGP = 3;
  1101. IPPROTO_TCP = 6;
  1102. IPPROTO_EGP = 8;
  1103. IPPROTO_PUP = 12;
  1104. IPPROTO_UDP = 17;
  1105. IPPROTO_IDP = 22;
  1106. IPPROTO_ND = 77;
  1107. IPPROTO_RAW = 255;
  1108. IPPROTO_MAX = 256;
  1109. // Port/socket numbers: network standard functions
  1110. IPPORT_ECHO = 7;
  1111. IPPORT_DISCARD = 9;
  1112. IPPORT_SYSTAT = 11;
  1113. IPPORT_DAYTIME = 13;
  1114. IPPORT_NETSTAT = 15;
  1115. IPPORT_FTP = 21;
  1116. IPPORT_TELNET = 23;
  1117. IPPORT_SMTP = 25;
  1118. IPPORT_TIMESERVER = 37;
  1119. IPPORT_NAMESERVER = 42;
  1120. IPPORT_WHOIS = 43;
  1121. IPPORT_MTP = 57;
  1122. // Port/socket numbers: host specific functions
  1123. IPPORT_TFTP = 69;
  1124. IPPORT_RJE = 77;
  1125. IPPORT_FINGER = 79;
  1126. IPPORT_TTYLINK = 87;
  1127. IPPORT_SUPDUP = 95;
  1128. // UNIX TCP sockets
  1129. IPPORT_EXECSERVER = 512;
  1130. IPPORT_LOGINSERVER = 513;
  1131. IPPORT_CMDSERVER = 514;
  1132. IPPORT_EFSSERVER = 520;
  1133. // UNIX UDP sockets
  1134. IPPORT_BIFFUDP = 512;
  1135. IPPORT_WHOSERVER = 513;
  1136. { 520+1 also used }
  1137. IPPORT_ROUTESERVER = 520;
  1138. IPPORT_RESERVED = 1024;
  1139. IPPORT_USERRESERVED = 5000;
  1140. type
  1141. Pin_addr = ^Tin_addr;
  1142. Tin_addr = record
  1143. s_addr : dword;
  1144. end;
  1145. const
  1146. IN_CLASSA_NET = $ff000000;
  1147. IN_CLASSA_NSHIFT = 24;
  1148. IN_CLASSA_HOST = $00ffffff;
  1149. IN_CLASSA_MAX = 128;
  1150. IN_CLASSB_NET = $ffff0000;
  1151. IN_CLASSB_NSHIFT = 16;
  1152. IN_CLASSB_HOST = $0000ffff;
  1153. IN_CLASSB_MAX = 65536;
  1154. IN_CLASSC_NET = $ffffff00;
  1155. IN_CLASSC_NSHIFT = 8;
  1156. IN_CLASSC_HOST = $000000ff;
  1157. IN_LOOPBACKNET = 127;
  1158. // var sin_port : word;cvar;public;
  1159. // sin_zero : array[0..7] of AnsiChar;cvar;public;
  1160. const
  1161. IP_OPTIONS = 1;
  1162. function ntohs(value:word):word;cdecl;external {'tcpip'} name 'ntohs';
  1163. function htons(value:word):word;cdecl;external {'tcpip'} name 'htons';
  1164. function ntohl(value:dword):dword;cdecl;external {'tcpip'} name 'ntohl';
  1165. function htonl(value:dword):dword;cdecl;external {'tcpip'} name 'htonl';
  1166. {------------------------------------------------------------------------------}
  1167. implementation
  1168. function t_error : longint;
  1169. begin
  1170. t_error := __get_t_errno_ptr^;
  1171. end;
  1172. function OPTIONS_SIZE : longint;
  1173. begin
  1174. OPTIONS_SIZE:=13 * (sizeof(longint));
  1175. end;
  1176. end.