nwprot.pp 46 KB

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