OpenTransportProviders.pas 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853
  1. {
  2. File: OT/OpenTransportProviders.h
  3. Contains: This file contains provider-specific definitions for various built-in providers.
  4. Version: OpenTransport-97~544
  5. Copyright: © 1993-2005 by Apple Computer, Inc. and Mentat Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, November 2005 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit OpenTransportProviders;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,OpenTransport;
  92. {$ALIGN MAC68K}
  93. {
  94. All OpenTransport Manager APIs are deprecated in MacOSX 10.4, instead of using OpenTransport,
  95. consider using CFNetwork or socket library.
  96. }
  97. { ***** TCP/IP *****}
  98. { Basic types}
  99. type
  100. InetPort = UInt16;
  101. InetHost = UInt32;
  102. { Enums used as address type designations.}
  103. const
  104. AF_INET = 2;
  105. const
  106. AF_DNS = 42;
  107. {
  108. Enum which can be used to bind to all IP interfaces
  109. rather than a specific one.
  110. }
  111. const
  112. kOTAnyInetAddress = 0; { Wildcard }
  113. {
  114. Define the InetSvcRef type. This type needs special
  115. processing because in C++ it's a subclass of TProvider.
  116. See the definition of TEndpointRef in "OpenTransport.h"
  117. for the logic behind this definition.
  118. }
  119. type
  120. InetSvcRef = ProviderRef; { an opaque 32-bit type }
  121. InetSvcRefPtr = ^InetSvcRef;
  122. const
  123. kDefaultInternetServicesPath = -3;
  124. { Shared library prefixes}
  125. const
  126. kInetVersion = '3.1.1';
  127. const
  128. kInetPrefix = 'ot:inet$';
  129. { Module Names}
  130. const
  131. kDNRName = 'dnr';
  132. const
  133. kTCPName = 'tcp';
  134. const
  135. kUDPName = 'udp';
  136. const
  137. kRawIPName = 'rawip';
  138. { XTI Options}
  139. { Protocol levels}
  140. const
  141. INET_IP = $00;
  142. INET_TCP = $06;
  143. INET_UDP = $11;
  144. { TCP Level Options}
  145. const
  146. TCP_NODELAY = $01;
  147. TCP_MAXSEG = $02;
  148. TCP_NOTIFY_THRESHOLD = $10; {* not a real XTI option }
  149. TCP_ABORT_THRESHOLD = $11; {* not a real XTI option }
  150. TCP_CONN_NOTIFY_THRESHOLD = $12; {* not a real XTI option }
  151. TCP_CONN_ABORT_THRESHOLD = $13; {* not a real XTI option }
  152. TCP_OOBINLINE = $14; {* not a real XTI option }
  153. TCP_URGENT_PTR_TYPE = $15; {* not a real XTI option }
  154. TCP_KEEPALIVE = $0008; { keepalive defined in OpenTransport.h }
  155. const
  156. T_GARBAGE = 2;
  157. { UDP Level Options}
  158. const
  159. UDP_CHECKSUM = $0600;
  160. UDP_RX_ICMP = $02;
  161. { IP Level Options}
  162. const
  163. kIP_OPTIONS = $01;
  164. kIP_TOS = $02;
  165. kIP_TTL = $03;
  166. kIP_REUSEADDR = $04;
  167. kIP_DONTROUTE = $10;
  168. kIP_BROADCAST = $20;
  169. kIP_REUSEPORT = $0200;
  170. kIP_HDRINCL = $1002;
  171. kIP_RCVOPTS = $1005;
  172. kIP_RCVDSTADDR = $1007;
  173. kIP_MULTICAST_IF = $1010; { set/get IP multicast interface }
  174. kIP_MULTICAST_TTL = $1011; { set/get IP multicast timetolive }
  175. kIP_MULTICAST_LOOP = $1012; { set/get IP multicast loopback }
  176. kIP_ADD_MEMBERSHIP = $1013; { add an IP group membership }
  177. kIP_DROP_MEMBERSHIP = $1014; { drop an IP group membership }
  178. kIP_BROADCAST_IFNAME = $1015; { Set interface for broadcasts }
  179. kIP_RCVIFADDR = $1016; { Set interface for broadcasts }
  180. const
  181. IP_OPTIONS = 1;
  182. {
  183. BSD's netinet/in.h uses different values for the same IP_ logical constants.
  184. If you are using OT and want those values, prefix your use with k
  185. e.g. change IP_TTL to kIP_TTL in your source code
  186. }
  187. const
  188. DVMRP_INIT = 100; { DVMRP-specific setsockopt commands, from ip_mroute.h}
  189. DVMRP_DONE = 101;
  190. DVMRP_ADD_VIF = 102;
  191. DVMRP_DEL_VIF = 103;
  192. DVMRP_ADD_LGRP = 104;
  193. DVMRP_DEL_LGRP = 105;
  194. DVMRP_ADD_MRT = 106;
  195. DVMRP_DEL_MRT = 107;
  196. { IP_TOS precdence levels}
  197. const
  198. T_ROUTINE = 0;
  199. T_PRIORITY = 1;
  200. T_IMMEDIATE = 2;
  201. T_FLASH = 3;
  202. T_OVERRIDEFLASH = 4;
  203. T_CRITIC_ECP = 5;
  204. T_INETCONTROL = 6;
  205. T_NETCONTROL = 7;
  206. { IP_TOS type of service}
  207. const
  208. T_NOTOS = $00;
  209. T_LDELAY = 1 shl 4;
  210. T_HITHRPT = 1 shl 3;
  211. T_HIREL = 1 shl 2;
  212. // #define SET_TOS(prec,tos) (((0x7 & (prec)) << 5) | (0x1c & (tos)))
  213. { IP Multicast option structures}
  214. type
  215. TIPAddMulticastPtr = ^TIPAddMulticast;
  216. TIPAddMulticast = record
  217. multicastGroupAddress: InetHost;
  218. interfaceAddress: InetHost;
  219. end;
  220. { Protocol-specific events}
  221. const
  222. T_DNRSTRINGTOADDRCOMPLETE = kPRIVATEEVENT + 1;
  223. T_DNRADDRTONAMECOMPLETE = kPRIVATEEVENT + 2;
  224. T_DNRSYSINFOCOMPLETE = kPRIVATEEVENT + 3;
  225. T_DNRMAILEXCHANGECOMPLETE = kPRIVATEEVENT + 4;
  226. T_DNRQUERYCOMPLETE = kPRIVATEEVENT + 5;
  227. { InetAddress}
  228. type
  229. InetAddressPtr = ^InetAddress;
  230. InetAddress = record
  231. fAddressType: OTAddressType; { always AF_INET}
  232. fPort: InetPort; { Port number }
  233. fHost: InetHost; { Host address in net byte order}
  234. fUnused: packed array [0..7] of UInt8; { Traditional unused bytes }
  235. end;
  236. { Domain Name Resolver (DNR) }
  237. const
  238. kMaxHostAddrs = 10;
  239. kMaxSysStringLen = 32;
  240. kMaxHostNameLen = 255;
  241. type
  242. InetDomainName = packed array [0..255] of char;
  243. InetHostInfoPtr = ^InetHostInfo;
  244. InetHostInfo = record
  245. name: InetDomainName;
  246. addrs: array [0..9] of InetHost;
  247. end;
  248. type
  249. InetSysInfoPtr = ^InetSysInfo;
  250. InetSysInfo = record
  251. cpuType: packed array [0..31] of char;
  252. osType: packed array [0..31] of char;
  253. end;
  254. type
  255. InetMailExchangePtr = ^InetMailExchange;
  256. InetMailExchange = record
  257. preference: UInt16;
  258. exchange: InetDomainName;
  259. end;
  260. type
  261. DNSQueryInfoPtr = ^DNSQueryInfo;
  262. DNSQueryInfo = record
  263. qType: UInt16;
  264. qClass: UInt16;
  265. ttl: UInt32;
  266. name: InetDomainName;
  267. responseType: UInt16; { answer, authority, or additional}
  268. resourceLen: UInt16; { actual length of array which follows}
  269. resourceData: packed array [0..3] of char; { size varies }
  270. end;
  271. { DNSAddress}
  272. {
  273. The DNSAddress format is optional and may be used in connects,
  274. datagram sends, and resolve address calls. The name takes the
  275. format "somewhere.com" or "somewhere.com:portnumber" where
  276. the ":portnumber" is optional. The length of this structure
  277. is arbitrarily limited to the overall max length of a domain
  278. name (255 chars), although a longer one can be use successfully
  279. if you use this as a template for doing so. However, the domain name
  280. is still limited to 255 characters.
  281. }
  282. type
  283. DNSAddressPtr = ^DNSAddress;
  284. DNSAddress = record
  285. fAddressType: OTAddressType; { always AF_DNS}
  286. fName: InetDomainName;
  287. end;
  288. { InetInterfaceInfo}
  289. const
  290. kDefaultInetInterface = -1;
  291. const
  292. kInetInterfaceInfoVersion = 3;
  293. type
  294. InetInterfaceInfoPtr = ^InetInterfaceInfo;
  295. InetInterfaceInfo = record
  296. fAddress: InetHost;
  297. fNetmask: InetHost;
  298. fBroadcastAddr: InetHost;
  299. fDefaultGatewayAddr: InetHost;
  300. fDNSAddr: InetHost;
  301. fVersion: UInt16;
  302. fHWAddrLen: UInt16;
  303. fHWAddr: UInt8Ptr;
  304. fIfMTU: UInt32;
  305. fReservedPtrs: array [0..1] of Ptr;
  306. fDomainName: InetDomainName;
  307. fIPSecondaryCount: UInt32;
  308. fReserved: packed array [0..251] of UInt8;
  309. end;
  310. { InetDHCPOption}
  311. const
  312. kAllDHCPOptions = -1;
  313. kDHCPLongOption = 126;
  314. kDHCPLongOptionReq = 127;
  315. type
  316. InetDHCPOptionPtr = ^InetDHCPOption;
  317. InetDHCPOption = record
  318. fOptionTag: SInt8;
  319. fOptionLen: SInt8;
  320. fOptionValue: SInt8;
  321. pad: SInt8
  322. end;
  323. { TCP/IP Utility Routines}
  324. {
  325. * OTInitInetAddress() *** DEPRECATED ***
  326. *
  327. * Availability:
  328. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  329. * CarbonLib: in CarbonLib 1.0 and later
  330. * Non-Carbon CFM: not available
  331. }
  332. procedure OTInitInetAddress( var addr: InetAddress; port: InetPort; host: InetHost ); external name '_OTInitInetAddress';
  333. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  334. {
  335. * OTInitDNSAddress() *** DEPRECATED ***
  336. *
  337. * Availability:
  338. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  339. * CarbonLib: in CarbonLib 1.0 and later
  340. * Non-Carbon CFM: not available
  341. }
  342. function OTInitDNSAddress( var addr: DNSAddress; str: CStringPtr ): OTByteCount; external name '_OTInitDNSAddress';
  343. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  344. {
  345. * OTInetStringToHost() *** DEPRECATED ***
  346. *
  347. * Availability:
  348. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  349. * CarbonLib: in CarbonLib 1.0 and later
  350. * Non-Carbon CFM: not available
  351. }
  352. function OTInetStringToHost( str: ConstCStringPtr; var host: InetHost ): OSStatus; external name '_OTInetStringToHost';
  353. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  354. {
  355. * OTInetHostToString() *** DEPRECATED ***
  356. *
  357. * Availability:
  358. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  359. * CarbonLib: in CarbonLib 1.0 and later
  360. * Non-Carbon CFM: not available
  361. }
  362. procedure OTInetHostToString( host: InetHost; str: CStringPtr ); external name '_OTInetHostToString';
  363. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  364. {
  365. * OTInetGetInterfaceInfo() *** DEPRECATED ***
  366. *
  367. * Availability:
  368. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  369. * CarbonLib: in CarbonLib 1.0 and later
  370. * Non-Carbon CFM: not available
  371. }
  372. function OTInetGetInterfaceInfo( var info: InetInterfaceInfo; val: SInt32 ): OSStatus; external name '_OTInetGetInterfaceInfo';
  373. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  374. {
  375. * OTInetGetSecondaryAddresses() *** DEPRECATED ***
  376. *
  377. * Availability:
  378. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  379. * CarbonLib: in CarbonLib 1.0 and later
  380. * Non-Carbon CFM: not available
  381. }
  382. function OTInetGetSecondaryAddresses( var addr: InetHost; var count: UInt32; val: SInt32 ): OSStatus; external name '_OTInetGetSecondaryAddresses';
  383. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  384. {
  385. * OTInetGetDHCPConfigInfo()
  386. *
  387. * Availability:
  388. * Mac OS X: not available
  389. * CarbonLib: not available
  390. * Non-Carbon CFM: not available
  391. }
  392. { InetServices & DNR Calls}
  393. {$ifc NOT OTKERNEL}
  394. {
  395. Under Carbon, OTOpenInternetServices routines take a client context pointer. Applications may pass NULL
  396. after calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  397. valid client context.
  398. }
  399. {
  400. * OTOpenInternetServicesInContext() *** DEPRECATED ***
  401. *
  402. * Availability:
  403. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  404. * CarbonLib: in CarbonLib 1.0 and later
  405. * Non-Carbon CFM: not available
  406. }
  407. function OTOpenInternetServicesInContext( cfig: OTConfigurationRef; oflag: OTOpenFlags; var err: OSStatus; clientContext: OTClientContextPtr ): InetSvcRef; external name '_OTOpenInternetServicesInContext';
  408. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  409. {
  410. * OTAsyncOpenInternetServicesInContext() *** DEPRECATED ***
  411. *
  412. * Availability:
  413. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  414. * CarbonLib: in CarbonLib 1.0 and later
  415. * Non-Carbon CFM: not available
  416. }
  417. function OTAsyncOpenInternetServicesInContext( cfig: OTConfigurationRef; oflag: OTOpenFlags; upp: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr ): OSStatus; external name '_OTAsyncOpenInternetServicesInContext';
  418. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  419. {
  420. * OTOpenInternetServices()
  421. *
  422. * Availability:
  423. * Mac OS X: not available
  424. * CarbonLib: not available
  425. * Non-Carbon CFM: not available
  426. }
  427. {
  428. * OTAsyncOpenInternetServices()
  429. *
  430. * Availability:
  431. * Mac OS X: not available
  432. * CarbonLib: not available
  433. * Non-Carbon CFM: not available
  434. }
  435. { The following macro may be used by applications only.}
  436. // #define OTOpenInternetServices(cfig, oflags, err) OTOpenInternetServicesInContext(cfig, oflags, err, NULL)
  437. // #define OTAsyncOpenInternetServices(cfig, oflags, proc, contextPtr) OTAsyncOpenInternetServicesInContext(cfig, oflags, proc, contextPtr, NULL)
  438. {
  439. * OTInetStringToAddress() *** DEPRECATED ***
  440. *
  441. * Availability:
  442. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  443. * CarbonLib: in CarbonLib 1.0 and later
  444. * Non-Carbon CFM: not available
  445. }
  446. function OTInetStringToAddress( ref: InetSvcRef; name: CStringPtr; var hinfo: InetHostInfo ): OSStatus; external name '_OTInetStringToAddress';
  447. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  448. {
  449. * OTInetAddressToName() *** DEPRECATED ***
  450. *
  451. * Availability:
  452. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  453. * CarbonLib: in CarbonLib 1.0 and later
  454. * Non-Carbon CFM: not available
  455. }
  456. function OTInetAddressToName( ref: InetSvcRef; addr: InetHost; var name: InetDomainName ): OSStatus; external name '_OTInetAddressToName';
  457. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  458. {
  459. * OTInetSysInfo() *** DEPRECATED ***
  460. *
  461. * Availability:
  462. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  463. * CarbonLib: in CarbonLib 1.0 and later
  464. * Non-Carbon CFM: not available
  465. }
  466. function OTInetSysInfo( ref: InetSvcRef; name: CStringPtr; var sysinfo: InetSysInfo ): OSStatus; external name '_OTInetSysInfo';
  467. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  468. {
  469. * OTInetMailExchange() *** DEPRECATED ***
  470. *
  471. * Availability:
  472. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  473. * CarbonLib: in CarbonLib 1.0 and later
  474. * Non-Carbon CFM: not available
  475. }
  476. function OTInetMailExchange( ref: InetSvcRef; name: CStringPtr; var num: UInt16; mx: InetMailExchangePtr ): OSStatus; external name '_OTInetMailExchange';
  477. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  478. {
  479. * OTInetQuery() *** DEPRECATED ***
  480. *
  481. * Availability:
  482. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  483. * CarbonLib: in CarbonLib 1.0 and later
  484. * Non-Carbon CFM: not available
  485. }
  486. function OTInetQuery( ref: InetSvcRef; name: CStringPtr; qClass: UInt16; qType: UInt16; buf: CStringPtr; buflen: OTByteCount; var argv: UnivPtr; argvlen: OTByteCount; flags: OTFlags ): OSStatus; external name '_OTInetQuery';
  487. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  488. {$endc} { !OTKERNEL }
  489. { ***** AppleTalk *****}
  490. { Shared library prefixes}
  491. const
  492. kATalkVersion = '1.1';
  493. const
  494. kATalkPrefix = 'ot:atlk$';
  495. const
  496. kATBinderID = 'ot:atbd$';
  497. {******************************************************************************
  498. ** Module definitions
  499. *******************************************************************************}
  500. { XTI Levels}
  501. const
  502. ATK_DDP = $44445020 (* 'DDP ' *);
  503. ATK_AARP = $41415250 (* 'AARP' *);
  504. ATK_ATP = $41545020 (* 'ATP ' *);
  505. ATK_ADSP = $41445350 (* 'ADSP' *);
  506. ATK_ASP = $41535020 (* 'ASP ' *);
  507. ATK_PAP = $50415020 (* 'PAP ' *);
  508. ATK_NBP = $4E425020 (* 'NBP ' *);
  509. ATK_ZIP = $5A495020 (* 'ZIP ' *);
  510. { Module Names}
  511. const
  512. kDDPName = 'ddp';
  513. const
  514. kATPName = 'atp';
  515. const
  516. kADSPName = 'adsp';
  517. const
  518. kASPName = 'asp';
  519. const
  520. kPAPName = 'pap';
  521. const
  522. kNBPName = 'nbp';
  523. const
  524. kZIPName = 'zip';
  525. const
  526. kLTalkName = 'ltlk';
  527. const
  528. kLTalkAName = 'ltlkA';
  529. const
  530. kLTalkBName = 'ltlkB';
  531. {
  532. Protocol-specific Options
  533. NOTE:
  534. All Protocols support OPT_CHECKSUM (Value is (unsigned long)T_YES/T_NO)
  535. ATP supports OPT_RETRYCNT (# Retries, 0 = try once) and
  536. OPT_INTERVAL (# Milliseconds to wait)
  537. }
  538. const
  539. DDP_OPT_HOPCOUNT = $2100; { DDP UnitDataReq Only - set hop count, Value is (unsigned long) hop count }
  540. const
  541. DDP_OPT_CHECKSUM = $0600;
  542. DDP_OPT_SRCADDR = $2101; { DDP UnitDataReq Only - set src address, Value is DDPAddress }
  543. ATP_OPT_REPLYCNT = $2110; { AppleTalk - ATP Resp Pkt Ct Type, Value is (unsigned long) pkt count }
  544. ATP_OPT_DATALEN = $2111; { AppleTalk - ATP Pkt Data Len Type, Value is (unsigned long) length }
  545. ATP_OPT_RELTIMER = $2112; { AppleTalk - ATP Release Timer Type, Value is (unsigned long) timer, (See Inside AppleTalk, second edition }
  546. ATP_OPT_TRANID = $2113; { Value is (unsigned long) Boolean, Used to request Transaction ID, Returned with Transaction ID on requests }
  547. PAP_OPT_OPENRETRY = $2120; { AppleTalk - PAP OpenConn Retry count, Value is (unsigned long) T_YES/T_NO }
  548. { Protocol-Specific Events}
  549. {
  550. If you send the IOCTL: OTIoctl(I_OTGetMiscellaneousEvents, 1),
  551. you will receive the T_ATALKxxx events on your endpoint.
  552. NOTE: The endpoint does not need to be bound.
  553. }
  554. const
  555. kAppleTalkEvent = kPROTOCOLEVENT or $00010000;
  556. T_GETMYZONECOMPLETE = kAppleTalkEvent + 1;
  557. T_GETLOCALZONESCOMPLETE = kAppleTalkEvent + 2;
  558. T_GETZONELISTCOMPLETE = kAppleTalkEvent + 3;
  559. T_GETATALKINFOCOMPLETE = kAppleTalkEvent + 4;
  560. T_ATALKROUTERDOWNEVENT = kAppleTalkEvent + 51; { No routers have been seen for a while. If the cookie is NULL, all routers are gone. Otherwise, there is still an ARA router hanging around being used, and only the local cable has been timed out.}
  561. T_ATALKROUTERUPEVENT = kAppleTalkEvent + 52; { We didn't have a router, but now one has come up. Cookie is NULL for a normal router coming up, non-NULL for an ARA router coming on-line}
  562. T_ATALKZONENAMECHANGEDEVENT = kAppleTalkEvent + 53; { A Zone name change was issued from the router, so our AppleTalk Zone has changed.}
  563. T_ATALKCONNECTIVITYCHANGEDEVENT = kAppleTalkEvent + 54; { An ARA connection was established (cookie != NULL), or was disconnected (cookie == NULL)}
  564. T_ATALKINTERNETAVAILABLEEVENT = kAppleTalkEvent + 55; { A router has appeared, and our address is in the startup range. Cookie is hi/lo of new cable range.}
  565. T_ATALKCABLERANGECHANGEDEVENT = kAppleTalkEvent + 56; { A router has appeared, and it's incompatible with our current address. Cookie is hi/lo of new cable range.}
  566. const
  567. T_ATALKBADROUTEREVENT = kAppleTalkEvent + 70; { A bad router has appeared/disappeared on our network.}
  568. T_ALLNODESTAKENEVENT = kAppleTalkEvent + 71;
  569. T_FIXEDNODETAKENEVENT = kAppleTalkEvent + 72;
  570. T_MPPCOMPATCFIGEVENT = kAppleTalkEvent + 73;
  571. T_FIXEDNODEBADEVENT = kAppleTalkEvent + 74;
  572. const
  573. kAllATalkRoutersDown = 0; { This indicates that all routers are offline}
  574. kLocalATalkRoutersDown = -1; { This indicates that all local routers went offline, but an ARA router is still active}
  575. kARARouterDisconnected = -2; { This indicates that ARA was disconnected, do it's router went offline, and we have no local routers to fall back onto.}
  576. const
  577. kARARouterOnline = -1; { We had no local routers, but an ARA router is now online.}
  578. kATalkRouterOnline = 0; { We had no routers, but a local router is now online}
  579. kLocalATalkRouterOnline = -2; { We have an ARA router, but now we've seen a local router as well}
  580. // #define IsAppleTalkEvent(x) ((x) & 0xffff0000) == kAppleTalkEvent)
  581. { Protocol-specific IOCTLs}
  582. const
  583. ATALK_IOC_FULLSELFSEND = $542F; { Turn on/off full self-send (it's automatic for non-backward-compatible links) }
  584. ADSP_IOC_FORWARDRESET = $543C; { ADSP Forward Reset }
  585. { Protocol-specific constants}
  586. { ECHO}
  587. const
  588. kECHO_TSDU = 585; { Max. # of data bytes.}
  589. { NBP}
  590. const
  591. kNBPMaxNameLength = 32;
  592. kNBPMaxTypeLength = 32;
  593. kNBPMaxZoneLength = 32;
  594. kNBPSlushLength = 9; { Extra space for @, : and a few escape chars}
  595. kNBPMaxEntityLength = kNBPMaxNameLength + kNBPMaxTypeLength + kNBPMaxZoneLength + 3;
  596. kNBPEntityBufferSize = kNBPMaxNameLength + kNBPMaxTypeLength + kNBPMaxZoneLength + kNBPSlushLength;
  597. kNBPWildCard = $3D; { NBP name and type match anything '='}
  598. kNBPImbeddedWildCard = $C5; { NBP name and type match some 'Å'}
  599. kNBPDefaultZone = $2A; { NBP default zone '*'}
  600. { ZIP}
  601. const
  602. kZIPMaxZoneLength = kNBPMaxZoneLength;
  603. const
  604. kDDPAddressLength = 8; { value to use in netbuf.len field, Maximum length of AppleTalk address}
  605. kNBPAddressLength = kNBPEntityBufferSize;
  606. kAppleTalkAddressLength = kDDPAddressLength + kNBPEntityBufferSize;
  607. // #define OTCopyDDPAddress(addr, dest) \
  608. // { \
  609. // ((UInt32*)(dest))[0] = ((UInt32*)(addr))[0]; \
  610. // ((UInt32*)(dest))[1] = ((UInt32*)(addr))[1]; \
  611. // }
  612. {******************************************************************************
  613. ** CLASS TAppleTalkServices
  614. *******************************************************************************}
  615. {$ifc NOT OTKERNEL}
  616. {
  617. Define the ATSvcRef type. This type needs special
  618. processing because in C++ it's a subclass of TProvider.
  619. See the definition of TEndpointRef in "OpenTransport.h"
  620. for the logic behind this definition.
  621. }
  622. type
  623. ATSvcRef = ^SInt32; { an opaque 32-bit type }
  624. ATSvcRefPtr = ^ATSvcRef;
  625. const
  626. kDefaultAppleTalkServicesPath = -3;
  627. {
  628. Under Carbon, OpenAppleTalkServices routines take a client context pointer. Applications may pass NULL
  629. after calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  630. valid client context.
  631. }
  632. {
  633. * OTAsyncOpenAppleTalkServicesInContext() *** DEPRECATED ***
  634. *
  635. * Availability:
  636. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  637. * CarbonLib: in CarbonLib 1.0 and later
  638. * Non-Carbon CFM: not available
  639. }
  640. function OTAsyncOpenAppleTalkServicesInContext( cfig: OTConfigurationRef; flags: OTOpenFlags; proc: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr ): OSStatus; external name '_OTAsyncOpenAppleTalkServicesInContext';
  641. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  642. {
  643. * OTOpenAppleTalkServicesInContext() *** DEPRECATED ***
  644. *
  645. * Availability:
  646. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  647. * CarbonLib: in CarbonLib 1.0 and later
  648. * Non-Carbon CFM: not available
  649. }
  650. function OTOpenAppleTalkServicesInContext( cfig: OTConfigurationRef; flags: OTOpenFlags; var err: OSStatus; clientContext: OTClientContextPtr ): ATSvcRef; external name '_OTOpenAppleTalkServicesInContext';
  651. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  652. {
  653. * OTAsyncOpenAppleTalkServices()
  654. *
  655. * Availability:
  656. * Mac OS X: not available
  657. * CarbonLib: not available
  658. * Non-Carbon CFM: not available
  659. }
  660. {
  661. * OTOpenAppleTalkServices()
  662. *
  663. * Availability:
  664. * Mac OS X: not available
  665. * CarbonLib: not available
  666. * Non-Carbon CFM: not available
  667. }
  668. { The following macro may be used by applications only.}
  669. // #define OTOpenAppleTalkServices(cfig, oflags, err) OTOpenAppleTalkServicesInContext(cfig, oflags, err, NULL)
  670. // #define OTAsyncOpenAppleTalkServices(cfig, oflags, proc, contextPtr) OTAsyncOpenAppleTalkServicesInContext(cfig, oflags, proc, contextPtr, NULL)
  671. { Get the zone associated with the ATSvcRef}
  672. {
  673. * OTATalkGetMyZone() *** DEPRECATED ***
  674. *
  675. * Availability:
  676. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  677. * CarbonLib: in CarbonLib 1.0.2 and later
  678. * Non-Carbon CFM: not available
  679. }
  680. function OTATalkGetMyZone( ref: ATSvcRef; var zone: TNetbuf ): OSStatus; external name '_OTATalkGetMyZone';
  681. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  682. {
  683. Get the list of available zones associated with the local cable
  684. of the ATSvcRef
  685. }
  686. {
  687. * OTATalkGetLocalZones() *** DEPRECATED ***
  688. *
  689. * Availability:
  690. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  691. * CarbonLib: in CarbonLib 1.0.2 and later
  692. * Non-Carbon CFM: not available
  693. }
  694. function OTATalkGetLocalZones( ref: ATSvcRef; var zones: TNetbuf ): OSStatus; external name '_OTATalkGetLocalZones';
  695. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  696. { Get the list of all zones on the internet specified by the ATSvcRef}
  697. {
  698. * OTATalkGetZoneList() *** DEPRECATED ***
  699. *
  700. * Availability:
  701. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  702. * CarbonLib: in CarbonLib 1.0.2 and later
  703. * Non-Carbon CFM: not available
  704. }
  705. function OTATalkGetZoneList( ref: ATSvcRef; var zones: TNetbuf ): OSStatus; external name '_OTATalkGetZoneList';
  706. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  707. { Stores an AppleTalkInfo structure into the TNetbuf (see later in this file)}
  708. {
  709. * OTATalkGetInfo() *** DEPRECATED ***
  710. *
  711. * Availability:
  712. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  713. * CarbonLib: in CarbonLib 1.0.2 and later
  714. * Non-Carbon CFM: not available
  715. }
  716. function OTATalkGetInfo( ref: ATSvcRef; var info: TNetbuf ): OSStatus; external name '_OTATalkGetInfo';
  717. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  718. {$endc} { !OTKERNEL }
  719. { AppleTalk Addressing}
  720. {
  721. The NBPEntity structure is used to manipulate NBP names without regard
  722. to issues of what kind of "special" characters are in the name.
  723. When stored as an address in an NBPAddress or DDPNBPAddress, they are
  724. stored as a character string, which is currently just ASCII, but in the
  725. future may be UniChar, or some other internationalizable scripting set.
  726. The string following an NBPAddress or DDPNBPAddress is intended to be
  727. suitable for showing to users, whereas NBPEntity is not.
  728. WARNING: NBPAddress and DDPNBPAddress structures do not "know" the length
  729. of the address. That must have been obtained as part of a Lookup or
  730. ResolveAddress call.
  731. }
  732. const
  733. AF_ATALK_FAMILY = $0100;
  734. AF_ATALK_DDP = $0100;
  735. AF_ATALK_DDPNBP = AF_ATALK_FAMILY + 1;
  736. AF_ATALK_NBP = AF_ATALK_FAMILY + 2;
  737. AF_ATALK_MNODE = AF_ATALK_FAMILY + 3;
  738. type
  739. NBPEntityPtr = ^NBPEntity;
  740. NBPEntity = record
  741. fEntity: packed array [0..99] of UInt8; {one extra pad byte}
  742. end;
  743. type
  744. DDPAddressPtr = ^DDPAddress;
  745. DDPAddress = record
  746. fAddressType: OTAddressType; { One of the enums above}
  747. fNetwork: UInt16;
  748. fNodeID: SInt8;
  749. fSocket: SInt8;
  750. fDDPType: SInt8;
  751. fPad: SInt8;
  752. end;
  753. type
  754. NBPAddressPtr = ^NBPAddress;
  755. NBPAddress = record
  756. fAddressType: OTAddressType; { One of the enums above}
  757. fNBPNameBuffer: packed array [0..104] of UInt8;
  758. end;
  759. type
  760. DDPNBPAddressPtr = ^DDPNBPAddress;
  761. DDPNBPAddress = record
  762. fAddressType: OTAddressType; { One of the enums above}
  763. fNetwork: UInt16;
  764. fNodeID: SInt8;
  765. fSocket: SInt8;
  766. fDDPType: SInt8;
  767. fPad: SInt8;
  768. fNBPNameBuffer: packed array [0..104] of UInt8;
  769. end;
  770. { These are some utility routines for dealing with NBP and DDP addresses. }
  771. { Functions to initialize the various AppleTalk Address types}
  772. {
  773. * OTInitDDPAddress() *** DEPRECATED ***
  774. *
  775. * Availability:
  776. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  777. * CarbonLib: in CarbonLib 1.0 and later
  778. * Non-Carbon CFM: not available
  779. }
  780. procedure OTInitDDPAddress( var addr: DDPAddress; net: UInt16; node: ByteParameter; socket: ByteParameter; ddpType: ByteParameter ); external name '_OTInitDDPAddress';
  781. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  782. {
  783. * OTInitNBPAddress() *** DEPRECATED ***
  784. *
  785. * Availability:
  786. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  787. * CarbonLib: in CarbonLib 1.0 and later
  788. * Non-Carbon CFM: not available
  789. }
  790. function OTInitNBPAddress( var addr: NBPAddress; name: ConstCStringPtr ): OTByteCount; external name '_OTInitNBPAddress';
  791. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  792. {
  793. * OTInitDDPNBPAddress() *** DEPRECATED ***
  794. *
  795. * Availability:
  796. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  797. * CarbonLib: in CarbonLib 1.0 and later
  798. * Non-Carbon CFM: not available
  799. }
  800. function OTInitDDPNBPAddress( var addr: DDPNBPAddress; name: ConstCStringPtr; net: UInt16; node: ByteParameter; socket: ByteParameter; ddpType: ByteParameter ): OTByteCount; external name '_OTInitDDPNBPAddress';
  801. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  802. { Compare 2 DDP addresses for equality}
  803. {
  804. * OTCompareDDPAddresses() *** DEPRECATED ***
  805. *
  806. * Availability:
  807. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  808. * CarbonLib: in CarbonLib 1.0 and later
  809. * Non-Carbon CFM: not available
  810. }
  811. function OTCompareDDPAddresses( const (*var*) addr1: DDPAddress; const (*var*) addr2: DDPAddress ): Boolean; external name '_OTCompareDDPAddresses';
  812. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  813. { Init an NBPEntity to a NULL name}
  814. {
  815. * OTInitNBPEntity() *** DEPRECATED ***
  816. *
  817. * Availability:
  818. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  819. * CarbonLib: in CarbonLib 1.0 and later
  820. * Non-Carbon CFM: not available
  821. }
  822. procedure OTInitNBPEntity( var entity: NBPEntity ); external name '_OTInitNBPEntity';
  823. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  824. { Get the length an NBPEntity would have when stored as an address}
  825. {
  826. * OTGetNBPEntityLengthAsAddress() *** DEPRECATED ***
  827. *
  828. * Availability:
  829. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  830. * CarbonLib: in CarbonLib 1.0 and later
  831. * Non-Carbon CFM: not available
  832. }
  833. function OTGetNBPEntityLengthAsAddress( const (*var*) entity: NBPEntity ): OTByteCount; external name '_OTGetNBPEntityLengthAsAddress';
  834. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  835. { Store an NBPEntity into an address buffer}
  836. {
  837. * OTSetAddressFromNBPEntity() *** DEPRECATED ***
  838. *
  839. * Availability:
  840. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  841. * CarbonLib: in CarbonLib 1.0 and later
  842. * Non-Carbon CFM: not available
  843. }
  844. function OTSetAddressFromNBPEntity( nameBuf: UInt8Ptr; const (*var*) entity: NBPEntity ): OTByteCount; external name '_OTSetAddressFromNBPEntity';
  845. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  846. { Create an address buffer from a string (use -1 for len to use strlen)}
  847. {
  848. * OTSetAddressFromNBPString() *** DEPRECATED ***
  849. *
  850. * Availability:
  851. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  852. * CarbonLib: in CarbonLib 1.0 and later
  853. * Non-Carbon CFM: not available
  854. }
  855. function OTSetAddressFromNBPString( addrBuf: UInt8Ptr; name: ConstCStringPtr; len: SInt32 ): OTByteCount; external name '_OTSetAddressFromNBPString';
  856. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  857. {
  858. Create an NBPEntity from an address buffer. False is returned if
  859. the address was truncated.
  860. }
  861. {
  862. * OTSetNBPEntityFromAddress() *** DEPRECATED ***
  863. *
  864. * Availability:
  865. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  866. * CarbonLib: in CarbonLib 1.0 and later
  867. * Non-Carbon CFM: not available
  868. }
  869. function OTSetNBPEntityFromAddress( var entity: NBPEntity; addrBuf: UInt8Ptr; len: OTByteCount ): Boolean; external name '_OTSetNBPEntityFromAddress';
  870. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  871. { Routines to set a piece of an NBP entity from a character string}
  872. {
  873. * OTSetNBPName() *** DEPRECATED ***
  874. *
  875. * Availability:
  876. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  877. * CarbonLib: in CarbonLib 1.0 and later
  878. * Non-Carbon CFM: not available
  879. }
  880. function OTSetNBPName( var entity: NBPEntity; name: ConstCStringPtr ): Boolean; external name '_OTSetNBPName';
  881. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  882. {
  883. * OTSetNBPType() *** DEPRECATED ***
  884. *
  885. * Availability:
  886. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  887. * CarbonLib: in CarbonLib 1.0 and later
  888. * Non-Carbon CFM: not available
  889. }
  890. function OTSetNBPType( var entity: NBPEntity; typeVal: ConstCStringPtr ): Boolean; external name '_OTSetNBPType';
  891. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  892. {
  893. * OTSetNBPZone() *** DEPRECATED ***
  894. *
  895. * Availability:
  896. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  897. * CarbonLib: in CarbonLib 1.0 and later
  898. * Non-Carbon CFM: not available
  899. }
  900. function OTSetNBPZone( var entity: NBPEntity; zone: ConstCStringPtr ): Boolean; external name '_OTSetNBPZone';
  901. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  902. { Routines to extract pieces of an NBP entity}
  903. {
  904. * OTExtractNBPName() *** DEPRECATED ***
  905. *
  906. * Availability:
  907. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  908. * CarbonLib: in CarbonLib 1.0 and later
  909. * Non-Carbon CFM: not available
  910. }
  911. procedure OTExtractNBPName( const (*var*) entity: NBPEntity; name: CStringPtr ); external name '_OTExtractNBPName';
  912. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  913. {
  914. * OTExtractNBPType() *** DEPRECATED ***
  915. *
  916. * Availability:
  917. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  918. * CarbonLib: in CarbonLib 1.0 and later
  919. * Non-Carbon CFM: not available
  920. }
  921. procedure OTExtractNBPType( const (*var*) entity: NBPEntity; typeVal: CStringPtr ); external name '_OTExtractNBPType';
  922. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  923. {
  924. * OTExtractNBPZone() *** DEPRECATED ***
  925. *
  926. * Availability:
  927. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  928. * CarbonLib: in CarbonLib 1.0 and later
  929. * Non-Carbon CFM: not available
  930. }
  931. procedure OTExtractNBPZone( const (*var*) entity: NBPEntity; zone: CStringPtr ); external name '_OTExtractNBPZone';
  932. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  933. { AppleTalkInfo as used by the OTGetATalkInfo function}
  934. type
  935. AppleTalkInfoPtr = ^AppleTalkInfo;
  936. AppleTalkInfo = record
  937. fOurAddress: DDPAddress; { Our DDP address (network # & node)}
  938. fRouterAddress: DDPAddress; { The address of a router on our cable}
  939. fCableRange: array [0..1] of UInt16; { The current cable range }
  940. fFlags: UInt16; { See below}
  941. end;
  942. { For the fFlags field in AppleTalkInfo}
  943. const
  944. kATalkInfoIsExtended = $0001; { This is an extended (phase 2) network}
  945. kATalkInfoHasRouter = $0002; { This cable has a router}
  946. kATalkInfoOneZone = $0004; { This cable has only one zone}
  947. { ***** Ethernet *****}
  948. { Interface option flags}
  949. { Ethernet framing options}
  950. const
  951. kOTFramingEthernet = $01;
  952. kOTFramingEthernetIPX = $02;
  953. kOTFraming8023 = $04;
  954. kOTFraming8022 = $08;
  955. {
  956. These are obsolete and will be going away in OT 1.5.
  957. Hmmm, OT 1.5 got cancelled. The status of these options
  958. is uncertain.
  959. }
  960. { RawMode options}
  961. const
  962. kOTRawRcvOn = 0;
  963. kOTRawRcvOff = 1;
  964. kOTRawRcvOnWithTimeStamp = 2;
  965. const
  966. DL_PROMISC_OFF = 0; { OPT_SETPROMISCUOUS value}
  967. { Module definitions}
  968. { Module IDs}
  969. const
  970. kT8022ModuleID = 7100;
  971. kEnetModuleID = 7101;
  972. kTokenRingModuleID = 7102;
  973. kFDDIModuleID = 7103;
  974. { Module Names}
  975. const
  976. kEnet8022Name = 'enet8022x';
  977. const
  978. kEnetName = 'enet';
  979. const
  980. kFastEnetName = 'fenet';
  981. const
  982. kTokenRingName = 'tokn';
  983. const
  984. kFDDIName = 'fddi';
  985. const
  986. kIRTalkName = 'irtlk';
  987. const
  988. kSMDSName = 'smds';
  989. const
  990. kATMName = 'atm';
  991. const
  992. kT8022Name = 'tpi8022x';
  993. const
  994. kATMSNAPName = 'atmsnap';
  995. const
  996. kFireWireName = 'firewire';
  997. const
  998. kFibreChannelName = 'fibre';
  999. { Address Family}
  1000. const
  1001. AF_8022 = 8200; { Our 802.2 generic address family}
  1002. { XTI Levels}
  1003. const
  1004. LNK_ENET = $454E4554 (* 'ENET' *);
  1005. LNK_TOKN = $544F4B4E (* 'TOKN' *);
  1006. LNK_FDDI = $46444449 (* 'FDDI' *);
  1007. LNK_TPI = $4C545049 (* 'LTPI' *);
  1008. { Options}
  1009. const
  1010. OPT_ADDMCAST = $1000;
  1011. OPT_DELMCAST = $1001;
  1012. OPT_RCVPACKETTYPE = $1002;
  1013. OPT_RCVDESTADDR = $1003;
  1014. OPT_SETRAWMODE = $1004;
  1015. OPT_SETPROMISCUOUS = $1005;
  1016. type
  1017. OTPacketType = UInt32;
  1018. const
  1019. kETypeStandard = 0;
  1020. kETypeMulticast = 1;
  1021. kETypeBroadcast = 2;
  1022. kETRawPacketBit = $80000000;
  1023. kETTimeStampBit = $40000000;
  1024. { Link related constants}
  1025. const
  1026. kMulticastLength = 6; { length of an ENET hardware addressaddress}
  1027. k48BitAddrLength = 6;
  1028. k8022DLSAPLength = 2; { The protocol type is our DLSAP}
  1029. k8022SNAPLength = 5;
  1030. kEnetAddressLength = k48BitAddrLength + k8022DLSAPLength; { length of an address field used by the ENET enpoint}
  1031. { = k48BitAddrLength + sizeof(protocol type)}
  1032. kSNAPSAP = $00AA; { Special DLSAPS for ENET}
  1033. kIPXSAP = $00FF;
  1034. kMax8022SAP = $00FE;
  1035. k8022GlobalSAP = $00FF;
  1036. kMinDIXSAP = 1501;
  1037. kMaxDIXSAP = $FFFF;
  1038. { Generic Address Structure}
  1039. type
  1040. T8022AddressPtr = ^T8022Address;
  1041. T8022Address = record
  1042. fAddrFamily: OTAddressType;
  1043. fHWAddr: packed array [0..5] of UInt8;
  1044. fSAP: UInt16;
  1045. fSNAP: packed array [0..4] of UInt8;
  1046. end;
  1047. const
  1048. k8022BasicAddressLength = SizeOf(OTAddressType) + k48BitAddrLength + sizeof(UInt16);
  1049. k8022SNAPAddressLength = SizeOf(OTAddressType) + k48BitAddrLength + sizeof(UInt16) + k8022SNAPLength;
  1050. { Some helpful stuff for dealing with 48 bit addresses}
  1051. // #define OTCompare48BitAddresses(p1, p2) \
  1052. // (*(const UInt32*)((const UInt8*)(p1)) == *(const UInt32*)((const UInt8*)(p2)) && \
  1053. // *(const UInt16*)(((const UInt8*)(p1))+4) == *(const UInt16*)(((const UInt8*)(p2))+4) )
  1054. //
  1055. // #define OTCopy48BitAddress(p1, p2) \
  1056. // (*(UInt32*)((UInt8*)(p2)) = *(const UInt32*)((const UInt8*)(p1)), \
  1057. // *(UInt16*)(((UInt8*)(p2))+4) = *(const UInt16*)(((const UInt8*)(p1))+4) )
  1058. //
  1059. // #define OTClear48BitAddress(p1) \
  1060. // (*(UInt32*)((UInt8*)(p1)) = 0, \
  1061. // *(UInt16*)(((UInt8*)(p1))+4) = 0 )
  1062. //
  1063. // #define OTCompare8022SNAP(p1, p2) \
  1064. // (*(const UInt32*)((const UInt8*)(p1)) == *(const UInt32*)((const UInt8*)(p2)) && \
  1065. // *(((const UInt8*)(p1))+4) == *(((const UInt8*)(p2))+4) )
  1066. //
  1067. // #define OTCopy8022SNAP(p1, p2) \
  1068. // (*(UInt32*)((UInt8*)(p2)) = *(const UInt32*)((const UInt8*)(p1)), \
  1069. // *(((UInt8*)(p2))+4) = *(((const UInt8*)(p1))+4) )
  1070. //
  1071. // #define OTIs48BitBroadcastAddress(p1) \
  1072. // (*(UInt32*)((UInt8*)(p1)) == 0xffffffff && \
  1073. // *(UInt16*)(((UInt8*)(p1))+4) == 0xffff )
  1074. //
  1075. // #define OTSet48BitBroadcastAddress(p1) \
  1076. // (*(UInt32*)((UInt8*)(p1)) = 0xffffffff, \
  1077. // *(UInt16*)(((UInt8*)(p1))+4) = 0xffff )
  1078. //
  1079. // #define OTIs48BitZeroAddress(p1) \
  1080. // (*(UInt32*)((UInt8*)(p1)) == 0 && \
  1081. // *(UInt16*)(((UInt8*)(p1))+4) == 0 )
  1082. { Link related constants}
  1083. const
  1084. kEnetPacketHeaderLength = (2 * k48BitAddrLength) + k8022DLSAPLength;
  1085. kEnetTSDU = 1514; { The TSDU for ethernet.}
  1086. kTokenRingTSDU = 4458; { The TSDU for TokenRing.}
  1087. kFDDITSDU = 4458; { The TSDU for FDDI. }
  1088. k8022SAPLength = 1;
  1089. k8022BasicHeaderLength = 3; { define the length of the header portion of an 802.2 packet.}
  1090. { = SSAP+DSAP+ControlByte}
  1091. k8022SNAPHeaderLength = k8022SNAPLength + k8022BasicHeaderLength;
  1092. {******************************************************************************
  1093. ** Address Types recognized by the Enet DLPI
  1094. *******************************************************************************}
  1095. type
  1096. EAddrType = UInt32;
  1097. const
  1098. keaStandardAddress = 0;
  1099. keaMulticast = 1;
  1100. keaBroadcast = 2;
  1101. keaBadAddress = 3;
  1102. keaRawPacketBit = $80000000;
  1103. keaTimeStampBit = $40000000;
  1104. { Packet Header Structures}
  1105. type
  1106. EnetPacketHeaderPtr = ^EnetPacketHeader;
  1107. EnetPacketHeader = packed record
  1108. fDestAddr: packed array [0..5] of UInt8;
  1109. fSourceAddr: packed array [0..5] of UInt8;
  1110. fProto: UInt16;
  1111. end;
  1112. type
  1113. T8022HeaderPtr = ^T8022Header;
  1114. T8022Header = record
  1115. fDSAP: SInt8;
  1116. fSSAP: SInt8;
  1117. fCtrl: SInt8;
  1118. pad: SInt8
  1119. end;
  1120. type
  1121. T8022SNAPHeaderPtr = ^T8022SNAPHeader;
  1122. T8022SNAPHeader = record
  1123. fDSAP: SInt8;
  1124. fSSAP: SInt8;
  1125. fCtrl: SInt8;
  1126. fSNAP0: SInt8;
  1127. fSNAP1: SInt8;
  1128. fSNAP2: SInt8;
  1129. fSNAP3: SInt8;
  1130. fSNAP4: SInt8;
  1131. end;
  1132. type
  1133. T8022FullPacketHeaderPtr = ^T8022FullPacketHeader;
  1134. T8022FullPacketHeader = record
  1135. fEnetPart: EnetPacketHeader;
  1136. f8022Part: T8022SNAPHeader;
  1137. end;
  1138. { Define the lengths of the structures above}
  1139. const
  1140. kT8022HeaderLength = 3;
  1141. kT8022SNAPHeaderLength = 3 + k8022SNAPLength;
  1142. kT8022FullPacketHeaderLength = kEnetPacketHeaderLength + kT8022SNAPHeaderLength;
  1143. { ***** Serial *****}
  1144. { Module Definitions}
  1145. { XTI Level}
  1146. const
  1147. COM_SERIAL = $5345524C (* 'SERL' *);
  1148. { Version Number}
  1149. const
  1150. kSerialABVersion = '1.1.1';
  1151. { Module Names}
  1152. const
  1153. kSerialABName = 'serialAB';
  1154. const
  1155. kSerialName = 'serial';
  1156. const
  1157. kSerialPortAName = 'serialA';
  1158. const
  1159. kSerialPortBName = 'serialB';
  1160. const
  1161. kSerialABModuleID = 7200;
  1162. const
  1163. kOTSerialFramingAsync = $01; { Support Async serial mode }
  1164. kOTSerialFramingHDLC = $02; { Support HDLC synchronous serial mode }
  1165. kOTSerialFramingSDLC = $04; { Support SDLC synchronous serial mode }
  1166. kOTSerialFramingAsyncPackets = $08; { Support Async "packet" serial mode }
  1167. kOTSerialFramingPPP = $10; { Port does its own PPP framing - wants unframed packets from PPP }
  1168. { IOCTL Calls for Serial Drivers}
  1169. const
  1170. I_SetSerialDTR = $5500; { Set DTR (0 = off, 1 = on) }
  1171. kOTSerialSetDTROff = 0;
  1172. kOTSerialSetDTROn = 1;
  1173. I_SetSerialBreak = $5501; { Send a break on the line - kOTSerialSetBreakOff = off, kOTSerialSetBreakOn = on,}
  1174. { Any other number is the number of milliseconds to leave break on, then}
  1175. { auto shutoff}
  1176. kOTSerialSetBreakOn = $FFFFFFFF;
  1177. kOTSerialSetBreakOff = 0;
  1178. I_SetSerialXOffState = $5502; { Force XOFF state - 0 = Unconditionally clear XOFF state, 1 = unconditionally set it}
  1179. kOTSerialForceXOffTrue = 1;
  1180. kOTSerialForceXOffFalse = 0;
  1181. I_SetSerialXOn = $5503; { Send an XON character, 0 = send only if in XOFF state, 1 = send always}
  1182. kOTSerialSendXOnAlways = 1;
  1183. kOTSerialSendXOnIfXOffTrue = 0;
  1184. I_SetSerialXOff = $5504; { Send an XOFF character, 0 = send only if in XON state, 1 = send always}
  1185. kOTSerialSendXOffAlways = 1;
  1186. kOTSerialSendXOffIfXOnTrue = 0;
  1187. { Option Management for Serial Drivers}
  1188. {
  1189. These options are all 4-byte values.
  1190. BaudRate is the baud rate.
  1191. DataBits is the number of data bits.
  1192. StopBits is the number of stop bits times 10.
  1193. Parity is an enum
  1194. }
  1195. const
  1196. SERIAL_OPT_BAUDRATE = $0100; { UInt32 }
  1197. SERIAL_OPT_DATABITS = $0101; { UInt32 }
  1198. SERIAL_OPT_STOPBITS = $0102; { UInt32 10, 15 or 20 for 1, 1.5 or 2 }
  1199. SERIAL_OPT_PARITY = $0103; { UInt32 }
  1200. SERIAL_OPT_STATUS = $0104; { UInt32 }
  1201. { The "Status" option is a 4-byte value option that is ReadOnly}
  1202. { It returns a bitmap of the current serial status}
  1203. SERIAL_OPT_HANDSHAKE = $0105; { UInt32 }
  1204. { The "Handshake" option defines what kind of handshaking the serial port}
  1205. { will do for line flow control. The value is a 32-bit value defined by}
  1206. { the function or macro SerialHandshakeData below.}
  1207. { For no handshake, or CTS handshake, the onChar and offChar parameters}
  1208. { are ignored.}
  1209. SERIAL_OPT_RCVTIMEOUT = $0106; { The "RcvTimeout" option defines how long the receiver should wait before delivering}
  1210. { less than the RcvLoWat number of characters. If RcvLoWat is 0, then the RcvTimeout}
  1211. { is how long a gap to wait for before delivering characters. This parameter is advisory,}
  1212. { and serial drivers are free to deliver data whenever they deem it convenient. For instance,}
  1213. { many serial drivers will deliver data whenever 64 bytes have been received, since 64 bytes}
  1214. { is the smallest STREAMS buffer size. Keep in mind that timeouts are quantized, so be sure to}
  1215. { look at the return value of the option to determine what it was negotiated to.}
  1216. SERIAL_OPT_ERRORCHARACTER = $0107; { This option defines how characters with parity errors are handled.}
  1217. { A 0 value will disable all replacement. A single character value in the low}
  1218. { byte designates the replacement character. When characters are received with a }
  1219. { parity error, they are replaced by this specified character. If a valid incoming}
  1220. { character matches the replacement character, then the received character's msb is}
  1221. { cleared. For this situation, the alternate character is used, if specified in bits}
  1222. { 8 through 15 of the option long, with 0xff being place in bits 16 through 23.}
  1223. { Whenever a valid character is received that matches the first replacement character,}
  1224. { it is replaced with this alternate character.}
  1225. SERIAL_OPT_EXTCLOCK = $0108; { The "ExtClock" requests an external clock. A 0-value turns off external clocking.}
  1226. { Any other value is a requested divisor for the external clock. Be aware that}
  1227. { not all serial implementations support an external clock, and that not all}
  1228. { requested divisors will be supported if it does support an external clock.}
  1229. SERIAL_OPT_BURSTMODE = $0109; { The "BurstMode" option informs the serial driver that it should continue looping,}
  1230. { reading incoming characters, rather than waiting for an interrupt for each character.}
  1231. { This option may not be supported by all Serial driver}
  1232. SERIAL_OPT_DUMMY = $010A; { placeholder}
  1233. type
  1234. ParityOptionValues = UInt32;
  1235. const
  1236. kOTSerialNoParity = 0;
  1237. kOTSerialOddParity = 1;
  1238. kOTSerialEvenParity = 2;
  1239. const
  1240. kOTSerialSwOverRunErr = $01;
  1241. kOTSerialBreakOn = $08;
  1242. kOTSerialParityErr = $10;
  1243. kOTSerialOverrunErr = $20;
  1244. kOTSerialFramingErr = $40;
  1245. kOTSerialXOffSent = $00010000;
  1246. kOTSerialDTRNegated = $00020000;
  1247. kOTSerialCTLHold = $00040000;
  1248. kOTSerialXOffHold = $00080000;
  1249. kOTSerialOutputBreakOn = $01000000;
  1250. const
  1251. kOTSerialXOnOffInputHandshake = 1; { Want XOn/XOff handshake for incoming characters }
  1252. kOTSerialXOnOffOutputHandshake = 2; { Want XOn/XOff handshake for outgoing characters }
  1253. kOTSerialCTSInputHandshake = 4; { Want CTS handshake for incoming characters }
  1254. kOTSerialDTROutputHandshake = 8; { Want DTR handshake for outoing characters }
  1255. // #define OTSerialHandshakeData(type, onChar, offChar) \
  1256. // ((((UInt32)type) << 16) | (((UInt32)onChar) << 8) | offChar)
  1257. //
  1258. // #define OTSerialSetErrorCharacter(rep) \
  1259. // ((rep) & 0xff)
  1260. //
  1261. // #define OTSerialSetErrorCharacterWithAlternate(rep, alternate) \
  1262. // ((((rep) & 0xff) | (((alternate) & 0xff) << 8)) | 0x80000000L)
  1263. { Default attributes for the serial ports}
  1264. const
  1265. kOTSerialDefaultBaudRate = 19200;
  1266. kOTSerialDefaultDataBits = 8;
  1267. kOTSerialDefaultStopBits = 10;
  1268. kOTSerialDefaultParity = kOTSerialNoParity;
  1269. kOTSerialDefaultHandshake = 0;
  1270. kOTSerialDefaultOnChar = 17;
  1271. kOTSerialDefaultOffChar = 19;
  1272. kOTSerialDefaultSndBufSize = 1024;
  1273. kOTSerialDefaultRcvBufSize = 1024;
  1274. kOTSerialDefaultSndLoWat = 96;
  1275. kOTSerialDefaultRcvLoWat = 1;
  1276. kOTSerialDefaultRcvTimeout = 10;
  1277. { ***** ISDN *****}
  1278. { Module Definitions}
  1279. { XTI Level}
  1280. const
  1281. COM_ISDN = $4953444E (* 'ISDN' *);
  1282. { Module Names}
  1283. const
  1284. kISDNName = 'isdn';
  1285. const
  1286. kISDNModuleID = 7300;
  1287. { ISDN framing methods, set using the I_OTSetFramingType IOCTL}
  1288. const
  1289. kOTISDNFramingTransparentSupported = $0010; { Support Transparent mode }
  1290. kOTISDNFramingHDLCSupported = $0020; { Support HDLC Synchronous mode }
  1291. kOTISDNFramingV110Supported = $0040; { Support V.110 Asynchronous mode }
  1292. kOTISDNFramingV14ESupported = $0080; { Support V.14 Asynchronous mode }
  1293. { Miscellaneous equates}
  1294. { Disconnect reason codes (from Q.931)}
  1295. const
  1296. kOTISDNUnallocatedNumber = 1;
  1297. kOTISDNNoRouteToSpecifiedTransitNetwork = 2;
  1298. kOTISDNNoRouteToDestination = 3;
  1299. kOTISDNChannelUnacceptable = 6;
  1300. kOTISDNNormal = 16;
  1301. kOTISDNUserBusy = 17;
  1302. kOTISDNNoUserResponding = 18;
  1303. kOTISDNNoAnswerFromUser = 19;
  1304. kOTISDNCallRejected = 21;
  1305. kOTISDNNumberChanged = 22;
  1306. kOTISDNNonSelectedUserClearing = 26;
  1307. kOTISDNDestinationOutOfOrder = 27;
  1308. kOTISDNInvalidNumberFormat = 28;
  1309. kOTISDNFacilityRejected = 29;
  1310. kOTISDNNormalUnspecified = 31;
  1311. kOTISDNNoCircuitChannelAvailable = 34;
  1312. kOTISDNNetworkOutOfOrder = 41;
  1313. kOTISDNSwitchingEquipmentCongestion = 42;
  1314. kOTISDNAccessInformationDiscarded = 43;
  1315. kOTISDNRequestedCircuitChannelNotAvailable = 44;
  1316. kOTISDNResourceUnavailableUnspecified = 45;
  1317. kOTISDNQualityOfServiceUnvailable = 49;
  1318. kOTISDNRequestedFacilityNotSubscribed = 50;
  1319. kOTISDNBearerCapabilityNotAuthorized = 57;
  1320. kOTISDNBearerCapabilityNotPresentlyAvailable = 58;
  1321. kOTISDNCallRestricted = 59;
  1322. kOTISDNServiceOrOptionNotAvilableUnspecified = 63;
  1323. kOTISDNBearerCapabilityNotImplemented = 65;
  1324. kOTISDNRequestedFacilityNotImplemented = 69;
  1325. kOTISDNOnlyRestrictedDigitalBearer = 70;
  1326. kOTISDNServiceOrOptionNotImplementedUnspecified = 79;
  1327. kOTISDNCallIdentityNotUsed = 83;
  1328. kOTISDNCallIdentityInUse = 84;
  1329. kOTISDNNoCallSuspended = 85;
  1330. kOTISDNCallIdentityCleared = 86;
  1331. kOTISDNIncompatibleDestination = 88;
  1332. kOTISDNInvalidTransitNetworkSelection = 91;
  1333. kOTISDNInvalidMessageUnspecified = 95;
  1334. kOTISDNMandatoryInformationElementIsMissing = 96;
  1335. kOTISDNMessageTypeNonExistentOrNotImplemented = 97;
  1336. kOTISDNInterworkingUnspecified = 127;
  1337. { OTISDNAddress}
  1338. {
  1339. The OTISDNAddress has the following format:
  1340. "xxxxxx*yy"
  1341. where 'x' is the phone number and 'y' is the sub address (if available
  1342. in the network. The characters are coded in ASCII (IA5), and valid
  1343. characters are: '0'-'9','#','*'.
  1344. The max length of the each phone number is 21 characters (?) and the max
  1345. subaddress length is network dependent.
  1346. When using bonded channels the phone numbers are separated by '&'.
  1347. The X.25 user data is preceded by '@'.
  1348. }
  1349. const
  1350. kAF_ISDN = $2000;
  1351. { BSD value for AF_ISDN conflicts, so OT Carbon clients must use kAF_ISDN}
  1352. const
  1353. kOTISDNMaxPhoneSize = 32;
  1354. kOTISDNMaxSubSize = 4;
  1355. type
  1356. OTISDNAddressPtr = ^OTISDNAddress;
  1357. OTISDNAddress = record
  1358. fAddressType: OTAddressType;
  1359. fPhoneLength: UInt16;
  1360. fPhoneNumber: packed array [0..36] of char;
  1361. end;
  1362. { IOCTL Calls for ISDN}
  1363. { ISDN shares the same ioctl space as serial.}
  1364. const
  1365. MIOC_ISDN = 85; { ISDN ioctl() cmds }
  1366. I_OTISDNAlerting = $5564; { Send or receive an ALERTING message }
  1367. I_OTISDNSuspend = $5565; { Send a SUSPEND message }
  1368. { The parameter is the Call Identity (Maximum 8 octets) }
  1369. I_OTISDNSuspendAcknowledge = $5566; { Receive a SUSPEND ACKNOWLEDGE message }
  1370. I_OTISDNSuspendReject = $5567; { Receive a SUSPEND REJECT message }
  1371. I_OTISDNResume = $5568; { Send a RESUME message }
  1372. { The parameter is the Call Identity (Maximum 8 octets) }
  1373. I_OTISDNResumeAcknowledge = $5569; { Receive a RESUME ACKNOWLEDGE message }
  1374. I_OTISDNResumeReject = $556A; { Receive a RESUME REJECT message }
  1375. I_OTISDNFaciltity = $556B; { Send or receive a FACILITY message }
  1376. { Connect user data size }
  1377. kOTISDNMaxUserDataSize = 32;
  1378. { Option management calls for ISDN}
  1379. const
  1380. ISDN_OPT_COMMTYPE = $0200;
  1381. ISDN_OPT_FRAMINGTYPE = $0201;
  1382. ISDN_OPT_56KADAPTATION = $0202;
  1383. { For ISDN_OPT_COMMTYPE...}
  1384. const
  1385. kOTISDNTelephoneALaw = 1; { G.711 A-law }
  1386. kOTISDNTelephoneMuLaw = 26; { G.711 µ-law }
  1387. kOTISDNDigital64k = 13; { unrestricted digital (default) }
  1388. kOTISDNDigital56k = 37; { user rate 56Kb/s }
  1389. kOTISDNVideo64k = 41; { video terminal at 64Kb/s }
  1390. kOTISDNVideo56k = 42; { video terminal at 56Kb/s }
  1391. { For ISDN_OPT_FRAMINGTYPE...}
  1392. const
  1393. kOTISDNFramingTransparent = $0010; { Transparent mode }
  1394. kOTISDNFramingHDLC = $0020; { HDLC synchronous mode (default) }
  1395. kOTISDNFramingV110 = $0040; { V.110 asynchronous mode }
  1396. kOTISDNFramingV14E = $0080; { V.14E asynchronous mode }
  1397. { For ISDN_OPT_56KADAPTATION...}
  1398. const
  1399. kOTISDNNot56KAdaptation = false; { not 56K Adaptation (default) }
  1400. kOTISDN56KAdaptation = true; { 56K Adaptation }
  1401. { Default options, you do not need to set these}
  1402. const
  1403. kOTISDNDefaultCommType = kOTISDNDigital64k;
  1404. kOTISDNDefaultFramingType = kOTISDNFramingHDLC;
  1405. kOTISDNDefault56KAdaptation = kOTISDNNot56KAdaptation;
  1406. {******************************************************************************
  1407. * Constants for Open Transport-based Remote Access/PPP API
  1408. *******************************************************************************}
  1409. { OTCreateConfiguration name for PPP control endpoint}
  1410. const
  1411. kPPPControlName = 'ppp';
  1412. { XTI Level}
  1413. const
  1414. COM_PPP = $50505043 (* 'PPPC' *);
  1415. { Options limits}
  1416. const
  1417. kPPPMaxIDLength = 255;
  1418. kPPPMaxPasswordLength = 255;
  1419. kPPPMaxDTEAddressLength = 127;
  1420. kPPPMaxCallInfoLength = 255;
  1421. { Various XTI option value constants}
  1422. const
  1423. kPPPStateInitial = 1;
  1424. kPPPStateClosed = 2;
  1425. kPPPStateClosing = 3;
  1426. kPPPStateOpening = 4;
  1427. kPPPStateOpened = 5;
  1428. const
  1429. kPPPConnectionStatusIdle = 1;
  1430. kPPPConnectionStatusConnecting = 2;
  1431. kPPPConnectionStatusConnected = 3;
  1432. kPPPConnectionStatusDisconnecting = 4;
  1433. const
  1434. kPPPMinMRU = 0;
  1435. kPPPMaxMRU = 4500;
  1436. const
  1437. kIPCPTCPHdrCompressionDisabled = 0;
  1438. kIPCPTCPHdrCompressionEnabled = 1;
  1439. const
  1440. kPPPCompressionDisabled = $00000000;
  1441. kPPPProtoCompression = $00000001;
  1442. kPPPAddrCompression = $00000002;
  1443. const
  1444. kPPPNoOutAuthentication = 0;
  1445. kPPPCHAPOrPAPOutAuthentication = 1;
  1446. const
  1447. kCCReminderTimerDisabled = 0;
  1448. kCCIPIdleTimerDisabled = 0;
  1449. const
  1450. kPPPScriptTypeModem = 1;
  1451. kPPPScriptTypeConnect = 2;
  1452. kPPPMaxScriptSize = 32000;
  1453. const
  1454. kE164Address = 1;
  1455. kPhoneAddress = 1;
  1456. kCompoundPhoneAddress = 2;
  1457. kX121Address = 3;
  1458. const
  1459. kPPPConnectionStatusDialogsFlag = $00000001;
  1460. kPPPConnectionRemindersFlag = $00000002;
  1461. kPPPConnectionFlashingIconFlag = $00000004;
  1462. kPPPOutPasswordDialogsFlag = $00000008;
  1463. kPPPAllAlertsDisabledFlag = $00000000;
  1464. kPPPAllAlertsEnabledFlag = $0000000F;
  1465. const
  1466. kPPPAsyncMapCharsNone = $00000000;
  1467. kPPPAsyncMapCharsXOnXOff = $000A0000;
  1468. kPPPAsyncMapCharsAll = $FFFFFFFF;
  1469. { Option names}
  1470. const
  1471. IPCP_OPT_GETREMOTEPROTOADDR = $00007000;
  1472. IPCP_OPT_GETLOCALPROTOADDR = $00007001;
  1473. IPCP_OPT_TCPHDRCOMPRESSION = $00007002;
  1474. LCP_OPT_PPPCOMPRESSION = $00007003;
  1475. LCP_OPT_MRU = $00007004;
  1476. LCP_OPT_RCACCMAP = $00007005;
  1477. LCP_OPT_TXACCMAP = $00007006;
  1478. SEC_OPT_OUTAUTHENTICATION = $00007007;
  1479. SEC_OPT_ID = $00007008;
  1480. SEC_OPT_PASSWORD = $00007009;
  1481. CC_OPT_REMINDERTIMER = $00007010;
  1482. CC_OPT_IPIDLETIMER = $00007011;
  1483. CC_OPT_DTEADDRESSTYPE = $00007012;
  1484. CC_OPT_DTEADDRESS = $00007013;
  1485. CC_OPT_CALLINFO = $00007014;
  1486. CC_OPT_GETMISCINFO = $00007015;
  1487. PPP_OPT_GETCURRENTSTATE = $00007016;
  1488. LCP_OPT_ECHO = $00007017; { Available on Mac OS X only }
  1489. CC_OPT_SERIALPORTNAME = $00007200;
  1490. { Endpoint events}
  1491. const
  1492. kPPPEvent = kPROTOCOLEVENT or $000F0000;
  1493. kPPPConnectCompleteEvent = kPPPEvent + 1;
  1494. kPPPSetScriptCompleteEvent = kPPPEvent + 2;
  1495. kPPPDisconnectCompleteEvent = kPPPEvent + 3;
  1496. kPPPDisconnectEvent = kPPPEvent + 4;
  1497. kPPPIPCPUpEvent = kPPPEvent + 5;
  1498. kPPPIPCPDownEvent = kPPPEvent + 6;
  1499. kPPPLCPUpEvent = kPPPEvent + 7;
  1500. kPPPLCPDownEvent = kPPPEvent + 8;
  1501. kPPPLowerLayerUpEvent = kPPPEvent + 9;
  1502. kPPPLowerLayerDownEvent = kPPPEvent + 10;
  1503. kPPPAuthenticationStartedEvent = kPPPEvent + 11;
  1504. kPPPAuthenticationFinishedEvent = kPPPEvent + 12;
  1505. kPPPDCEInitStartedEvent = kPPPEvent + 13;
  1506. kPPPDCEInitFinishedEvent = kPPPEvent + 14;
  1507. kPPPDCECallStartedEvent = kPPPEvent + 15;
  1508. kPPPDCECallFinishedEvent = kPPPEvent + 16;
  1509. {******************************************************************************
  1510. * IOCTL constants for I_OTConnect, I_OTDisconnect and I_OTScript
  1511. * are defined in OpenTransport.h
  1512. *******************************************************************************}
  1513. {******************************************************************************
  1514. * PPPMRULimits
  1515. *******************************************************************************}
  1516. type
  1517. PPPMRULimitsPtr = ^PPPMRULimits;
  1518. PPPMRULimits = record
  1519. mruSize: UInt32; { proposed or actual}
  1520. upperMRULimit: UInt32;
  1521. lowerMRULimit: UInt32;
  1522. end;
  1523. {******************************************************************************
  1524. * CCMiscInfo
  1525. *******************************************************************************}
  1526. type
  1527. CCMiscInfoPtr = ^CCMiscInfo;
  1528. CCMiscInfo = record
  1529. connectionStatus: UInt32;
  1530. connectionTimeElapsed: UInt32;
  1531. connectionTimeRemaining: UInt32;
  1532. bytesTransmitted: UInt32;
  1533. bytesReceived: UInt32;
  1534. reserved: UInt32;
  1535. end;
  1536. {******************************************************************************
  1537. * LCPEcho
  1538. *******************************************************************************}
  1539. { Set both fields to zero to disable sending of LCP echo requests}
  1540. type
  1541. LCPEchoPtr = ^LCPEcho;
  1542. LCPEcho = record
  1543. retryCount: UInt32;
  1544. retryPeriod: UInt32; { in milliseconds}
  1545. end;
  1546. {******************************************************************************
  1547. * Bits used to tell kind of product
  1548. *******************************************************************************}
  1549. const
  1550. kRAProductClientOnly = 2;
  1551. kRAProductOnePortServer = 3;
  1552. kRAProductManyPortServer = 4;
  1553. end.