OpenTransport.pas 130 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933
  1. {
  2. File: OT/OpenTransport.h
  3. Contains: Open Transport client interface file.
  4. Version: OpenTransport-97~544
  5. Copyright: © 1985-2005 by Apple Computer, 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 OpenTransport;
  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,MixedMode,MacErrors;
  92. {$ALIGN POWER}
  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. {
  98. The following table shows how to map from the old (pre-Universal
  99. Interfaces) header file name to the equivalent Universal Interfaces
  100. header file name.
  101. Old Header New Header
  102. ---------- ----------
  103. cred.h OpenTransportProtocol.h
  104. dlpi.h OpenTransportProtocol.h
  105. miioccom.h OpenTransportProtocol.h
  106. mistream.h OpenTransportProtocol.h/OpenTransportKernel.h
  107. modnames.h OpenTransportProtocol.h
  108. OpenTptAppleTalk.h OpenTransportProviders.h
  109. OpenTptClient.h OpenTransportProtocol.h
  110. OpenTptCommon.h OpenTransportProtocol.h
  111. OpenTptConfig.h OpenTransportProtocol.h
  112. OpenTptDevLinks.h OpenTransportProviders.h
  113. OpenTptInternet.h OpenTransportProviders.h
  114. OpenTptISDN.h OpenTransportProviders.h
  115. OpenTptLinks.h OpenTransportProviders.h
  116. OpenTptModule.h OpenTransportKernel.h
  117. OpenTptPCISupport.h OpenTransportKernel.h
  118. OpenTptSerial.h OpenTransportProviders.h
  119. OpenTptXTI.h OpenTransportUNIX.r
  120. OpenTransport.h OpenTransport.h
  121. OpenTransport.r OpenTransport.r
  122. OTConfig.r OpenTransportProtocol.r
  123. OTDebug.h OpenTransport.h
  124. OTSharedLibs.h OpenTransportProviders.h
  125. strlog.h OpenTransportProtocol.h/OpenTransportKernel.h
  126. stropts.h OpenTransportProtocol.h/OpenTransportUNIX.h
  127. strstat.h OpenTransportProtocol.h
  128. tihdr.h OpenTransportProtocol.h
  129. }
  130. {$ALIGN MAC68K}
  131. { ***** Setup Default Compiler Variables *****}
  132. {
  133. OTKERNEL is used to indicate whether the code is being built
  134. for the kernel environment. It defaults to 0. If you include
  135. "OpenTransportKernel.h" before including this file,
  136. it will be 1 and you will only be able to see stuff available
  137. to kernel code.
  138. }
  139. {$ifc undefined OTKERNEL}
  140. {$setc OTKERNEL := 0}
  141. {$endc}
  142. {
  143. OTUNIXERRORS determines whether this file defines a bunch of
  144. common UNIX error codes, like EPERM. Typically, client code does
  145. not want to do this because of the possibility of a clash with
  146. other code modules, like the standard C libraries, that also
  147. defines these routines. However, client code can turn it on to
  148. get these definitions. This might be done by protocol stack
  149. infrastructure, or some other low-level code.
  150. "OpenTransportKernel.i" sets this flag before include
  151. "OpenTransport.h" because kernel modules typically need these
  152. error codes. Note that kernel modules shouldn't be including
  153. standard C libraries, so this is rarely a problem.
  154. In general, the clash between OT and standard C definitions
  155. of these error codes is rarely a problem becasue both OT
  156. and the C libraries define them to have the same value. But
  157. I'm sure this check is useful to some people.
  158. }
  159. {$ifc undefined OTUNIXERRORS}
  160. {$setc OTUNIXERRORS := 0}
  161. {$endc}
  162. {
  163. OTDEBUG is used to control the behaviour of the OT debugging
  164. macros. If you set it to non-zero, the macros will generate code
  165. that drops you into the debugger. If you set it to 0, or leave it
  166. undefined, the macros are compiled out.
  167. Setting up this compiler variable is a little tricky because previous
  168. versions of the OT interfaces used a different variable, qDebug.
  169. We replaced qDebug with OTDEBUG because qDebug does not fit into
  170. the OT namespace. But I didn't want to break a lot of currently
  171. building code. The following tricky compiler variable footwork
  172. avoids this.
  173. There are four outcomes when this code is compiled, depending on
  174. whether qDebug and OTDEBUG are defined beforehand. The following
  175. table shows the outcome in each case.
  176. qDebug OTDEBUG Outcome Explanation
  177. ------ ------- ------- -----------
  178. defined defined OTDEBUG wins Mixed legacy and new code, we believe the new code.
  179. defined undefined qDebug wins Legacy code.
  180. undefined defined OTDEBUG wins New code.
  181. undefined undefined no debugging No debugging.
  182. }
  183. {$ifc not undefined qDebug}
  184. {$ifc undefined OTDEBUG}
  185. {$setc OTDebug := qDebug}
  186. {$endc}
  187. {$endc}
  188. {$ifc undefined OTDEBUG}
  189. {$setc OTDEBUG := 0}
  190. {$endc}
  191. { Carbon Applications have some restrictions on using OT }
  192. {$ifc undefined OTCARBONAPPLICATION}
  193. {$setc OTCARBONAPPLICATION := 0}
  194. {$endc}
  195. {
  196. ***** Normalise 68K Calling C Conventions *****
  197. Define special types that handle the difference in parameter passing
  198. between different Mac OS C compilers when generating 68K code. OT
  199. exports C calling conventions routines, and various C compilers use
  200. various different conventions. Differences in the placement of the result
  201. are covered above, where we output pragma pointers_in_D0. The other big
  202. difference is how the compilers pass integer parameters less than 32 bits.
  203. The MPW compiler always extends these to 32 bits; other compilers simply
  204. push a value of the appropriate size. We overcome this difference by
  205. defining special OTFooParam types, which are only used when passing
  206. sub 32 bit values to routines. They are always defined to a 32 bit
  207. size, which makes all the compilers do the same thing.
  208. One weird consequence of this is that in more strict type checking
  209. languages (eg Pascal) OTBooleanParam is not compatible with Boolean.
  210. Sorry.
  211. }
  212. {
  213. Large tracts of OT source still uses boolean_p etc.
  214. So we continue to define the old types for Apple
  215. clients. The long term fix is to remove all the
  216. uses of these type from the OT source, but that's
  217. beyond the scope of my work right now.
  218. }
  219. type
  220. OTUInt8Param = UInt8;
  221. OTUInt16Param = UInt16;
  222. OTSInt16Param = SInt16;
  223. OTSInt8Param = SInt8;
  224. OTBooleanParam = Boolean;
  225. type
  226. OTByteCount = ByteCount;
  227. OTItemCount = ItemCount;
  228. OTInt32 = SInt32;
  229. OTUInt32 = UInt32;
  230. { ***** C++ Support *****}
  231. {
  232. Setup _MDECL to be _cdecl when compiling C++ code with
  233. compilers that support it, or nothing otherwise.
  234. }
  235. { ***** Shared Library Prefixes *****}
  236. const
  237. kOTLibraryVersion = '1.1';
  238. const
  239. kOTLibraryPrefix = 'OTLib$';
  240. const
  241. kOTModulePrefix = 'OTModl$';
  242. const
  243. kOTClientPrefix = 'OTClnt$';
  244. const
  245. kOTKernelPrefix = 'OTKrnl$';
  246. const
  247. kOTCFMClass = $6F74616E (* 'otan' *);
  248. { ***** Miscellaneous Type Definitions *****}
  249. { A millisecond timeout value}
  250. type
  251. OTTimeout = UInt32;
  252. { An ID number in connections/transactions }
  253. type
  254. OTSequence = SInt32;
  255. { An ID number for registered names }
  256. type
  257. OTNameID = SInt32;
  258. {
  259. A protocol-specific reason code for failure.
  260. Usually a Unix-style positive error code.
  261. }
  262. type
  263. OTReason = SInt32;
  264. { Number of outstanding connection requests at a time.}
  265. type
  266. OTQLen = UInt32;
  267. { Will become internationalizeable shortly (yeah, right).}
  268. type
  269. OTClientName = UInt8Ptr;
  270. { The command code in STREAMS messages.}
  271. type
  272. OTCommand = SInt32;
  273. { value describing a client}
  274. type
  275. OTClient = ^SInt32; { an opaque 32-bit type }
  276. OTClientPtr = ^OTClient;
  277. {
  278. OT now defines its own version of the standard C "offsetof"
  279. macro so as to avoid including <stddef.h>.
  280. }
  281. // #define OTOffsetOf(structure,field) ((ByteCount)&((structure *) 0)->field)
  282. { ***** Debugging Macros *****}
  283. const
  284. kOTFatalErr = 'FB ';
  285. const
  286. kOTNonfatalErr = 'NB ';
  287. const
  288. kOTExtFatalErr = 'FX ';
  289. const
  290. kOTExtNonfatalErr = 'NX ';
  291. const
  292. kOTUserFatalErr = 'UF ';
  293. const
  294. kOTUserErr = 'UE ';
  295. const
  296. kOTUserNonfatalErr = 'UE ';
  297. const
  298. kOTInfoErr = 'IE ';
  299. const
  300. kOTInfoBreak = 'IN ';
  301. {
  302. ***** Flags Used When Opening Providers *****
  303. Important
  304. OT does not currently support any of these flags. You should
  305. always pass 0 to a parameter of type OTOpenFlags. If you need
  306. to modify the mode of operation of a provider, use OTSetBlocking,
  307. OTSetSynchronous, etc.
  308. }
  309. type
  310. OTOpenFlags = UInt32;
  311. const
  312. kO_ASYNC = $01;
  313. kO_NDELAY = $04;
  314. kO_NONBLOCK = $04;
  315. {$ifc CALL_NOT_IN_CARBON}
  316. {
  317. BSD defines O_ASYNC, O_NDELAY and O_NONBLOCK in fcntl.h
  318. Use kO_ASYNC, kO_NDELAY and kO_NONBLOCK in the unlikely event you need the OT value in Carbon
  319. }
  320. const
  321. O_ASYNC = $01;
  322. O_NDELAY = $04;
  323. O_NONBLOCK = $04;
  324. {$endc} {CALL_NOT_IN_CARBON}
  325. { ***** UNIX-Style Error Codes *****}
  326. type
  327. OTUnixErr = UInt16;
  328. {
  329. These definitions are only compiled if you're building kernel code
  330. or you explicit request them by setting OTUNIXERRORS. See the
  331. description of these compiler variables, given above.
  332. }
  333. {$ifc OTKERNEL OR OTUNIXERRORS}
  334. {
  335. There may be some error code confusions with other compiler vendor header
  336. files - However, these match both MPW and AIX definitions.
  337. }
  338. {
  339. First we undefine the #defined ones we know about so that we can put them
  340. in an enum. Of course, this is only going to work in C, but hopefully
  341. other languages won't have these symbols overloaded.
  342. }
  343. const
  344. EPERM = 1; { Permission denied }
  345. ENOENT = 2; { No such file or directory }
  346. ENORSRC = 3; { No such resource }
  347. EINTR = 4; { Interrupted system service }
  348. EIO = 5; { I/O error }
  349. ENXIO = 6; { No such device or address }
  350. EBADF = 9; { Bad file number }
  351. EAGAIN = 11; { Try operation again later }
  352. ENOMEM = 12; { Not enough space }
  353. EACCES = 13; { Permission denied }
  354. EFAULT = 14; { Bad address }
  355. EBUSY = 16; { Device or resource busy }
  356. EEXIST = 17; { File exists }
  357. ENODEV = 19; { No such device }
  358. EINVAL = 22; { Invalid argument }
  359. ENOTTY = 25; { Not a character device }
  360. EPIPE = 32; { Broken pipe }
  361. ERANGE = 34; { Math result not representable }
  362. EDEADLK = 35; { Call would block so was aborted }
  363. EWOULDBLOCK = 35; { Or a deadlock would occur }
  364. EALREADY = 37;
  365. ENOTSOCK = 38; { Socket operation on non-socket }
  366. EDESTADDRREQ = 39; { Destination address required }
  367. EMSGSIZE = 40; { Message too long }
  368. EPROTOTYPE = 41; { Protocol wrong type for socket }
  369. ENOPROTOOPT = 42; { Protocol not available }
  370. EPROTONOSUPPORT = 43; { Protocol not supported }
  371. ESOCKTNOSUPPORT = 44; { Socket type not supported }
  372. EOPNOTSUPP = 45; { Operation not supported on socket }
  373. EADDRINUSE = 48; { Address already in use }
  374. EADDRNOTAVAIL = 49; { Can't assign requested address }
  375. ENETDOWN = 50; { Network is down }
  376. ENETUNREACH = 51; { Network is unreachable }
  377. ENETRESET = 52; { Network dropped connection on reset }
  378. ECONNABORTED = 53; { Software caused connection abort }
  379. ECONNRESET = 54; { Connection reset by peer }
  380. ENOBUFS = 55; { No buffer space available }
  381. EISCONN = 56; { Socket is already connected }
  382. ENOTCONN = 57; { Socket is not connected }
  383. ESHUTDOWN = 58; { Can't send after socket shutdown }
  384. ETOOMANYREFS = 59; { Too many references: can't splice }
  385. ETIMEDOUT = 60; { Connection timed out }
  386. ECONNREFUSED = 61; { Connection refused }
  387. EHOSTDOWN = 64; { Host is down }
  388. EHOSTUNREACH = 65; { No route to host }
  389. EPROTO = 70; { STREAMS protocol error }
  390. ETIME = 71;
  391. ENOSR = 72;
  392. EBADMSG = 73;
  393. ECANCEL = 74;
  394. ENOSTR = 75;
  395. ENODATA = 76;
  396. EINPROGRESS = 77;
  397. ESRCH = 78;
  398. ENOMSG = 79;
  399. ELASTERRNO = 79;
  400. {$endc}
  401. { ***** Open Transport/XTI Error codes *****}
  402. type
  403. OTXTIErr = UInt16;
  404. const
  405. TSUCCESS = 0; { No Error occurred }
  406. TBADADDR = 1; { A Bad address was specified }
  407. TBADOPT = 2; { A Bad option was specified }
  408. TACCES = 3; { Missing access permission }
  409. TBADF = 4; { Bad provider reference }
  410. TNOADDR = 5; { No address was specified }
  411. TOUTSTATE = 6; { Call issued in wrong state }
  412. TBADSEQ = 7; { Sequence specified does not exist }
  413. TSYSERR = 8; { A system error occurred }
  414. TLOOK = 9; { An event occurred - call Look() }
  415. TBADDATA = 10; { An illegal amount of data was specified }
  416. TBUFOVFLW = 11; { Passed buffer not big enough }
  417. TFLOW = 12; { Provider is flow-controlled }
  418. TNODATA = 13; { No data available for reading }
  419. TNODIS = 14; { No disconnect indication available }
  420. TNOUDERR = 15; { No Unit Data Error indication available }
  421. TBADFLAG = 16; { A Bad flag value was supplied }
  422. TNOREL = 17; { No orderly release indication available }
  423. TNOTSUPPORT = 18; { Command is not supported }
  424. TSTATECHNG = 19; { State is changing - try again later }
  425. TNOSTRUCTYPE = 20; { Bad structure type requested for OTAlloc }
  426. TBADNAME = 21; { A bad endpoint name was supplied }
  427. TBADQLEN = 22; { A Bind to an in-use address with qlen > 0}
  428. TADDRBUSY = 23; { Address requested is already in use }
  429. TINDOUT = 24; { Accept failed because of pending listen }
  430. TPROVMISMATCH = 25; { Tried to accept on incompatible endpoint }
  431. TRESQLEN = 26;
  432. TRESADDR = 27;
  433. TQFULL = 28;
  434. TPROTO = 29; { An unspecified provider error occurred }
  435. TBADSYNC = 30; { A synchronous call at interrupt time }
  436. TCANCELED = 31; { The command was cancelled }
  437. TLASTXTIERROR = 31;
  438. {
  439. ***** Mac OS Error Codes *****
  440. Most OT client routines return an OSStatus error code, a 32 bit type
  441. defined in "MacTypes.h". The OT-unique error code values are
  442. defined below. Many of these are generated by remapping XTI error
  443. codes (Txxxx) and UNIX error codes (Exxxx) to a reserved range
  444. in the OSStatus space.
  445. Some routines return an OTResult type, indicating
  446. that the routine might fail with a negative error, succeed with noErr,
  447. or possible return a positive value indicating some status.
  448. }
  449. type
  450. OTResult = SInt32;
  451. {
  452. * These map the Open Transport/XTI errors (the Txxxx error codes), and the
  453. * StdCLib Exxxx error codes into unique spaces in the Mac OS OSStatus space.
  454. }
  455. // #define XTI2OSStatus(x) (-3149 - (x))
  456. // #define E2OSStatus(x) (-3199 - (x))
  457. // #define OSStatus2XTI(x) ((OTXTIErr)(-3149 - (x)))
  458. // #define OSStatus2E(x) ((OTUnixErr)(-3199 - (x)))
  459. // #define IsXTIError(x) ((x) < -3149 && (x) >= (-3149 - TLASTXTIERROR))
  460. // #define IsEError(x) ((x) < -3199 && (x) >= (-3199 - ELASTERRNO))
  461. { ***** OTAddress *****}
  462. {
  463. OTAddress type defines the standard header for all OT address formats.
  464. It consists of one 16 bit integer, which defines the address format
  465. used, followed by an arbitrary number of bytes which are protocol-specific.
  466. Conceptually, all OT address formats are subtypes of this type,
  467. extended with fields that are specific to the protocol. For example,
  468. OTInetAddress starts with the OTAddressType field and then continues
  469. to include a host IP address and a port number.
  470. }
  471. const
  472. kOTGenericName = 0; { Protocol specific data is just a string, interpreted in a protocol-specific fashion.}
  473. type
  474. OTAddressType = UInt16;
  475. OTAddressPtr = ^OTAddress;
  476. OTAddress = record
  477. fAddressType: OTAddressType; { The address format of this address...}
  478. fAddress: packed array[0..0] of UInt8; { ... followed by protocol specific address information.}
  479. end;
  480. {
  481. ***** OTAlloc Constants *****
  482. Note:
  483. In general, Apple recommends that you avoid the OTAlloc call because
  484. using it extensively causes your program to allocate and deallocate
  485. many memory blocks, with each extra memory allocation costing time.
  486. }
  487. {
  488. OTStructType defines the structure type to be allocated using the OTAlloc
  489. call.
  490. }
  491. const
  492. T_BIND = 1;
  493. T_OPTMGMT = 2;
  494. T_CALL = 3;
  495. T_DIS = 4;
  496. T_UNITDATA = 5;
  497. T_UDERROR = 6;
  498. T_INFO = 7;
  499. T_REPLYDATA = 8;
  500. T_REQUESTDATA = 9;
  501. T_UNITREQUEST = 10;
  502. T_UNITREPLY = 11;
  503. type
  504. OTStructType = UInt32;
  505. {
  506. These values are used in the "fields" parameter of the OTAlloc call
  507. to define which fields of the structure should be allocated.
  508. }
  509. const
  510. T_ADDR = $01;
  511. T_OPT = $02;
  512. T_UDATA = $04;
  513. T_ALL = $FFFF;
  514. type
  515. OTFieldsType = UInt32;
  516. { ***** OTFlags *****}
  517. {
  518. This type is used to describe bitwise flags in OT data structures
  519. and parameters. Think of it as the OT analogue to the OptionBits
  520. type in "MacTypes.h".
  521. }
  522. type
  523. OTFlags = UInt32;
  524. {
  525. These flags are used when sending and receiving data. The
  526. constants defined are masks.
  527. }
  528. const
  529. T_MORE = $0001; { More data to come in message }
  530. T_EXPEDITED = $0002; { Data is expedited, if possible }
  531. T_ACKNOWLEDGED = $0004; { Acknowledge transaction }
  532. T_PARTIALDATA = $0008; { Partial data - more coming }
  533. T_NORECEIPT = $0010; { No event on transaction done }
  534. T_TIMEDOUT = $0020; { Reply timed out }
  535. { These flags are used in the TOptMgmt structure to request services.}
  536. const
  537. T_NEGOTIATE = $0004;
  538. T_CHECK = $0008;
  539. T_DEFAULT = $0010;
  540. T_CURRENT = $0080;
  541. {
  542. These flags are used in the TOptMgmt and TOption structures to
  543. return results.
  544. }
  545. const
  546. T_SUCCESS = $0020;
  547. T_FAILURE = $0040;
  548. T_PARTSUCCESS = $0100;
  549. T_READONLY = $0200;
  550. T_NOTSUPPORT = $0400;
  551. {
  552. ***** OTBand *****
  553. A band is a STREAMS concepts which defines the priority of data
  554. on a stream. Although this type is defined as a 32 bit number
  555. for efficiency's sake, bands actually only range from 0 to 255.
  556. Typically band 0 is used for normal data and band 1 for expedited data.
  557. }
  558. type
  559. OTBand = UInt32;
  560. { ***** Object References *****}
  561. {
  562. This deserves some explanation. If you're compiling for
  563. C++, the C++ definitions of TEndpoint and TMapper at the
  564. end of this file are invoked, which lets the compiler
  565. know that they are both subclasses of TProvider. This
  566. way the compiler will do the right subclass type checking,
  567. ie you will be able to pass an EndpointRef to a parameter
  568. of type ProviderRef, but not vice versa.
  569. On the other hand, if your compiling for straighth C,
  570. everything is defined as void. This is somewhat dangerous,
  571. but it prevents you have to cast an EndpointRef to a
  572. ProviderRef every time you call a function that works
  573. on all forms of providers.
  574. }
  575. type
  576. ProviderRef = ^SInt32; { an opaque 32-bit type }
  577. ProviderRefPtr = ^ProviderRef;
  578. EndpointRef = ProviderRef; { an opaque 32-bit type }
  579. EndpointRefPtr = ^EndpointRef;
  580. MapperRef = ProviderRef; { an opaque 32-bit type }
  581. MapperRefPtr = ^MapperRef;
  582. const
  583. kOTInvalidRef = nil;
  584. kOTInvalidProviderRef = nil;
  585. kOTInvalidEndpointRef = nil;
  586. kOTInvalidMapperRef = nil;
  587. { ***** Event Codes *****}
  588. {
  589. OT event codes values for Open Transport. These are the event codes that
  590. are sent to notification routine (notifiers).
  591. }
  592. type
  593. OTEventCode = UInt32;
  594. {
  595. Events are divided into numerous categories:
  596. 1. (0x0000xxxx) The core XTI events have identifiers of the form
  597. T_XXXX. These signal that an XTI event has occured on a stream.
  598. 2. (0x1000xxxx) Private events are reserved for protocol specific
  599. events. Each protocol stack defines them as appropriate for
  600. its own usage.
  601. 3. (0x2000xxxxx) Completion events have identifiers of the form
  602. T_XXXXCOMPLETE. These signal the completion of some asynchronous
  603. API routine, and are only delivered if the endpoint is in asynchronous
  604. mode.
  605. 4. (0x2100xxxx) Stream events are generally encountered when programming
  606. the raw streams API and indicate some event on a raw stream, or
  607. some other event of interest in the STREAMS kernel.
  608. 5. (0x2200xxxx) Signal events indicate that a signal has arrived on
  609. a raw stream. See "Signal Values" for details.
  610. 6. (0x2300xxxx) General provider events that might be generated by any
  611. provider.
  612. 7. (0x2400xxxx) System events sent to all providers.
  613. 8. (0x2500xxxx) System events sent to registered clients.
  614. 9. (0x2600xxxx) System events used by configurators.
  615. 10. (0x2700xxxx) Events sent to registered OT clients.
  616. }
  617. {
  618. All event codes not described here are reserved by Apple. If you receive
  619. an event code you do not understand, ignore it!
  620. }
  621. const
  622. T_LISTEN = $0001; { An connection request is available }
  623. T_CONNECT = $0002; { Confirmation of a connect request }
  624. T_DATA = $0004; { Standard data is available }
  625. T_EXDATA = $0008; { Expedited data is available }
  626. T_DISCONNECT = $0010; { A disconnect is available }
  627. T_ERROR = $0020; { obsolete/unused in library }
  628. T_UDERR = $0040; { A Unit Data Error has occurred }
  629. T_ORDREL = $0080; { An orderly release is available }
  630. T_GODATA = $0100; { Flow control lifted on standard data }
  631. T_GOEXDATA = $0200; { Flow control lifted on expedited data}
  632. T_REQUEST = $0400; { An Incoming request is available }
  633. T_REPLY = $0800; { An Incoming reply is available }
  634. T_PASSCON = $1000; { State is now T_DATAXFER }
  635. T_RESET = $2000; { Protocol has been reset }
  636. kPRIVATEEVENT = $10000000; { Base of the private event range.}
  637. kCOMPLETEEVENT = $20000000; { Base of the completion event range.}
  638. T_BINDCOMPLETE = $20000001; { Bind call is complete }
  639. T_UNBINDCOMPLETE = $20000002; { Unbind call is complete }
  640. T_ACCEPTCOMPLETE = $20000003; { Accept call is complete }
  641. T_REPLYCOMPLETE = $20000004; { SendReply call is complete }
  642. T_DISCONNECTCOMPLETE = $20000005; { Disconnect call is complete }
  643. T_OPTMGMTCOMPLETE = $20000006; { OptMgmt call is complete }
  644. T_OPENCOMPLETE = $20000007; { An Open call is complete }
  645. T_GETPROTADDRCOMPLETE = $20000008; { GetProtAddress call is complete }
  646. T_RESOLVEADDRCOMPLETE = $20000009; { A ResolveAddress call is complet }
  647. T_GETINFOCOMPLETE = $2000000A; { A GetInfo call is complete }
  648. T_SYNCCOMPLETE = $2000000B; { A Sync call is complete }
  649. T_MEMORYRELEASED = $2000000C; { No-copy memory was released }
  650. T_REGNAMECOMPLETE = $2000000D; { A RegisterName call is complete }
  651. T_DELNAMECOMPLETE = $2000000E; { A DeleteName call is complete }
  652. T_LKUPNAMECOMPLETE = $2000000F; { A LookupName call is complete }
  653. T_LKUPNAMERESULT = $20000010; { A LookupName is returning a name }
  654. kOTSyncIdleEvent = $20000011; { Synchronous call Idle event }
  655. kSTREAMEVENT = $21000000; { Base of the raw stream event range.}
  656. kOTReservedEvent1 = $21000001; { reserved for internal use by OT }
  657. kGetmsgEvent = $21000002; { A GetMessage call is complete }
  658. kStreamReadEvent = $21000003; { A Read call is complete }
  659. kStreamWriteEvent = $21000004; { A Write call is complete }
  660. kStreamIoctlEvent = $21000005; { An Ioctl call is complete }
  661. kOTReservedEvent2 = $21000006; { reserved for internal use by OT }
  662. kStreamOpenEvent = $21000007; { An OpenStream call is complete }
  663. kPollEvent = $21000008; { A Poll call is complete }
  664. kOTReservedEvent3 = $21000009; { reserved for internal use by OT }
  665. kOTReservedEvent4 = $2100000A; { reserved for internal use by OT }
  666. kOTReservedEvent5 = $2100000B; { reserved for internal use by OT }
  667. kOTReservedEvent6 = $2100000C; { reserved for internal use by OT }
  668. kOTReservedEvent7 = $2100000D; { reserved for internal use by OT }
  669. kOTReservedEvent8 = $2100000E; { reserved for internal use by OT }
  670. kSIGNALEVENT = $22000000; { A signal has arrived on a raw stream, see "Signal Values" below.}
  671. kPROTOCOLEVENT = $23000000; { Some event from the protocols }
  672. kOTProviderIsDisconnected = $23000001; { Provider is temporarily off-line }
  673. kOTProviderIsReconnected = $23000002; { Provider is now back on-line }
  674. kOTProviderWillClose = $24000001; { Provider will close immediately }
  675. kOTProviderIsClosed = $24000002; { Provider was closed }
  676. kOTPortDisabled = $25000001; { Port is now disabled, result is 0, cookie is port ref }
  677. kOTPortEnabled = $25000002; { Port is now enabled, result is 0, cookie is port ref }
  678. kOTPortOffline = $25000003; { Port is now offline, result is 0, cookie is port ref }
  679. kOTPortOnline = $25000004; { Port is now online, result is 0, cookie is port ref }
  680. kOTClosePortRequest = $25000005; { Request to close/yield, result is reason, cookie is OTPortCloseStruct* }
  681. kOTYieldPortRequest = $25000005; { Request to close/yield, result is reason, cookie is OTPortCloseStruct* }
  682. kOTNewPortRegistered = $25000006; { New port has been registered, cookie is port ref }
  683. kOTPortNetworkChange = $25000007; { Port may have moved to a new network, result is 0, cookie is port ref }
  684. kOTConfigurationChanged = $26000001; { Protocol configuration changed }
  685. kOTSystemSleep = $26000002;
  686. kOTSystemShutdown = $26000003;
  687. kOTSystemAwaken = $26000004;
  688. kOTSystemIdle = $26000005;
  689. kOTSystemSleepPrep = $26000006;
  690. kOTSystemShutdownPrep = $26000007;
  691. kOTSystemAwakenPrep = $26000008;
  692. kOTStackIsLoading = $27000001; { Sent before Open Transport attempts to load the TCP/IP protocol stack.}
  693. kOTStackWasLoaded = $27000002; { Sent after the TCP/IP stack has been successfully loaded.}
  694. kOTStackIsUnloading = $27000003; { Sent before Open Transport unloads the TCP/IP stack.}
  695. {
  696. The following event codes are used internally by Open Transport
  697. but not documented to developers. I had to remove them from the
  698. above list because Interfacer won't let me put a hard conditional
  699. inside an enum declaration.
  700. }
  701. const
  702. kOTDisablePortEvent = $21000001;
  703. kStreamCloseEvent = $21000006;
  704. kBackgroundStreamEvent = $21000009;
  705. kIoctlRecvFdEvent = $2100000A;
  706. kOTTryShutdownEvent = $2100000B; { probably not used by current OT (2.5)}
  707. kOTScheduleTerminationEvent = $2100000C;
  708. kOTEnablePortEvent = $2100000D;
  709. kOTNewPortRegisteredEvent = $2100000E;
  710. kOTPortOfflineEvent = $2100000F;
  711. kOTPortOnlineEvent = $21000010;
  712. kOTPortNetworkChangeEvent = $21000011;
  713. { ***** Event Classification Macros ***** }
  714. // #define IsOTPrivateEvent(x) (((x) & 0x70000000L) == kPRIVATEEVENT)
  715. // #define IsOTCompleteEvent(x) (((x) & 0x7f000000L) == kCOMPLETEEVENT)
  716. // #define IsOTProtocolEvent(x) (((x) & 0x7f000000L) == kPROTOCOLEVENT)
  717. // #define IsOTStreamEvent(x) (((x) & 0x7f000000L) == kSTREAMEVENT)
  718. // #define IsOTSignalEvent(x) (((x) & 0x7f000000L) == kSIGNALEVENT)
  719. // #define GetOTEventCode(x) (x)
  720. {
  721. ***** Signal Values *****
  722. Signals that are generated by a raw stream. When writing a notifier
  723. for a raw stream, add these values to kSIGNALEVENT to determine what
  724. event you are receiving.
  725. }
  726. const
  727. kSIGHUP = 1;
  728. kSIGURG = 16;
  729. kSIGPOLL = 30;
  730. const
  731. SIGHUP = 1;
  732. const
  733. SIGURG = 16;
  734. {
  735. ***** Notifier Type Definition *****
  736. Open Transport notifiers must conform to the OTNotifyProcPtr prototype.
  737. Even though a OTNotifyUPP is a OTNotifyProcPtr on pre-Carbon system,
  738. use NewOTNotifyUPP() and friends to make your source code portable to OS X and Carbon.
  739. }
  740. type
  741. OTNotifyProcPtr = procedure( contextPtr: UnivPtr; code: OTEventCode; result: OTResult; cookie: UnivPtr );
  742. OTNotifyUPP = OTNotifyProcPtr;
  743. {
  744. * NewOTNotifyUPP()
  745. *
  746. * Availability:
  747. * Mac OS X: in version 10.0 and later in CoreServices.framework
  748. * CarbonLib: in CarbonLib 1.0 and later
  749. * Non-Carbon CFM: available as macro/inline
  750. }
  751. function NewOTNotifyUPP( userRoutine: OTNotifyProcPtr ): OTNotifyUPP; external name '_NewOTNotifyUPP';
  752. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  753. {
  754. * DisposeOTNotifyUPP()
  755. *
  756. * Availability:
  757. * Mac OS X: in version 10.0 and later in CoreServices.framework
  758. * CarbonLib: in CarbonLib 1.0 and later
  759. * Non-Carbon CFM: available as macro/inline
  760. }
  761. procedure DisposeOTNotifyUPP( userUPP: OTNotifyUPP ); external name '_DisposeOTNotifyUPP';
  762. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  763. {
  764. * InvokeOTNotifyUPP()
  765. *
  766. * Availability:
  767. * Mac OS X: in version 10.0 and later in CoreServices.framework
  768. * CarbonLib: in CarbonLib 1.0 and later
  769. * Non-Carbon CFM: available as macro/inline
  770. }
  771. procedure InvokeOTNotifyUPP( contextPtr: UnivPtr; code: OTEventCode; result: OTResult; cookie: UnivPtr; userUPP: OTNotifyUPP ); external name '_InvokeOTNotifyUPP';
  772. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  773. { ***** Option Management Definitions *****}
  774. { The XTI Level number of a protocol.}
  775. const
  776. XTI_GENERIC = $FFFF; { level for XTI options }
  777. type
  778. OTXTILevel = UInt32;
  779. { The XTI name of a protocol option.}
  780. type
  781. OTXTIName = UInt32;
  782. { XTI names for options used with XTI_GENERIC above}
  783. const
  784. XTI_DEBUG = $0001;
  785. XTI_LINGER = $0080;
  786. XTI_RCVBUF = $1002;
  787. XTI_RCVLOWAT = $1004;
  788. XTI_SNDBUF = $1001;
  789. XTI_SNDLOWAT = $1003;
  790. XTI_PROTOTYPE = $1005;
  791. OPT_CHECKSUM = $0600; { Set checksumming = UInt32 - 0 or 1)}
  792. OPT_RETRYCNT = $0601; { Set a retry counter = UInt32 (0 = infinite)}
  793. OPT_INTERVAL = $0602; { Set a retry interval = UInt32 milliseconds}
  794. OPT_ENABLEEOM = $0603; { Enable the EOM indication = UInt8 (0 or 1)}
  795. OPT_SELFSEND = $0604; { Enable Self-sending on broadcasts = UInt32 (0 or 1)}
  796. OPT_SERVERSTATUS = $0605; { Set Server Status (format is proto dependent)}
  797. OPT_ALERTENABLE = $0606; { Enable/Disable protocol alerts}
  798. OPT_KEEPALIVE = $0008; { See t_keepalive structure}
  799. { ***** Ioctl Definitions *****}
  800. {
  801. All OT ioctl numbers are formed using the MIOC_CMD macro,
  802. which divides the ioctl space by protocol space (the
  803. first parameter) and ioctl number within that protocol
  804. space (the second parameter). This macro is only available
  805. to C users but it's relatively easy to synthesise its
  806. results in other languages.
  807. }
  808. // #define MIOC_CMD(t,v) ((((t)&0xFF) << 8) | ((v)&0xFF))
  809. { The following is a registry of the ioctls protocol spaces.}
  810. const
  811. MIOC_STREAMIO = 65; { Basic Stream ioctl() cmds - I_PUSH, I_LOOK, etc. }
  812. MIOC_TMOD = 97; { ioctl's for tmod test module }
  813. MIOC_STRLOG = 98; { ioctl's for Mentat's log device }
  814. MIOC_ND = 99; { ioctl's for Mentat's nd device }
  815. MIOC_ECHO = 100; { ioctl's for Mentat's echo device }
  816. MIOC_TLI = 101; { ioctl's for Mentat's timod module }
  817. MIOC_RESERVEDf = 102; { reserved, used by SVR4 FIOxxx }
  818. MIOC_SAD = 103; { ioctl's for Mentat's sad module }
  819. MIOC_ARP = 104; { ioctl's for Mentat's arp module }
  820. MIOC_HAVOC = 72; { Havoc module ioctls. }
  821. MIOC_RESERVEDi = 105; { reserved, used by SVR4 SIOCxxx }
  822. MIOC_SIOC = 106; { sockio.h socket ioctl's }
  823. MIOC_TCP = 107; { tcp.h ioctl's }
  824. MIOC_DLPI = 108; { dlpi.h additions }
  825. MIOC_SOCKETS = 109; { Mentat sockmod ioctl's }
  826. MIOC_IPX = 111; { ioctls for IPX }
  827. MIOC_OT = 79; { ioctls for Open Transport }
  828. MIOC_ATALK = 84; { ioctl's for AppleTalk }
  829. MIOC_SRL = 85; { ioctl's for Serial }
  830. MIOC_RESERVEDp = 112; { reserved, used by SVR4 }
  831. MIOC_RESERVEDr = 114; { reserved, used by SVR4 }
  832. MIOC_RESERVEDs = 115; { reserved, used by SVR4 }
  833. MIOC_CFIG = 122; { ioctl's for private configuration }
  834. { OT specific ioctls.}
  835. const
  836. I_OTGetMiscellaneousEvents = $4F01; { sign up for Misc Events }
  837. I_OTSetFramingType = $4F02; { Set framing option for link }
  838. kOTGetFramingValue = $FFFFFFFF; { Use this value to read framing }
  839. I_OTSetRawMode = $4F03; { Set raw mode for link }
  840. kOTSetRecvMode = $01;
  841. kOTSendErrorPacket = $02;
  842. I_OTConnect = $4F04; { Generic connect request for links }
  843. I_OTDisconnect = $4F05; { Generic disconnect request for links }
  844. I_OTScript = $4F06; { Send a script to a module }
  845. { Structure for the I_OTScript Ioctl.}
  846. type
  847. OTScriptInfoPtr = ^OTScriptInfo;
  848. OTScriptInfo = record
  849. fScriptType: UInt32;
  850. fTheScript: UnivPtr;
  851. fScriptLength: UInt32;
  852. end;
  853. {
  854. ***** XTI States *****
  855. These are the potential values returned by OTGetEndpointState and OTSync
  856. which represent the XTI state of an endpoint.
  857. }
  858. type
  859. OTXTIStates = UInt32;
  860. const
  861. T_UNINIT = 0; { addition to standard xti.h }
  862. T_UNBND = 1; { unbound }
  863. T_IDLE = 2; { idle }
  864. T_OUTCON = 3; { outgoing connection pending }
  865. T_INCON = 4; { incoming connection pending }
  866. T_DATAXFER = 5; { data transfer }
  867. T_OUTREL = 6; { outgoing orderly release }
  868. T_INREL = 7; { incoming orderly release }
  869. {
  870. ***** General XTI Definitions *****
  871. These definitions are typically used during option management.
  872. }
  873. const
  874. T_YES = 1;
  875. T_NO = 0;
  876. T_UNUSED = -1;
  877. kT_NULL = 0;
  878. T_ABSREQ = $8000;
  879. const
  880. kT_UNSPEC = $FFFFFFFD;
  881. T_ALLOPT = 0;
  882. {
  883. T_NULL and T_UNSPEC have different values in BSD headers. If you want the
  884. OT values, use kT_NULL or kT_UNSPEC.
  885. }
  886. {
  887. ***** OTConfiguration *****
  888. This is a "black box" structure used to define the configuration of a
  889. provider or endpoint. This file defines a very limited set of operations
  890. on a configuration. "OpenTransportClient.h" extends this with extra
  891. operations used by protocol stacks but not typically needed by clients.
  892. }
  893. type
  894. OTConfigurationRef = ^SInt32; { an opaque 32-bit type }
  895. OTConfigurationRefPtr = ^OTConfigurationRef;
  896. const
  897. kOTNoMemoryConfigurationPtr = OTConfigurationRef(0);
  898. kOTInvalidConfigurationPtr = OTConfigurationRef(-1);
  899. { ***** Option Management Structures *****}
  900. { This structure describes the contents of a single option in a buffer.}
  901. type
  902. TOptionHeaderPtr = ^TOptionHeader;
  903. TOptionHeader = record
  904. len: ByteCount; { total length of option }
  905. { = sizeof(TOptionHeader) + length }
  906. { of option value in bytes }
  907. level: OTXTILevel; { protocol affected }
  908. name: OTXTIName; { option name }
  909. status: UInt32; { status value }
  910. end;
  911. {
  912. This structure describes the contents of a single option in a buffer.
  913. It differs from TOptionHeader in that it includes the value field,
  914. which acts as an unbounded array representing the value of the option.
  915. }
  916. type
  917. TOptionPtr = ^TOption;
  918. TOption = record
  919. len: ByteCount; { total length of option }
  920. { = sizeof(TOption) + length }
  921. { of option value in bytes }
  922. level: OTXTILevel; { protocol affected }
  923. name: OTXTIName; { option name }
  924. status: UInt32; { status value }
  925. value: array [0..0] of UInt32; { data goes here }
  926. end;
  927. { Some useful constants when manipulating option buffers.}
  928. const
  929. kOTOptionHeaderSize = SizeOf(TOptionHeader);
  930. kOTBooleanOptionDataSize = SizeOf(UInt32);
  931. kOTBooleanOptionSize = kOTOptionHeaderSize + kOTBooleanOptionDataSize;
  932. kOTOneByteOptionSize = kOTOptionHeaderSize + 1;
  933. kOTTwoByteOptionSize = kOTOptionHeaderSize + 2;
  934. kOTFourByteOptionSize = kOTOptionHeaderSize + SizeOf(UInt32);
  935. {
  936. This macro will align return the value of "len", rounded up to the next
  937. 4-byte boundary.
  938. }
  939. // #define T_ALIGN(len) (((UInt32)(len)+(sizeof(SInt32)-1)) & ~(sizeof(SInt32)-1))
  940. {
  941. This macro will return the next option in the buffer, given the previous option
  942. in the buffer, returning NULL if there are no more.
  943. You start off by setting prevOption = (TOption*)theBuffer
  944. (Use OTNextOption for a more thorough check - it ensures the end
  945. of the option is in the buffer as well.)
  946. }
  947. // #define OPT_NEXTHDR(theBuffer, theBufLen, prevOption) \
  948. // (((char*)(prevOption) + T_ALIGN((prevOption)->len) < (char*)(theBuffer) + (theBufLen)) ? \
  949. // (TOption*)((char*)(prevOption)+T_ALIGN((prevOption)->len)) \
  950. // : (TOption*)NULL)
  951. { t_kpalive is used with OPT_KEEPALIVE option.}
  952. type
  953. t_kpalivePtr = ^t_kpalive;
  954. t_kpalive = record
  955. kp_onoff: SInt32; { option on/off }
  956. kp_timeout: SInt32; { timeout in minutes }
  957. end;
  958. { t_linger is used with XTI_LINGER option.}
  959. type
  960. t_lingerPtr = ^t_linger;
  961. t_linger = record
  962. l_onoff: SInt32; { option on/off }
  963. l_linger: SInt32; { linger time }
  964. end;
  965. {
  966. ***** TEndpointInfo *****
  967. This structure is returned from the GetEndpointInfo call and contains
  968. information about an endpoint. But first, some special flags and types.
  969. }
  970. { Values returned in servtype field of TEndpointInfo.}
  971. type
  972. OTServiceType = UInt32;
  973. const
  974. T_COTS = 1; { Connection-mode service }
  975. T_COTS_ORD = 2; { Connection service with orderly release }
  976. T_CLTS = 3; { Connectionless-mode service }
  977. T_TRANS = 5; { Connection-mode transaction service }
  978. T_TRANS_ORD = 6; { Connection transaction service with orderly release }
  979. T_TRANS_CLTS = 7; { Connectionless transaction service }
  980. { Masks for the flags field of TEndpointInfo.}
  981. const
  982. T_SENDZERO = $0001; { supports 0-length TSDU's }
  983. T_XPG4_1 = $0002; { supports the GetProtAddress call }
  984. T_CAN_SUPPORT_MDATA = $10000000; { support M_DATAs on packet protocols }
  985. T_CAN_RESOLVE_ADDR = $40000000; { Supports ResolveAddress call }
  986. T_CAN_SUPPLY_MIB = $20000000; { Supports SNMP MIB data }
  987. {
  988. Special-case values for in the tsdu, etsdu, connect, and discon
  989. fields of TEndpointInfo.
  990. }
  991. const
  992. T_INFINITE = -1; { supports infinit amounts of data }
  993. T_INVALID = -2; { Does not support data transmission }
  994. type
  995. OTDataSize = SInt32;
  996. { Now the TEndpointInfo structure proper.}
  997. type
  998. TEndpointInfoPtr = ^TEndpointInfo;
  999. TEndpointInfo = record
  1000. addr: OTDataSize; { Maximum size of an address }
  1001. options: OTDataSize; { Maximum size of options }
  1002. tsdu: OTDataSize; { Standard data transmit unit size }
  1003. etsdu: OTDataSize; { Expedited data transmit unit size }
  1004. connect: OTDataSize; { Maximum data size on connect }
  1005. discon: OTDataSize; { Maximum data size on disconnect }
  1006. servtype: OTServiceType; { service type }
  1007. flags: UInt32; { Flags (see above for values) }
  1008. end;
  1009. {
  1010. "OpenTransport.h" no longer defines "struct t_info". We recommend
  1011. that you use TEndpointInfo instead. If this is impossible, use
  1012. the definition of "struct t_info" in "OpenTransportXTI.h".
  1013. }
  1014. { ***** OTPortRecord *****}
  1015. { Unique identifier for a port.}
  1016. type
  1017. OTPortRef = UInt32;
  1018. OTPortRefPtr = ^OTPortRef;
  1019. const
  1020. kOTInvalidPortRef = 0;
  1021. { Valid values for the bus type element of an OTPortRef.}
  1022. type
  1023. OTBusType = UInt8;
  1024. const
  1025. kOTUnknownBusPort = 0;
  1026. kOTMotherboardBus = 1;
  1027. kOTNuBus = 2;
  1028. kOTPCIBus = 3;
  1029. kOTGeoPort = 4;
  1030. kOTPCCardBus = 5;
  1031. kOTFireWireBus = 6;
  1032. kOTLastBusIndex = 15;
  1033. {
  1034. A couple of special values for the device type element of an
  1035. OTPortRef. See "OpenTransportDevices.h" for the standard values.
  1036. }
  1037. type
  1038. OTDeviceType = UInt16;
  1039. const
  1040. kOTNoDeviceType = 0;
  1041. kOTADEVDevice = 1; { An Atalk ADEV }
  1042. kOTMDEVDevice = 2; { A TCP/IP MDEV }
  1043. kOTLocalTalkDevice = 3; { LocalTalk }
  1044. kOTIRTalkDevice = 4; { IRTalk }
  1045. kOTTokenRingDevice = 5; { Token Ring }
  1046. kOTISDNDevice = 6; { ISDN }
  1047. kOTATMDevice = 7; { ATM }
  1048. kOTSMDSDevice = 8; { SMDS }
  1049. kOTSerialDevice = 9; { Serial }
  1050. kOTEthernetDevice = 10; { Ethernet }
  1051. kOTSLIPDevice = 11; { SLIP Pseudo-device }
  1052. kOTPPPDevice = 12; { PPP Pseudo-device }
  1053. kOTModemDevice = 13; { Modem Pseudo-Device }
  1054. kOTFastEthernetDevice = 14; { 100 MB Ethernet }
  1055. kOTFDDIDevice = 15; { FDDI }
  1056. kOTIrDADevice = 16; { IrDA Infrared }
  1057. kOTATMSNAPDevice = 17; { ATM SNAP emulation }
  1058. kOTFibreChannelDevice = 18; { Fibre Channel }
  1059. kOTFireWireDevice = 19; { FireWire link Device }
  1060. kOTPseudoDevice = 1023; { used where no other defined device type will work}
  1061. kOTLastDeviceIndex = 1022;
  1062. { Special case values for the slot number element of an OTPortRef.}
  1063. const
  1064. kOTLastSlotNumber = 255;
  1065. kOTLastOtherNumber = 255;
  1066. type
  1067. OTSlotNumber = UInt16;
  1068. { Accessor functions for the various elements of the OTPortRef.}
  1069. {
  1070. * OTCreatePortRef() *** DEPRECATED ***
  1071. *
  1072. * Availability:
  1073. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1074. * CarbonLib: in CarbonLib 1.0 and later
  1075. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1076. }
  1077. function OTCreatePortRef( busType: OTBusType; devType: OTDeviceType; slot: OTSlotNumber; other: UInt16 ): OTPortRef; external name '_OTCreatePortRef';
  1078. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1079. {
  1080. * OTGetDeviceTypeFromPortRef() *** DEPRECATED ***
  1081. *
  1082. * Availability:
  1083. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1084. * CarbonLib: in CarbonLib 1.0 and later
  1085. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1086. }
  1087. function OTGetDeviceTypeFromPortRef( ref: OTPortRef ): OTDeviceType; external name '_OTGetDeviceTypeFromPortRef';
  1088. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1089. {
  1090. * OTGetBusTypeFromPortRef() *** DEPRECATED ***
  1091. *
  1092. * Availability:
  1093. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1094. * CarbonLib: in CarbonLib 1.0 and later
  1095. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1096. }
  1097. function OTGetBusTypeFromPortRef( ref: OTPortRef ): UInt16; external name '_OTGetBusTypeFromPortRef';
  1098. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1099. {
  1100. * OTGetSlotFromPortRef() *** DEPRECATED ***
  1101. *
  1102. * Availability:
  1103. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1104. * CarbonLib: in CarbonLib 1.0 and later
  1105. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1106. }
  1107. function OTGetSlotFromPortRef( ref: OTPortRef; var other: UInt16 ): OTSlotNumber; external name '_OTGetSlotFromPortRef';
  1108. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1109. {
  1110. * OTSetDeviceTypeInPortRef() *** DEPRECATED ***
  1111. *
  1112. * Availability:
  1113. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1114. * CarbonLib: in CarbonLib 1.0 and later
  1115. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1116. }
  1117. function OTSetDeviceTypeInPortRef( ref: OTPortRef; devType: OTDeviceType ): OTPortRef; external name '_OTSetDeviceTypeInPortRef';
  1118. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1119. {
  1120. * OTSetBusTypeInPortRef() *** DEPRECATED ***
  1121. *
  1122. * Availability:
  1123. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1124. * CarbonLib: in CarbonLib 1.0 and later
  1125. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1126. }
  1127. function OTSetBusTypeInPortRef( ref: OTPortRef; busType: OTBusType ): OTPortRef; external name '_OTSetBusTypeInPortRef';
  1128. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1129. {
  1130. Convenience macros for generating specific types of OTPortRefs.
  1131. }
  1132. // #define OTCreateNuBusPortRef(devType, slot, other) \
  1133. // OTCreatePortRef(kOTNuBus, devType, slot, other)
  1134. // #define OTCreatePCIPortRef(devType, slot, other) \
  1135. // OTCreatePortRef(kOTPCIBus, devType, slot, other)
  1136. // #define OTCreatePCCardPortRef(devType, slot, other) \
  1137. // OTCreatePortRef(kOTPCCardBus, devType, slot, other)
  1138. { Name length definitions for various fields in OTPortRecord.}
  1139. const
  1140. kMaxModuleNameLength = 31; { max length of a STREAMS module name}
  1141. kMaxModuleNameSize = kMaxModuleNameLength + 1;
  1142. kMaxProviderNameLength = kMaxModuleNameLength + 4; { providers allow 4 characters for minor number}
  1143. kMaxProviderNameSize = kMaxProviderNameLength + 1;
  1144. kMaxSlotIDLength = 7; { PCI slot names tend to be short}
  1145. kMaxSlotIDSize = kMaxSlotIDLength + 1;
  1146. kMaxResourceInfoLength = 31; { max length of a configuration helper name}
  1147. kMaxResourceInfoSize = 32;
  1148. kMaxPortNameLength = kMaxModuleNameLength + 4; { max size allowed to define a port}
  1149. kMaxPortNameSize = kMaxPortNameLength + 1;
  1150. {
  1151. Masks for the fPortFlags field of OTPortRecord
  1152. If no bits are set, the port is currently inactive.
  1153. }
  1154. const
  1155. kOTPortIsActive = $00000001;
  1156. kOTPortIsDisabled = $00000002;
  1157. kOTPortIsUnavailable = $00000004;
  1158. kOTPortIsOffline = $00000008;
  1159. { Masks for the fInfoFlags field of the OTPortRecord.}
  1160. const
  1161. kOTPortIsDLPI = $00000001;
  1162. kOTPortIsTPI = $00000002;
  1163. kOTPortCanYield = $00000004; { will not be set until the port is used for the first time}
  1164. kOTPortCanArbitrate = $00000008; { will not be set until the port is used for the first time}
  1165. kOTPortIsTransitory = $00000010;
  1166. kOTPortAutoConnects = $00000020;
  1167. kOTPortIsSystemRegistered = $00004000;
  1168. kOTPortIsPrivate = $00008000;
  1169. kOTPortIsAlias = $80000000;
  1170. {
  1171. One OTPortRecord is created for each instance of a port.
  1172. For Instance 'enet' identifies an ethernet port.
  1173. A OTPortRecord for each ethernet card it finds, with an
  1174. OTPortRef that will uniquely allow the driver to determine which
  1175. port it is supposed to open on.
  1176. }
  1177. type
  1178. OTPortRecordPtr = ^OTPortRecord;
  1179. OTPortRecord = record
  1180. fRef: OTPortRef;
  1181. fPortFlags: UInt32;
  1182. fInfoFlags: UInt32;
  1183. fCapabilities: UInt32;
  1184. fNumChildPorts: ItemCount;
  1185. fChildPorts: OTPortRefPtr;
  1186. fPortName: packed array [0..35] of char;
  1187. fModuleName: packed array [0..31] of char;
  1188. fSlotID: packed array [0..7] of char;
  1189. fResourceInfo: packed array [0..31] of char;
  1190. fReserved: packed array [0..163] of char;
  1191. end;
  1192. {
  1193. Routines for finding, registering and unregistering ports.
  1194. IMPORTANT:
  1195. These routines have two versions, one for the client and one
  1196. for the kernel. Make sure you use and link with the right ones.
  1197. }
  1198. {$ifc NOT OTKERNEL}
  1199. {
  1200. * OTGetIndexedPort() *** DEPRECATED ***
  1201. *
  1202. * Availability:
  1203. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1204. * CarbonLib: in CarbonLib 1.0 and later
  1205. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  1206. }
  1207. function OTGetIndexedPort( var portRecord: OTPortRecord; index: OTItemCount ): Boolean; external name '_OTGetIndexedPort';
  1208. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1209. { Index through the ports in the system}
  1210. {
  1211. * OTFindPort() *** DEPRECATED ***
  1212. *
  1213. * Availability:
  1214. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1215. * CarbonLib: in CarbonLib 1.0 and later
  1216. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  1217. }
  1218. function OTFindPort( var portRecord: OTPortRecord; portName: ConstCStringPtr ): Boolean; external name '_OTFindPort';
  1219. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1220. { Find an OTPortRecord for a port using it's name}
  1221. {
  1222. * OTFindPortByRef() *** DEPRECATED ***
  1223. *
  1224. * Availability:
  1225. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1226. * CarbonLib: in CarbonLib 1.0 and later
  1227. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  1228. }
  1229. function OTFindPortByRef( var portRecord: OTPortRecord; ref: OTPortRef ): Boolean; external name '_OTFindPortByRef';
  1230. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1231. { Find an OTPortRecord for a port using it's OTPortRef}
  1232. {
  1233. * OTRegisterPort()
  1234. *
  1235. * Availability:
  1236. * Mac OS X: not available
  1237. * CarbonLib: not available
  1238. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  1239. }
  1240. {
  1241. Register a port. The name the port was registered under is returned in
  1242. the fPortName field.
  1243. }
  1244. {
  1245. * OTUnregisterPort()
  1246. *
  1247. * Availability:
  1248. * Mac OS X: not available
  1249. * CarbonLib: not available
  1250. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  1251. }
  1252. {
  1253. Unregister the port with the given name (If you re-register the
  1254. port, it may get a different name - use OTChangePortState if
  1255. that is not desireable). Since a single OTPortRef can be registered
  1256. with several names, the API needs to use the portName rather than
  1257. the OTPortRef to disambiguate.
  1258. }
  1259. {
  1260. * OTChangePortState()
  1261. *
  1262. * Availability:
  1263. * Mac OS X: not available
  1264. * CarbonLib: not available
  1265. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  1266. }
  1267. { Change the state of the port.}
  1268. {$endc} { !OTKERNEL }
  1269. { ***** Data Buffers *****}
  1270. {
  1271. TNetbuf is the basic structure used to pass data back and forth
  1272. between the Open Transport protocols and their clients
  1273. }
  1274. type
  1275. TNetbufPtr = ^TNetbuf;
  1276. TNetbuf = record
  1277. maxlen: ByteCount;
  1278. len: ByteCount;
  1279. buf: UInt8Ptr;
  1280. end;
  1281. {
  1282. Some rarely used low-level routines in this file take a strbuf
  1283. as a parameter. This is the raw streams equivalent of a TNetbuf.
  1284. The key difference is that the maxlen and len fields are signed,
  1285. which allows you to specify extra operations by providing a
  1286. negative value.
  1287. }
  1288. type
  1289. strbufPtr = ^strbuf;
  1290. strbuf = record
  1291. maxlen: SInt32; { max buffer length }
  1292. len: SInt32; { length of data }
  1293. buf: UnivPtr; { pointer to buffer }
  1294. end;
  1295. {
  1296. OTData is used in a TNetbuf or netbuf to send
  1297. non-contiguous data. Set the 'len' field of the netbuf to the
  1298. constant kNetbufDataIsOTData to signal that the 'buf' field of the
  1299. netbuf actually points to one of these structures instead of a
  1300. memory buffer.
  1301. }
  1302. type
  1303. OTDataPtr = ^OTData;
  1304. OTData = record
  1305. fNext: UnivPtr;
  1306. fData: UnivPtr;
  1307. fLen: ByteCount;
  1308. end;
  1309. const
  1310. kNetbufDataIsOTData = $FFFFFFFE;
  1311. {
  1312. OTBuffer is used for no-copy receives. When receiving, you can
  1313. set the receive length to kOTNetbufDataIsOTBufferStar and then
  1314. pass the address of an OTBuffer* as the receive buffer. OT will
  1315. fill it out to point to a chain of OTBuffers.
  1316. When you are done with it, you must call the OTReleaseBuffer function.
  1317. For best performance, you need to call OTReleaseBuffer quickly.
  1318. Only data netbufs may use this - no netbufs for addresses or options, or the like.
  1319. Any OTBuffer returned to you by OT is read only!
  1320. The astute will notice that this has a high correlation with the
  1321. STREAMS msgb data type. The fields are commented with their
  1322. corresponding msgb field name.
  1323. }
  1324. type
  1325. OTBufferPtr = ^OTBuffer;
  1326. OTBuffer = record
  1327. fLink: UnivPtr; { b_next}
  1328. fLink2: UnivPtr; { b_prev}
  1329. fNext: OTBufferPtr; { b_cont}
  1330. fData: UInt8Ptr; { b_rptr}
  1331. fLen: ByteCount; { b_wptr}
  1332. fSave: UnivPtr; { b_datap}
  1333. fBand: SInt8; { b_band}
  1334. fType: SInt8; { b_pad1}
  1335. fPad1: SInt8;
  1336. fFlags: SInt8; { b_flag}
  1337. end;
  1338. const
  1339. kOTNetbufDataIsOTBufferStar = $FFFFFFFD;
  1340. {
  1341. OTBufferInfo is used with OTReadBuffer to keep track of where you
  1342. are in the buffer, since the OTBuffer is "read-only".
  1343. }
  1344. { Use the OTInitBuffer macro to initialise this structure from an OTBuffer chain.}
  1345. type
  1346. OTBufferInfoPtr = ^OTBufferInfo;
  1347. OTBufferInfo = record
  1348. fBuffer: OTBufferPtr;
  1349. fOffset: ByteCount;
  1350. fPad: UInt8;
  1351. end;
  1352. // #define OTInitBufferInfo(infoPtr, theBuffer) \
  1353. // (infoPtr)->fBuffer = theBuffer; \
  1354. // (infoPtr)->fPad = (theBuffer)->fPad1; \
  1355. // (infoPtr)->fOffset = 0
  1356. {
  1357. If the endpoint supports "raw mode" (the T_CAN_SUPPORT_MDATA bit will
  1358. be set in the TEndpointInfo::flags field), then you specify the
  1359. raw mode packet by putting the kOTNetbufIsRawMode value in
  1360. the udata.addr.len field when calling OTSndUData and also set the
  1361. udata.opt.len, udata.opt.buf, and udata.addr.buf fields to 0.
  1362. }
  1363. const
  1364. kOTNetbufIsRawMode = $FFFFFFFF;
  1365. {
  1366. ***** Standard XTI Parameter Types *****
  1367. These structures are all used as parameters to the standard
  1368. XTI routines.
  1369. }
  1370. {
  1371. TBind holds binding information for calls to
  1372. OTGetProtAddress, OTResolveAddress and OTBind.
  1373. }
  1374. type
  1375. TBindPtr = ^TBind;
  1376. TBind = record
  1377. addr: TNetbuf;
  1378. qlen: OTQLen;
  1379. end;
  1380. {
  1381. TDiscon is passed to RcvDisconnect to find out additional information
  1382. about the disconnect.
  1383. }
  1384. type
  1385. TDisconPtr = ^TDiscon;
  1386. TDiscon = record
  1387. udata: TNetbuf;
  1388. reason: OTReason;
  1389. sequence: OTSequence;
  1390. end;
  1391. {
  1392. TCall holds information about a connection and is a parameter to
  1393. OTConnect, OTRcvConnect, OTListen, OTAccept, and OTSndDisconnect.
  1394. }
  1395. type
  1396. TCallPtr = ^TCall;
  1397. TCall = record
  1398. addr: TNetbuf;
  1399. opt: TNetbuf;
  1400. udata: TNetbuf;
  1401. sequence: OTSequence;
  1402. end;
  1403. { TUnitData describes a datagram in calls to OTSndUData and OTRcvUData.}
  1404. type
  1405. TUnitDataPtr = ^TUnitData;
  1406. TUnitData = record
  1407. addr: TNetbuf;
  1408. opt: TNetbuf;
  1409. udata: TNetbuf;
  1410. end;
  1411. {
  1412. TUDErr is used to get information about a datagram error using
  1413. OTRcvUDErr.
  1414. }
  1415. type
  1416. TUDErrPtr = ^TUDErr;
  1417. TUDErr = record
  1418. addr: TNetbuf;
  1419. opt: TNetbuf;
  1420. error: SInt32;
  1421. end;
  1422. { TOptMgmt is passed to the OTOptionManagement call to read or set protocol}
  1423. type
  1424. TOptMgmtPtr = ^TOptMgmt;
  1425. TOptMgmt = record
  1426. opt: TNetbuf;
  1427. flags: OTFlags;
  1428. end;
  1429. {
  1430. ***** Transactional XTI Parameter Types *****
  1431. These structures are all used as parameters to the OT's
  1432. XTI-like routines for transaction protocols.
  1433. }
  1434. {
  1435. TRequest is passed to OTSndRequest and OTRcvRequest that contains the information
  1436. about the request.
  1437. }
  1438. type
  1439. TRequestPtr = ^TRequest;
  1440. TRequest = record
  1441. data: TNetbuf;
  1442. opt: TNetbuf;
  1443. sequence: OTSequence;
  1444. end;
  1445. { TReply is passed to OTSndReply to send a reply to an incoming request.}
  1446. type
  1447. TReplyPtr = ^TReply;
  1448. TReply = record
  1449. data: TNetbuf;
  1450. opt: TNetbuf;
  1451. sequence: OTSequence;
  1452. end;
  1453. {
  1454. TUnitRequest is passed to OTSndURequest and OTRcvURequest that contains
  1455. the information about the request.
  1456. }
  1457. type
  1458. TUnitRequestPtr = ^TUnitRequest;
  1459. TUnitRequest = record
  1460. addr: TNetbuf;
  1461. opt: TNetbuf;
  1462. udata: TNetbuf;
  1463. sequence: OTSequence;
  1464. end;
  1465. { TUnitReply is passed to OTSndUReply to send a reply to an incoming request.}
  1466. type
  1467. TUnitReplyPtr = ^TUnitReply;
  1468. TUnitReply = record
  1469. opt: TNetbuf;
  1470. udata: TNetbuf;
  1471. sequence: OTSequence;
  1472. end;
  1473. {
  1474. ***** Mapper Parameter Types *****
  1475. These structures are all used as parameters to the OT's
  1476. mapper routines.
  1477. }
  1478. { TRegisterRequest holds the name to register in a call to OTRegisterName.}
  1479. type
  1480. TRegisterRequestPtr = ^TRegisterRequest;
  1481. TRegisterRequest = record
  1482. name: TNetbuf;
  1483. addr: TNetbuf;
  1484. flags: OTFlags;
  1485. end;
  1486. {
  1487. TRegisterReply returns information about the registered name in a call
  1488. to OTRegisterName.
  1489. }
  1490. type
  1491. TRegisterReplyPtr = ^TRegisterReply;
  1492. TRegisterReply = record
  1493. addr: TNetbuf;
  1494. nameid: OTNameID;
  1495. end;
  1496. { TLookupRequest holds the name to look up in a call to OTLookupName.}
  1497. type
  1498. TLookupRequestPtr = ^TLookupRequest;
  1499. TLookupRequest = record
  1500. name: TNetbuf;
  1501. addr: TNetbuf;
  1502. maxcnt: UInt32;
  1503. timeout: OTTimeout;
  1504. flags: OTFlags;
  1505. end;
  1506. {
  1507. TLookupReply returns information about the found names after a call
  1508. to OTLookupName.
  1509. }
  1510. type
  1511. TLookupReplyPtr = ^TLookupReply;
  1512. TLookupReply = record
  1513. names: TNetbuf;
  1514. rspcount: UInt32;
  1515. end;
  1516. {
  1517. TLookupBuffer describes the contents of the names buffer pointed
  1518. to by the TLookupReply.
  1519. }
  1520. type
  1521. TLookupBufferPtr = ^TLookupBuffer;
  1522. TLookupBuffer = record
  1523. fAddressLength: UInt16;
  1524. fNameLength: UInt16;
  1525. fAddressBuffer: packed array[0..0] of SInt8;
  1526. end;
  1527. {
  1528. OTNextLookupBuffer allows you to step through a packed array
  1529. of TLookupBuffers.
  1530. }
  1531. // #define OTNextLookupBuffer(buf) \
  1532. // ((TLookupBuffer*) \
  1533. // ((char*)buf + ((OTOffsetOf(TLookupBuffer, fAddressBuffer) + buf->fAddressLength + buf->fNameLength + 3) & ~3)))
  1534. { ***** Initializing and Shutting Down Open Transport *****}
  1535. {$ifc NOT OTKERNEL}
  1536. type
  1537. OTClientContextPtr = ^SInt32; { an opaque 32-bit type }
  1538. OTClientContextPtrPtr = ^OTClientContextPtr;
  1539. {
  1540. For Carbon the InitOpenTransport interface has changed so it takes a flags parameter
  1541. and returns a client context pointer.
  1542. The flag passed to indicates whether OT should be initialized for application use or for some other target
  1543. (for example, plugins that run in an application context but not the application itself.)
  1544. Applications that are not interested in the value of the client context pointer may pass NULL
  1545. as outClientContext -- they will pass NULL to other routines that take a OTClientContextPtr.
  1546. }
  1547. type
  1548. OTInitializationFlags = UInt32;
  1549. const
  1550. kInitOTForApplicationMask = 1;
  1551. kInitOTForExtensionMask = 2;
  1552. {
  1553. * InitOpenTransportInContext() *** DEPRECATED ***
  1554. *
  1555. * Availability:
  1556. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1557. * CarbonLib: in CarbonLib 1.0 and later
  1558. * Non-Carbon CFM: not available
  1559. }
  1560. function InitOpenTransportInContext( flags: OTInitializationFlags; outClientContext: OTClientContextPtrPtr { can be NULL } ): OSStatus; external name '_InitOpenTransportInContext';
  1561. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1562. {
  1563. Under Carbon, CloseOpenTransport takes a client context pointer. Applications may pass NULL
  1564. after calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  1565. valid client context.
  1566. }
  1567. {
  1568. * CloseOpenTransportInContext() *** DEPRECATED ***
  1569. *
  1570. * Availability:
  1571. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1572. * CarbonLib: in CarbonLib 1.0 and later
  1573. * Non-Carbon CFM: not available
  1574. }
  1575. procedure CloseOpenTransportInContext( clientContext: OTClientContextPtr ); external name '_CloseOpenTransportInContext';
  1576. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1577. {
  1578. * InitOpenTransport()
  1579. *
  1580. * Availability:
  1581. * Mac OS X: not available
  1582. * CarbonLib: not available
  1583. * Non-Carbon CFM: not available
  1584. }
  1585. {
  1586. * InitOpenTransportUtilities()
  1587. *
  1588. * Availability:
  1589. * Mac OS X: not available
  1590. * CarbonLib: not available
  1591. * Non-Carbon CFM: not available
  1592. }
  1593. {
  1594. * CloseOpenTransport()
  1595. *
  1596. * Availability:
  1597. * Mac OS X: not available
  1598. * CarbonLib: not available
  1599. * Non-Carbon CFM: not available
  1600. }
  1601. {
  1602. * OTRegisterAsClient()
  1603. *
  1604. * Availability:
  1605. * Mac OS X: not available
  1606. * CarbonLib: not available
  1607. * Non-Carbon CFM: not available
  1608. }
  1609. {
  1610. This registers yourself as a client for any miscellaneous Open Transport
  1611. notifications that come along. CloseOpenTransport will automatically do
  1612. an OTUnregisterAsClient, if you have not already done so.
  1613. }
  1614. {
  1615. * OTUnregisterAsClient()
  1616. *
  1617. * Availability:
  1618. * Mac OS X: not available
  1619. * CarbonLib: not available
  1620. * Non-Carbon CFM: not available
  1621. }
  1622. {
  1623. * OTRegisterAsClientInContext() *** DEPRECATED ***
  1624. *
  1625. * Availability:
  1626. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1627. * CarbonLib: in CarbonLib 1.3 and later
  1628. * Non-Carbon CFM: not available
  1629. }
  1630. function OTRegisterAsClientInContext( name: OTClientName; proc: OTNotifyUPP; clientContext: OTClientContextPtr { can be NULL } ): OSStatus; external name '_OTRegisterAsClientInContext';
  1631. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1632. {
  1633. * OTUnregisterAsClientInContext() *** DEPRECATED ***
  1634. *
  1635. * Availability:
  1636. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1637. * CarbonLib: in CarbonLib 1.3 and later
  1638. * Non-Carbon CFM: not available
  1639. }
  1640. function OTUnregisterAsClientInContext( clientContext: OTClientContextPtr ): OSStatus; external name '_OTUnregisterAsClientInContext';
  1641. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1642. {$endc} { !OTKERNEL }
  1643. { ***** Tasking Model *****}
  1644. {
  1645. OTEnterInterrupt/OTLeaveInterrupt are normally used within the kernel to
  1646. tell Open Transport we're at hardware interrupt time. Clients can also
  1647. them to do the same.
  1648. }
  1649. {
  1650. * OTEnterInterrupt()
  1651. *
  1652. * Availability:
  1653. * Mac OS X: not available
  1654. * CarbonLib: not available
  1655. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1656. }
  1657. {
  1658. * OTLeaveInterrupt()
  1659. *
  1660. * Availability:
  1661. * Mac OS X: not available
  1662. * CarbonLib: not available
  1663. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1664. }
  1665. {
  1666. * OTIsAtInterruptLevel()
  1667. *
  1668. * Availability:
  1669. * Mac OS X: not available
  1670. * CarbonLib: not available
  1671. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1672. }
  1673. {
  1674. * OTCanLoadLibraries()
  1675. *
  1676. * Availability:
  1677. * Mac OS X: not available
  1678. * CarbonLib: not available
  1679. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1680. }
  1681. {
  1682. All OT task callbacks use the same prototype, shown below.
  1683. This is only a UPP for CFM-68K clients.
  1684. }
  1685. type
  1686. OTProcessProcPtr = procedure( arg: UnivPtr );
  1687. OTProcessUPP = OTProcessProcPtr;
  1688. {
  1689. * NewOTProcessUPP()
  1690. *
  1691. * Availability:
  1692. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1693. * CarbonLib: in CarbonLib 1.0 and later
  1694. * Non-Carbon CFM: available as macro/inline
  1695. }
  1696. function NewOTProcessUPP( userRoutine: OTProcessProcPtr ): OTProcessUPP; external name '_NewOTProcessUPP';
  1697. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1698. {
  1699. * DisposeOTProcessUPP()
  1700. *
  1701. * Availability:
  1702. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1703. * CarbonLib: in CarbonLib 1.0 and later
  1704. * Non-Carbon CFM: available as macro/inline
  1705. }
  1706. procedure DisposeOTProcessUPP( userUPP: OTProcessUPP ); external name '_DisposeOTProcessUPP';
  1707. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1708. {
  1709. * InvokeOTProcessUPP()
  1710. *
  1711. * Availability:
  1712. * Mac OS X: in version 10.0 and later in CoreServices.framework
  1713. * CarbonLib: in CarbonLib 1.0 and later
  1714. * Non-Carbon CFM: available as macro/inline
  1715. }
  1716. procedure InvokeOTProcessUPP( arg: UnivPtr; userUPP: OTProcessUPP ); external name '_InvokeOTProcessUPP';
  1717. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1718. {$ifc NOT OTKERNEL}
  1719. {
  1720. Under Carbon, OTCreateDeferredTask takes a client context pointer. Applications may pass NULL
  1721. after calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  1722. valid client context.
  1723. }
  1724. {
  1725. * OTCreateDeferredTaskInContext() *** DEPRECATED ***
  1726. *
  1727. * Availability:
  1728. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1729. * CarbonLib: in CarbonLib 1.0 and later
  1730. * Non-Carbon CFM: not available
  1731. }
  1732. function OTCreateDeferredTaskInContext( upp: OTProcessUPP; arg: UnivPtr; clientContext: OTClientContextPtr { can be NULL } ): SInt32; external name '_OTCreateDeferredTaskInContext';
  1733. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1734. {$endc} { !OTKERNEL }
  1735. {
  1736. OT deferred tasks are often more convenience that standard Mac OS
  1737. although they have no significant advantages beyond convenience.
  1738. }
  1739. type
  1740. OTDeferredTaskRef = SInt32;
  1741. {
  1742. * OTCreateDeferredTask()
  1743. *
  1744. * Availability:
  1745. * Mac OS X: not available
  1746. * CarbonLib: not available
  1747. * Non-Carbon CFM: not available
  1748. }
  1749. {
  1750. * OTScheduleDeferredTask() *** DEPRECATED ***
  1751. *
  1752. * Availability:
  1753. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1754. * CarbonLib: in CarbonLib 1.0 and later
  1755. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1756. }
  1757. function OTScheduleDeferredTask( dtCookie: OTDeferredTaskRef ): Boolean; external name '_OTScheduleDeferredTask';
  1758. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1759. {
  1760. * OTScheduleInterruptTask()
  1761. *
  1762. * Availability:
  1763. * Mac OS X: not available
  1764. * CarbonLib: not available
  1765. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1766. }
  1767. {
  1768. * OTDestroyDeferredTask() *** DEPRECATED ***
  1769. *
  1770. * Availability:
  1771. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1772. * CarbonLib: in CarbonLib 1.0 and later
  1773. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1774. }
  1775. function OTDestroyDeferredTask( dtCookie: OTDeferredTaskRef ): OSStatus; external name '_OTDestroyDeferredTask';
  1776. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1777. {$ifc NOT OTKERNEL}
  1778. {
  1779. OT system tasks allow you to schedule a procedure to be called
  1780. at system task time. Potentially useful, but it relies on someone
  1781. calling SystemTask (or WaitNextEvent, which calls SystemTask).
  1782. Not available to kernel code because relying on system task time
  1783. to make progress is likely to result in deadlocks.
  1784. }
  1785. type
  1786. OTSystemTaskRef = SInt32;
  1787. {
  1788. * OTCreateSystemTask()
  1789. *
  1790. * Availability:
  1791. * Mac OS X: not available
  1792. * CarbonLib: not available
  1793. * Non-Carbon CFM: not available
  1794. }
  1795. {
  1796. * OTDestroySystemTask()
  1797. *
  1798. * Availability:
  1799. * Mac OS X: not available
  1800. * CarbonLib: not available
  1801. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1802. }
  1803. {
  1804. * OTScheduleSystemTask()
  1805. *
  1806. * Availability:
  1807. * Mac OS X: not available
  1808. * CarbonLib: not available
  1809. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1810. }
  1811. {
  1812. * OTCancelSystemTask()
  1813. *
  1814. * Availability:
  1815. * Mac OS X: not available
  1816. * CarbonLib: not available
  1817. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1818. }
  1819. {
  1820. * OTCanMakeSyncCall() *** DEPRECATED ***
  1821. *
  1822. * Availability:
  1823. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1824. * CarbonLib: in CarbonLib 1.0 and later
  1825. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  1826. }
  1827. function OTCanMakeSyncCall: Boolean; external name '_OTCanMakeSyncCall';
  1828. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1829. {$endc} { !OTKERNEL }
  1830. { ***** Interface to Providers *****}
  1831. {$ifc NOT OTKERNEL}
  1832. {
  1833. * OTAsyncOpenProvider()
  1834. *
  1835. * Availability:
  1836. * Mac OS X: not available
  1837. * CarbonLib: not available
  1838. * Non-Carbon CFM: not available
  1839. }
  1840. {
  1841. * OTOpenProvider()
  1842. *
  1843. * Availability:
  1844. * Mac OS X: not available
  1845. * CarbonLib: not available
  1846. * Non-Carbon CFM: not available
  1847. }
  1848. {
  1849. * OTCloseProvider() *** DEPRECATED ***
  1850. *
  1851. * Availability:
  1852. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1853. * CarbonLib: in CarbonLib 1.0 and later
  1854. * Non-Carbon CFM: not available
  1855. }
  1856. function OTCloseProvider( ref: ProviderRef ): OSStatus; external name '_OTCloseProvider';
  1857. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1858. {
  1859. * OTTransferProviderOwnership()
  1860. *
  1861. * Availability:
  1862. * Mac OS X: not available
  1863. * CarbonLib: not available
  1864. * Non-Carbon CFM: not available
  1865. }
  1866. {
  1867. * OTWhoAmI()
  1868. *
  1869. * Availability:
  1870. * Mac OS X: not available
  1871. * CarbonLib: not available
  1872. * Non-Carbon CFM: not available
  1873. }
  1874. {
  1875. * OTGetProviderPortRef()
  1876. *
  1877. * Availability:
  1878. * Mac OS X: not available
  1879. * CarbonLib: not available
  1880. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1881. }
  1882. {
  1883. * OTIoctl() *** DEPRECATED ***
  1884. *
  1885. * Availability:
  1886. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1887. * CarbonLib: in CarbonLib 1.0 and later
  1888. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1889. }
  1890. function OTIoctl( ref: ProviderRef; cmd: UInt32; data: UnivPtr ): SInt32; external name '_OTIoctl';
  1891. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1892. {
  1893. * OTGetMessage()
  1894. *
  1895. * Availability:
  1896. * Mac OS X: not available
  1897. * CarbonLib: not available
  1898. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1899. }
  1900. {
  1901. * OTGetPriorityMessage()
  1902. *
  1903. * Availability:
  1904. * Mac OS X: not available
  1905. * CarbonLib: not available
  1906. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1907. }
  1908. {
  1909. * OTPutMessage()
  1910. *
  1911. * Availability:
  1912. * Mac OS X: not available
  1913. * CarbonLib: not available
  1914. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1915. }
  1916. {
  1917. * OTPutPriorityMessage()
  1918. *
  1919. * Availability:
  1920. * Mac OS X: not available
  1921. * CarbonLib: not available
  1922. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1923. }
  1924. {
  1925. * OTSetAsynchronous() *** DEPRECATED ***
  1926. *
  1927. * Availability:
  1928. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1929. * CarbonLib: in CarbonLib 1.0 and later
  1930. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1931. }
  1932. function OTSetAsynchronous( ref: ProviderRef ): OSStatus; external name '_OTSetAsynchronous';
  1933. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1934. {
  1935. * OTSetSynchronous() *** DEPRECATED ***
  1936. *
  1937. * Availability:
  1938. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1939. * CarbonLib: in CarbonLib 1.0 and later
  1940. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1941. }
  1942. function OTSetSynchronous( ref: ProviderRef ): OSStatus; external name '_OTSetSynchronous';
  1943. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1944. {
  1945. * OTIsSynchronous() *** DEPRECATED ***
  1946. *
  1947. * Availability:
  1948. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1949. * CarbonLib: in CarbonLib 1.0 and later
  1950. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1951. }
  1952. function OTIsSynchronous( ref: ProviderRef ): Boolean; external name '_OTIsSynchronous';
  1953. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1954. {
  1955. * OTSetBlocking() *** DEPRECATED ***
  1956. *
  1957. * Availability:
  1958. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1959. * CarbonLib: in CarbonLib 1.0 and later
  1960. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1961. }
  1962. function OTSetBlocking( ref: ProviderRef ): OSStatus; external name '_OTSetBlocking';
  1963. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1964. {
  1965. * OTSetNonBlocking() *** DEPRECATED ***
  1966. *
  1967. * Availability:
  1968. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1969. * CarbonLib: in CarbonLib 1.0 and later
  1970. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1971. }
  1972. function OTSetNonBlocking( ref: ProviderRef ): OSStatus; external name '_OTSetNonBlocking';
  1973. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1974. {
  1975. * OTIsBlocking() *** DEPRECATED ***
  1976. *
  1977. * Availability:
  1978. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1979. * CarbonLib: in CarbonLib 1.0 and later
  1980. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1981. }
  1982. function OTIsBlocking( ref: ProviderRef ): Boolean; external name '_OTIsBlocking';
  1983. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1984. {
  1985. * OTInstallNotifier() *** DEPRECATED ***
  1986. *
  1987. * Availability:
  1988. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1989. * CarbonLib: in CarbonLib 1.0 and later
  1990. * Non-Carbon CFM: in OTClientLib 1.0 and later
  1991. }
  1992. function OTInstallNotifier( ref: ProviderRef; proc: OTNotifyUPP; contextPtr: UnivPtr ): OSStatus; external name '_OTInstallNotifier';
  1993. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  1994. {
  1995. * OTUseSyncIdleEvents() *** DEPRECATED ***
  1996. *
  1997. * Availability:
  1998. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  1999. * CarbonLib: in CarbonLib 1.0 and later
  2000. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2001. }
  2002. function OTUseSyncIdleEvents( ref: ProviderRef; useEvents: Boolean ): OSStatus; external name '_OTUseSyncIdleEvents';
  2003. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2004. {
  2005. * OTRemoveNotifier() *** DEPRECATED ***
  2006. *
  2007. * Availability:
  2008. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2009. * CarbonLib: in CarbonLib 1.0 and later
  2010. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2011. }
  2012. procedure OTRemoveNotifier( ref: ProviderRef ); external name '_OTRemoveNotifier';
  2013. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2014. {
  2015. * OTLeaveNotifier() *** DEPRECATED ***
  2016. *
  2017. * Availability:
  2018. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2019. * CarbonLib: in CarbonLib 1.0 and later
  2020. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2021. }
  2022. procedure OTLeaveNotifier( ref: ProviderRef ); external name '_OTLeaveNotifier';
  2023. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2024. {
  2025. * OTEnterNotifier() *** DEPRECATED ***
  2026. *
  2027. * Availability:
  2028. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2029. * CarbonLib: in CarbonLib 1.0 and later
  2030. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2031. }
  2032. function OTEnterNotifier( ref: ProviderRef ): Boolean; external name '_OTEnterNotifier';
  2033. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2034. {
  2035. * OTAckSends() *** DEPRECATED ***
  2036. *
  2037. * Availability:
  2038. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2039. * CarbonLib: in CarbonLib 1.0 and later
  2040. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2041. }
  2042. function OTAckSends( ref: ProviderRef ): OSStatus; external name '_OTAckSends';
  2043. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2044. {
  2045. * OTDontAckSends() *** DEPRECATED ***
  2046. *
  2047. * Availability:
  2048. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2049. * CarbonLib: in CarbonLib 1.0 and later
  2050. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2051. }
  2052. function OTDontAckSends( ref: ProviderRef ): OSStatus; external name '_OTDontAckSends';
  2053. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2054. {
  2055. * OTIsAckingSends() *** DEPRECATED ***
  2056. *
  2057. * Availability:
  2058. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2059. * CarbonLib: in CarbonLib 1.0 and later
  2060. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2061. }
  2062. function OTIsAckingSends( ref: ProviderRef ): Boolean; external name '_OTIsAckingSends';
  2063. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2064. {
  2065. * OTCancelSynchronousCalls() *** DEPRECATED ***
  2066. *
  2067. * Availability:
  2068. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2069. * CarbonLib: in CarbonLib 1.0 and later
  2070. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2071. }
  2072. function OTCancelSynchronousCalls( ref: ProviderRef; err: OSStatus ): OSStatus; external name '_OTCancelSynchronousCalls';
  2073. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2074. // #define OTIsNonBlocking(ref) (!OTIsBlocking(ref))
  2075. // #define OTIsAsynchronous(ref) (!OTIsSynchronous(ref))
  2076. {$endc}
  2077. { ***** Interface to Endpoints *****}
  2078. {$ifc NOT OTKERNEL}
  2079. { Open/Close}
  2080. {
  2081. Under Carbon, the OpenEndpoint routines take a client context pointer. Applications may pass NULL after
  2082. calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  2083. valid client context.
  2084. }
  2085. {
  2086. * OTOpenEndpointInContext() *** DEPRECATED ***
  2087. *
  2088. * Availability:
  2089. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2090. * CarbonLib: in CarbonLib 1.0 and later
  2091. * Non-Carbon CFM: not available
  2092. }
  2093. function OTOpenEndpointInContext( config: OTConfigurationRef; oflag: OTOpenFlags; info: TEndpointInfoPtr { can be NULL }; var err: OSStatus; clientContext: OTClientContextPtr { can be NULL } ): EndpointRef; external name '_OTOpenEndpointInContext';
  2094. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2095. {
  2096. * OTAsyncOpenEndpointInContext() *** DEPRECATED ***
  2097. *
  2098. * Availability:
  2099. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2100. * CarbonLib: in CarbonLib 1.0 and later
  2101. * Non-Carbon CFM: not available
  2102. }
  2103. function OTAsyncOpenEndpointInContext( config: OTConfigurationRef; oflag: OTOpenFlags; info: TEndpointInfoPtr { can be NULL }; upp: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr { can be NULL } ): OSStatus; external name '_OTAsyncOpenEndpointInContext';
  2104. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2105. {
  2106. * OTOpenEndpoint()
  2107. *
  2108. * Availability:
  2109. * Mac OS X: not available
  2110. * CarbonLib: not available
  2111. * Non-Carbon CFM: not available
  2112. }
  2113. {
  2114. * OTAsyncOpenEndpoint()
  2115. *
  2116. * Availability:
  2117. * Mac OS X: not available
  2118. * CarbonLib: not available
  2119. * Non-Carbon CFM: not available
  2120. }
  2121. { The following macros may be used by applications only.}
  2122. // #define OTOpenEndpoint(config, oflag, info, err) OTOpenEndpointInContext(config, oflag, info, err, NULL)
  2123. // #define OTAsyncOpenEndpoint(config, oflag, info, proc, contextPtr) OTAsyncOpenEndpointInContext(config, oflag, info, proc, contextPtr, NULL)
  2124. { Misc Information}
  2125. {
  2126. * OTGetEndpointInfo() *** DEPRECATED ***
  2127. *
  2128. * Availability:
  2129. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2130. * CarbonLib: in CarbonLib 1.0 and later
  2131. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2132. }
  2133. function OTGetEndpointInfo( ref: EndpointRef; var info: TEndpointInfo ): OSStatus; external name '_OTGetEndpointInfo';
  2134. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2135. {
  2136. * OTGetEndpointState() *** DEPRECATED ***
  2137. *
  2138. * Availability:
  2139. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2140. * CarbonLib: in CarbonLib 1.0 and later
  2141. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2142. }
  2143. function OTGetEndpointState( ref: EndpointRef ): OTResult; external name '_OTGetEndpointState';
  2144. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2145. {
  2146. * OTLook() *** DEPRECATED ***
  2147. *
  2148. * Availability:
  2149. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2150. * CarbonLib: in CarbonLib 1.0 and later
  2151. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2152. }
  2153. function OTLook( ref: EndpointRef ): OTResult; external name '_OTLook';
  2154. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2155. {
  2156. * OTSync()
  2157. *
  2158. * Availability:
  2159. * Mac OS X: not available
  2160. * CarbonLib: not available
  2161. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2162. }
  2163. {
  2164. * OTCountDataBytes() *** DEPRECATED ***
  2165. *
  2166. * Availability:
  2167. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2168. * CarbonLib: in CarbonLib 1.0 and later
  2169. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2170. }
  2171. function OTCountDataBytes( ref: EndpointRef; var countPtr: OTByteCount ): OTResult; external name '_OTCountDataBytes';
  2172. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2173. {
  2174. * OTGetProtAddress() *** DEPRECATED ***
  2175. *
  2176. * Availability:
  2177. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2178. * CarbonLib: in CarbonLib 1.0 and later
  2179. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2180. }
  2181. function OTGetProtAddress( ref: EndpointRef; boundAddr: TBindPtr { can be NULL }; peerAddr: TBindPtr { can be NULL } ): OSStatus; external name '_OTGetProtAddress';
  2182. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2183. {
  2184. * OTResolveAddress() *** DEPRECATED ***
  2185. *
  2186. * Availability:
  2187. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2188. * CarbonLib: in CarbonLib 1.0 and later
  2189. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2190. }
  2191. function OTResolveAddress( ref: EndpointRef; var reqAddr: TBind; var retAddr: TBind; timeOut: OTTimeout ): OSStatus; external name '_OTResolveAddress';
  2192. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2193. { Allocating structures}
  2194. {
  2195. Note:
  2196. In general, Apple recommends that you avoid the OTAlloc call because
  2197. using it extensively causes your program to allocate and deallocate
  2198. many memory blocks, with each extra memory allocation costing time.
  2199. }
  2200. {
  2201. Under Carbon, OTAlloc takes a client context pointer. Applications may pass NULL after
  2202. calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  2203. valid client context.
  2204. }
  2205. {
  2206. * OTAllocInContext() *** DEPRECATED ***
  2207. *
  2208. * Availability:
  2209. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2210. * CarbonLib: in CarbonLib 1.0 and later
  2211. * Non-Carbon CFM: not available
  2212. }
  2213. function OTAllocInContext( ref: EndpointRef; structType: OTStructType; fields: UInt32; var err: OSStatus; clientContext: OTClientContextPtr { can be NULL } ): UnivPtr; external name '_OTAllocInContext';
  2214. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2215. {
  2216. * OTAlloc()
  2217. *
  2218. * Availability:
  2219. * Mac OS X: not available
  2220. * CarbonLib: not available
  2221. * Non-Carbon CFM: not available
  2222. }
  2223. { The following macro may be used by applications only.}
  2224. // #define OTAlloc(ref, structType, fields, err) OTAllocInContext(ref, structType, fields, err, NULL)
  2225. {
  2226. * OTFree() *** DEPRECATED ***
  2227. *
  2228. * Availability:
  2229. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2230. * CarbonLib: in CarbonLib 1.0 and later
  2231. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2232. }
  2233. function OTFree( ptr: UnivPtr; structType: OTStructType ): OTResult; external name '_OTFree';
  2234. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2235. { Option management}
  2236. { It looks simple enough...}
  2237. {
  2238. * OTOptionManagement() *** DEPRECATED ***
  2239. *
  2240. * Availability:
  2241. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2242. * CarbonLib: in CarbonLib 1.0 and later
  2243. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2244. }
  2245. function OTOptionManagement( ref: EndpointRef; var req: TOptMgmt; var ret: TOptMgmt ): OSStatus; external name '_OTOptionManagement';
  2246. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2247. { ... but then the hidden complexity emerges.}
  2248. {
  2249. * OTCreateOptions()
  2250. *
  2251. * Availability:
  2252. * Mac OS X: not available
  2253. * CarbonLib: not available
  2254. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  2255. }
  2256. {
  2257. * OTCreateOptionString()
  2258. *
  2259. * Availability:
  2260. * Mac OS X: not available
  2261. * CarbonLib: not available
  2262. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  2263. }
  2264. {
  2265. * OTNextOption() *** DEPRECATED ***
  2266. *
  2267. * Availability:
  2268. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2269. * CarbonLib: in CarbonLib 1.0 and later
  2270. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2271. }
  2272. function OTNextOption( buffer: UInt8Ptr; buflen: UInt32; var prevOptPtr: TOptionPtr ): OSStatus; external name '_OTNextOption';
  2273. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2274. {
  2275. * OTFindOption() *** DEPRECATED ***
  2276. *
  2277. * Availability:
  2278. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2279. * CarbonLib: in CarbonLib 1.0 and later
  2280. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2281. }
  2282. function OTFindOption( buffer: UInt8Ptr; buflen: UInt32; level: OTXTILevel; name: OTXTIName ): TOptionPtr; external name '_OTFindOption';
  2283. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2284. { Bind/Unbind}
  2285. {
  2286. * OTBind() *** DEPRECATED ***
  2287. *
  2288. * Availability:
  2289. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2290. * CarbonLib: in CarbonLib 1.0 and later
  2291. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2292. }
  2293. function OTBind( ref: EndpointRef; reqAddr: TBindPtr { can be NULL }; retAddr: TBindPtr { can be NULL } ): OSStatus; external name '_OTBind';
  2294. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2295. {
  2296. * OTUnbind() *** DEPRECATED ***
  2297. *
  2298. * Availability:
  2299. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2300. * CarbonLib: in CarbonLib 1.0 and later
  2301. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2302. }
  2303. function OTUnbind( ref: EndpointRef ): OSStatus; external name '_OTUnbind';
  2304. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2305. { Connection creation/tear-down}
  2306. {
  2307. * OTConnect() *** DEPRECATED ***
  2308. *
  2309. * Availability:
  2310. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2311. * CarbonLib: in CarbonLib 1.0 and later
  2312. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2313. }
  2314. function OTConnect( ref: EndpointRef; var sndCall: TCall; rcvCall: TCallPtr { can be NULL } ): OSStatus; external name '_OTConnect';
  2315. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2316. {
  2317. * OTRcvConnect() *** DEPRECATED ***
  2318. *
  2319. * Availability:
  2320. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2321. * CarbonLib: in CarbonLib 1.0 and later
  2322. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2323. }
  2324. function OTRcvConnect( ref: EndpointRef; call: TCallPtr { can be NULL } ): OSStatus; external name '_OTRcvConnect';
  2325. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2326. {
  2327. * OTListen() *** DEPRECATED ***
  2328. *
  2329. * Availability:
  2330. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2331. * CarbonLib: in CarbonLib 1.0 and later
  2332. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2333. }
  2334. function OTListen( ref: EndpointRef; var call: TCall ): OSStatus; external name '_OTListen';
  2335. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2336. {
  2337. * OTAccept() *** DEPRECATED ***
  2338. *
  2339. * Availability:
  2340. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2341. * CarbonLib: in CarbonLib 1.0 and later
  2342. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2343. }
  2344. function OTAccept( listener: EndpointRef; worker: EndpointRef; var call: TCall ): OSStatus; external name '_OTAccept';
  2345. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2346. {
  2347. * OTSndDisconnect() *** DEPRECATED ***
  2348. *
  2349. * Availability:
  2350. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2351. * CarbonLib: in CarbonLib 1.0 and later
  2352. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2353. }
  2354. function OTSndDisconnect( ref: EndpointRef; call: TCallPtr { can be NULL } ): OSStatus; external name '_OTSndDisconnect';
  2355. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2356. {
  2357. * OTSndOrderlyDisconnect() *** DEPRECATED ***
  2358. *
  2359. * Availability:
  2360. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2361. * CarbonLib: in CarbonLib 1.0 and later
  2362. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2363. }
  2364. function OTSndOrderlyDisconnect( ref: EndpointRef ): OSStatus; external name '_OTSndOrderlyDisconnect';
  2365. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2366. {
  2367. * OTRcvDisconnect() *** DEPRECATED ***
  2368. *
  2369. * Availability:
  2370. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2371. * CarbonLib: in CarbonLib 1.0 and later
  2372. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2373. }
  2374. function OTRcvDisconnect( ref: EndpointRef; discon: TDisconPtr { can be NULL } ): OSStatus; external name '_OTRcvDisconnect';
  2375. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2376. {
  2377. * OTRcvOrderlyDisconnect() *** DEPRECATED ***
  2378. *
  2379. * Availability:
  2380. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2381. * CarbonLib: in CarbonLib 1.0 and later
  2382. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2383. }
  2384. function OTRcvOrderlyDisconnect( ref: EndpointRef ): OSStatus; external name '_OTRcvOrderlyDisconnect';
  2385. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2386. { Connection-oriented send/receive}
  2387. {
  2388. * OTRcv() *** DEPRECATED ***
  2389. *
  2390. * Availability:
  2391. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2392. * CarbonLib: in CarbonLib 1.0 and later
  2393. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2394. }
  2395. function OTRcv( ref: EndpointRef; buf: UnivPtr; nbytes: OTByteCount; var flags: OTFlags ): OTResult; external name '_OTRcv';
  2396. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2397. {
  2398. * OTSnd() *** DEPRECATED ***
  2399. *
  2400. * Availability:
  2401. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2402. * CarbonLib: in CarbonLib 1.0 and later
  2403. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2404. }
  2405. function OTSnd( ref: EndpointRef; buf: UnivPtr; nbytes: OTByteCount; flags: OTFlags ): OTResult; external name '_OTSnd';
  2406. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2407. { Connectionless send/receive}
  2408. {
  2409. * OTSndUData() *** DEPRECATED ***
  2410. *
  2411. * Availability:
  2412. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2413. * CarbonLib: in CarbonLib 1.0 and later
  2414. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2415. }
  2416. function OTSndUData( ref: EndpointRef; var udata: TUnitData ): OSStatus; external name '_OTSndUData';
  2417. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2418. {
  2419. * OTRcvUData() *** DEPRECATED ***
  2420. *
  2421. * Availability:
  2422. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2423. * CarbonLib: in CarbonLib 1.0 and later
  2424. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2425. }
  2426. function OTRcvUData( ref: EndpointRef; var udata: TUnitData; var flags: OTFlags ): OSStatus; external name '_OTRcvUData';
  2427. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2428. {
  2429. * OTRcvUDErr() *** DEPRECATED ***
  2430. *
  2431. * Availability:
  2432. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2433. * CarbonLib: in CarbonLib 1.0 and later
  2434. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2435. }
  2436. function OTRcvUDErr( ref: EndpointRef; uderr: TUDErrPtr { can be NULL } ): OSStatus; external name '_OTRcvUDErr';
  2437. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2438. { Connection-oriented transactions}
  2439. {
  2440. * OTSndRequest()
  2441. *
  2442. * Availability:
  2443. * Mac OS X: not available
  2444. * CarbonLib: not available
  2445. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2446. }
  2447. {
  2448. * OTRcvReply()
  2449. *
  2450. * Availability:
  2451. * Mac OS X: not available
  2452. * CarbonLib: not available
  2453. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2454. }
  2455. {
  2456. * OTSndReply()
  2457. *
  2458. * Availability:
  2459. * Mac OS X: not available
  2460. * CarbonLib: not available
  2461. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2462. }
  2463. {
  2464. * OTRcvRequest()
  2465. *
  2466. * Availability:
  2467. * Mac OS X: not available
  2468. * CarbonLib: not available
  2469. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2470. }
  2471. {
  2472. * OTCancelRequest()
  2473. *
  2474. * Availability:
  2475. * Mac OS X: not available
  2476. * CarbonLib: not available
  2477. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2478. }
  2479. {
  2480. * OTCancelReply()
  2481. *
  2482. * Availability:
  2483. * Mac OS X: not available
  2484. * CarbonLib: not available
  2485. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2486. }
  2487. { Connectionless transactions}
  2488. {
  2489. * OTSndURequest()
  2490. *
  2491. * Availability:
  2492. * Mac OS X: not available
  2493. * CarbonLib: not available
  2494. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2495. }
  2496. {
  2497. * OTRcvUReply()
  2498. *
  2499. * Availability:
  2500. * Mac OS X: not available
  2501. * CarbonLib: not available
  2502. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2503. }
  2504. {
  2505. * OTSndUReply()
  2506. *
  2507. * Availability:
  2508. * Mac OS X: not available
  2509. * CarbonLib: not available
  2510. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2511. }
  2512. {
  2513. * OTRcvURequest()
  2514. *
  2515. * Availability:
  2516. * Mac OS X: not available
  2517. * CarbonLib: not available
  2518. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2519. }
  2520. {
  2521. * OTCancelURequest()
  2522. *
  2523. * Availability:
  2524. * Mac OS X: not available
  2525. * CarbonLib: not available
  2526. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2527. }
  2528. {
  2529. * OTCancelUReply()
  2530. *
  2531. * Availability:
  2532. * Mac OS X: not available
  2533. * CarbonLib: not available
  2534. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2535. }
  2536. { Interface to Mappers}
  2537. {
  2538. Under Carbon, the OpenMapper routines take a client context pointer. Applications may pass NULL after
  2539. calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  2540. valid client context.
  2541. }
  2542. {
  2543. * OTAsyncOpenMapperInContext() *** DEPRECATED ***
  2544. *
  2545. * Availability:
  2546. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2547. * CarbonLib: in CarbonLib 1.0 and later
  2548. * Non-Carbon CFM: not available
  2549. }
  2550. function OTAsyncOpenMapperInContext( config: OTConfigurationRef; oflag: OTOpenFlags; upp: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr { can be NULL } ): OSStatus; external name '_OTAsyncOpenMapperInContext';
  2551. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2552. {
  2553. * OTOpenMapperInContext() *** DEPRECATED ***
  2554. *
  2555. * Availability:
  2556. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2557. * CarbonLib: in CarbonLib 1.0 and later
  2558. * Non-Carbon CFM: not available
  2559. }
  2560. function OTOpenMapperInContext( config: OTConfigurationRef; oflag: OTOpenFlags; var err: OSStatus; clientContext: OTClientContextPtr { can be NULL } ): MapperRef; external name '_OTOpenMapperInContext';
  2561. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2562. {
  2563. * OTAsyncOpenMapper()
  2564. *
  2565. * Availability:
  2566. * Mac OS X: not available
  2567. * CarbonLib: not available
  2568. * Non-Carbon CFM: not available
  2569. }
  2570. {
  2571. * OTOpenMapper()
  2572. *
  2573. * Availability:
  2574. * Mac OS X: not available
  2575. * CarbonLib: not available
  2576. * Non-Carbon CFM: not available
  2577. }
  2578. { The following macros may be used by applications only.}
  2579. // #define OTAsyncOpenMapper(config, oflag, proc, contextPtr) OTAsyncOpenMapperInContext(config, oflag, proc, contextPtr, NULL)
  2580. // #define OTOpenMapper(config, oflag, err) OTOpenMapperInContext(config, oflag, err, NULL)
  2581. {
  2582. * OTRegisterName() *** DEPRECATED ***
  2583. *
  2584. * Availability:
  2585. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2586. * CarbonLib: in CarbonLib 1.0 and later
  2587. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2588. }
  2589. function OTRegisterName( ref: MapperRef; var req: TRegisterRequest; var reply: TRegisterReply ): OSStatus; external name '_OTRegisterName';
  2590. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2591. {
  2592. * OTDeleteName() *** DEPRECATED ***
  2593. *
  2594. * Availability:
  2595. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2596. * CarbonLib: in CarbonLib 1.0 and later
  2597. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2598. }
  2599. function OTDeleteName( ref: MapperRef; var name: TNetbuf ): OSStatus; external name '_OTDeleteName';
  2600. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2601. {
  2602. * OTDeleteNameByID() *** DEPRECATED ***
  2603. *
  2604. * Availability:
  2605. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2606. * CarbonLib: in CarbonLib 1.0 and later
  2607. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2608. }
  2609. function OTDeleteNameByID( ref: MapperRef; nameID: OTNameID ): OSStatus; external name '_OTDeleteNameByID';
  2610. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2611. {
  2612. * OTLookupName() *** DEPRECATED ***
  2613. *
  2614. * Availability:
  2615. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2616. * CarbonLib: in CarbonLib 1.0 and later
  2617. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2618. }
  2619. function OTLookupName( ref: MapperRef; var req: TLookupRequest; var reply: TLookupReply ): OSStatus; external name '_OTLookupName';
  2620. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2621. { Basic configuration manipulation}
  2622. {
  2623. * OTCreateConfiguration() *** DEPRECATED ***
  2624. *
  2625. * Availability:
  2626. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2627. * CarbonLib: in CarbonLib 1.0 and later
  2628. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  2629. }
  2630. function OTCreateConfiguration( path: ConstCStringPtr ): OTConfigurationRef; external name '_OTCreateConfiguration';
  2631. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2632. {
  2633. * OTCloneConfiguration() *** DEPRECATED ***
  2634. *
  2635. * Availability:
  2636. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2637. * CarbonLib: in CarbonLib 1.0 and later
  2638. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  2639. }
  2640. function OTCloneConfiguration( cfig: OTConfigurationRef ): OTConfigurationRef; external name '_OTCloneConfiguration';
  2641. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2642. {
  2643. * OTDestroyConfiguration() *** DEPRECATED ***
  2644. *
  2645. * Availability:
  2646. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2647. * CarbonLib: in CarbonLib 1.0 and later
  2648. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  2649. }
  2650. procedure OTDestroyConfiguration( cfig: OTConfigurationRef ); external name '_OTDestroyConfiguration';
  2651. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2652. {
  2653. This file defines a very limited set of operations
  2654. on a configuration. "OpenTransportClient.h" extends this with extra
  2655. operations used by protocol stacks but not typically needed by clients.
  2656. }
  2657. { Interrupt-safe memory allocators}
  2658. {
  2659. Under Carbon, OTAllocMem takes a client context pointer. Applications may pass NULL after
  2660. calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  2661. valid client context.
  2662. }
  2663. {
  2664. * OTAllocMemInContext() *** DEPRECATED ***
  2665. *
  2666. * Availability:
  2667. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2668. * CarbonLib: in CarbonLib 1.0 and later
  2669. * Non-Carbon CFM: not available
  2670. }
  2671. function OTAllocMemInContext( size: OTByteCount; clientContext: OTClientContextPtr { can be NULL } ): UnivPtr; external name '_OTAllocMemInContext';
  2672. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2673. {
  2674. * OTAllocMem()
  2675. *
  2676. * Availability:
  2677. * Mac OS X: not available
  2678. * CarbonLib: not available
  2679. * Non-Carbon CFM: not available
  2680. }
  2681. {
  2682. * OTFreeMem() *** DEPRECATED ***
  2683. *
  2684. * Availability:
  2685. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2686. * CarbonLib: in CarbonLib 1.0 and later
  2687. * Non-Carbon CFM: in OTClientUtilLib 1.0 and later
  2688. }
  2689. procedure OTFreeMem( mem: UnivPtr ); external name '_OTFreeMem';
  2690. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2691. { The following macros may be used by applications only.}
  2692. // #define OTAllocMem(s) OTAllocMemInContext(s, NULL)
  2693. { Miscellaneous and Generic Routines}
  2694. {
  2695. Neither of these routines should be necessary to the correct
  2696. operation of an OT program. If you're calling them, think again.
  2697. }
  2698. {
  2699. * OTDelay() *** DEPRECATED ***
  2700. *
  2701. * Availability:
  2702. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2703. * CarbonLib: in CarbonLib 1.0 and later
  2704. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2705. }
  2706. procedure OTDelay( seconds: UInt32 ); external name '_OTDelay';
  2707. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2708. {
  2709. * OTIdle() *** DEPRECATED ***
  2710. *
  2711. * Availability:
  2712. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2713. * CarbonLib: in CarbonLib 1.0 and later
  2714. * Non-Carbon CFM: in OTClientLib 1.0 and later
  2715. }
  2716. procedure OTIdle; external name '_OTIdle';
  2717. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2718. {$endc} { !OTKERNEL }
  2719. {
  2720. ***** Open Transport Utility Routines *****
  2721. All of these routines are available to both client and kernel.
  2722. }
  2723. { Memory and String Routines}
  2724. {
  2725. These are preferable, especially in the kernel case, to the standard
  2726. C equivalents because they don't require you to link with StdCLib.
  2727. }
  2728. {
  2729. * OTMemcpy() *** DEPRECATED ***
  2730. *
  2731. * Availability:
  2732. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2733. * CarbonLib: in CarbonLib 1.0 and later
  2734. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2735. }
  2736. procedure OTMemcpy( dest: UnivPtr; src: {const} UnivPtr; nBytes: OTByteCount ); external name '_OTMemcpy';
  2737. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2738. {
  2739. * OTMemcmp() *** DEPRECATED ***
  2740. *
  2741. * Availability:
  2742. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2743. * CarbonLib: in CarbonLib 1.0 and later
  2744. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2745. }
  2746. function OTMemcmp( mem1: {const} UnivPtr; mem2: {const} UnivPtr; nBytes: OTByteCount ): Boolean; external name '_OTMemcmp';
  2747. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2748. {
  2749. * OTMemmove() *** DEPRECATED ***
  2750. *
  2751. * Availability:
  2752. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2753. * CarbonLib: in CarbonLib 1.0 and later
  2754. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2755. }
  2756. procedure OTMemmove( dest: UnivPtr; src: {const} UnivPtr; nBytes: OTByteCount ); external name '_OTMemmove';
  2757. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2758. {
  2759. * OTMemzero() *** DEPRECATED ***
  2760. *
  2761. * Availability:
  2762. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2763. * CarbonLib: in CarbonLib 1.0 and later
  2764. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2765. }
  2766. procedure OTMemzero( dest: UnivPtr; nBytes: OTByteCount ); external name '_OTMemzero';
  2767. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2768. {
  2769. * OTMemset() *** DEPRECATED ***
  2770. *
  2771. * Availability:
  2772. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2773. * CarbonLib: in CarbonLib 1.0 and later
  2774. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2775. }
  2776. procedure OTMemset( dest: UnivPtr; toSet: OTUInt8Param; nBytes: OTByteCount ); external name '_OTMemset';
  2777. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2778. {
  2779. * OTStrLength() *** DEPRECATED ***
  2780. *
  2781. * Availability:
  2782. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2783. * CarbonLib: in CarbonLib 1.0 and later
  2784. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2785. }
  2786. function OTStrLength( str: ConstCStringPtr ): OTByteCount; external name '_OTStrLength';
  2787. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2788. {
  2789. * OTStrCopy() *** DEPRECATED ***
  2790. *
  2791. * Availability:
  2792. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2793. * CarbonLib: in CarbonLib 1.0 and later
  2794. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2795. }
  2796. procedure OTStrCopy( var dest: char; src: ConstCStringPtr ); external name '_OTStrCopy';
  2797. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2798. {
  2799. * OTStrCat() *** DEPRECATED ***
  2800. *
  2801. * Availability:
  2802. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2803. * CarbonLib: in CarbonLib 1.0 and later
  2804. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2805. }
  2806. procedure OTStrCat( var dest: char; src: ConstCStringPtr ); external name '_OTStrCat';
  2807. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2808. {
  2809. * OTStrEqual() *** DEPRECATED ***
  2810. *
  2811. * Availability:
  2812. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2813. * CarbonLib: in CarbonLib 1.0 and later
  2814. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2815. }
  2816. function OTStrEqual( src1: ConstCStringPtr; src2: ConstCStringPtr ): Boolean; external name '_OTStrEqual';
  2817. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2818. { Timer Utilities}
  2819. {
  2820. OTGetTimeStamp returns time in "tick" numbers, stored in 64 bits.
  2821. This timestamp can be used as a base number for calculating elapsed
  2822. time.
  2823. OTSubtractTimeStamps returns a pointer to the "result" parameter.
  2824. OTGetClockTimeInSecs returns time since Open Transport was initialized
  2825. in seconds.
  2826. }
  2827. type
  2828. OTTimeStamp = UnsignedWide;
  2829. OTTimeStampPtr = ^OTTimeStamp;
  2830. {
  2831. * OTGetTimeStamp() *** DEPRECATED ***
  2832. *
  2833. * Availability:
  2834. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2835. * CarbonLib: in CarbonLib 1.0 and later
  2836. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2837. }
  2838. procedure OTGetTimeStamp( var currentTime: OTTimeStamp ); external name '_OTGetTimeStamp';
  2839. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2840. {
  2841. * OTSubtractTimeStamps() *** DEPRECATED ***
  2842. *
  2843. * Availability:
  2844. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2845. * CarbonLib: in CarbonLib 1.0 and later
  2846. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2847. }
  2848. function OTSubtractTimeStamps( var result: OTTimeStamp; var startTime: OTTimeStamp; var endEnd: OTTimeStamp ): OTTimeStampPtr; external name '_OTSubtractTimeStamps';
  2849. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2850. {
  2851. * OTTimeStampInMilliseconds() *** DEPRECATED ***
  2852. *
  2853. * Availability:
  2854. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2855. * CarbonLib: in CarbonLib 1.0 and later
  2856. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2857. }
  2858. function OTTimeStampInMilliseconds( var delta: OTTimeStamp ): UInt32; external name '_OTTimeStampInMilliseconds';
  2859. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2860. {
  2861. * OTTimeStampInMicroseconds() *** DEPRECATED ***
  2862. *
  2863. * Availability:
  2864. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2865. * CarbonLib: in CarbonLib 1.0 and later
  2866. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2867. }
  2868. function OTTimeStampInMicroseconds( var delta: OTTimeStamp ): UInt32; external name '_OTTimeStampInMicroseconds';
  2869. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2870. {
  2871. * OTElapsedMilliseconds() *** DEPRECATED ***
  2872. *
  2873. * Availability:
  2874. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2875. * CarbonLib: in CarbonLib 1.0 and later
  2876. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2877. }
  2878. function OTElapsedMilliseconds( var startTime: OTTimeStamp ): UInt32; external name '_OTElapsedMilliseconds';
  2879. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2880. {
  2881. * OTElapsedMicroseconds() *** DEPRECATED ***
  2882. *
  2883. * Availability:
  2884. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2885. * CarbonLib: in CarbonLib 1.0 and later
  2886. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2887. }
  2888. function OTElapsedMicroseconds( var startTime: OTTimeStamp ): UInt32; external name '_OTElapsedMicroseconds';
  2889. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2890. {
  2891. * OTGetClockTimeInSecs() *** DEPRECATED ***
  2892. *
  2893. * Availability:
  2894. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2895. * CarbonLib: in CarbonLib 1.0 and later
  2896. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2897. }
  2898. function OTGetClockTimeInSecs: UInt32; external name '_OTGetClockTimeInSecs';
  2899. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2900. { ***** OT Link Element *****}
  2901. {
  2902. When using OT linked lists, all pointers to other elements are
  2903. represented by the OTLink structure. When operating on link
  2904. lists, you always pass in the address of the OTLink on which
  2905. list elements are chained.
  2906. }
  2907. type
  2908. OTLinkPtr = ^OTLink;
  2909. OTLink = record
  2910. fNext: OTLinkPtr;
  2911. end;
  2912. {
  2913. You can use this macro to map from an OTLink field to the
  2914. structure in which it's embedded.
  2915. }
  2916. // #define OTGetLinkObject(link, struc, field) \
  2917. // ((struc*)((char*)(link) - OTOffsetOf(struc, field)))
  2918. { OTLIFO}
  2919. {
  2920. These are functions to implement a LIFO list that is interrupt-safe.
  2921. The only function which is not is OTReverseList. Normally, you create
  2922. a LIFO list, populate it at interrupt time, and then use OTLIFOStealList
  2923. to atomically remove the list, and OTReverseList to flip the list so that
  2924. it is a FIFO list, which tends to be more useful.
  2925. }
  2926. type
  2927. OTLIFOPtr = ^OTLIFO;
  2928. OTLIFO = record
  2929. fHead: OTLinkPtr;
  2930. end;
  2931. {
  2932. This function atomically enqueues the link onto the
  2933. front of the list.
  2934. }
  2935. {
  2936. * OTLIFOEnqueue() *** DEPRECATED ***
  2937. *
  2938. * Availability:
  2939. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2940. * CarbonLib: in CarbonLib 1.0 and later
  2941. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2942. }
  2943. procedure OTLIFOEnqueue( var list: OTLIFO; var link: OTLink ); external name '_OTLIFOEnqueue';
  2944. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2945. {
  2946. This function atomically dequeues the first element
  2947. on the list.
  2948. }
  2949. {
  2950. * OTLIFODequeue() *** DEPRECATED ***
  2951. *
  2952. * Availability:
  2953. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2954. * CarbonLib: in CarbonLib 1.0 and later
  2955. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2956. }
  2957. function OTLIFODequeue( var list: OTLIFO ): OTLinkPtr; external name '_OTLIFODequeue';
  2958. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2959. {
  2960. This function atomically empties the list and returns a
  2961. pointer to the first element on the list.
  2962. }
  2963. {
  2964. * OTLIFOStealList() *** DEPRECATED ***
  2965. *
  2966. * Availability:
  2967. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2968. * CarbonLib: in CarbonLib 1.0 and later
  2969. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2970. }
  2971. function OTLIFOStealList( var list: OTLIFO ): OTLinkPtr; external name '_OTLIFOStealList';
  2972. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2973. {
  2974. This function reverses a list that was stolen by
  2975. OTLIFOStealList. It is NOT atomic. It returns the
  2976. new starting list.
  2977. }
  2978. {
  2979. * OTReverseList() *** DEPRECATED ***
  2980. *
  2981. * Availability:
  2982. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  2983. * CarbonLib: in CarbonLib 1.0 and later
  2984. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  2985. }
  2986. function OTReverseList( var list: OTLink ): OTLinkPtr; external name '_OTReverseList';
  2987. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  2988. { OTList}
  2989. {
  2990. An OTList is a non-interrupt-safe list, but has more features than the
  2991. OTLIFO list. It is a standard singly-linked list.
  2992. }
  2993. {
  2994. The following is the prototype for a list element comparison function,
  2995. which returns true if the element described by linkToCheck matches
  2996. the client criteria (typically held in ref).
  2997. This is only a UPP for CFM-68K clients.
  2998. }
  2999. type
  3000. OTListSearchProcPtr = function( ref: {const} UnivPtr; var linkToCheck: OTLink ): Boolean;
  3001. OTListSearchUPP = OTListSearchProcPtr;
  3002. {
  3003. * NewOTListSearchUPP()
  3004. *
  3005. * Availability:
  3006. * Mac OS X: in version 10.0 and later in CoreServices.framework
  3007. * CarbonLib: in CarbonLib 1.0 and later
  3008. * Non-Carbon CFM: available as macro/inline
  3009. }
  3010. function NewOTListSearchUPP( userRoutine: OTListSearchProcPtr ): OTListSearchUPP; external name '_NewOTListSearchUPP';
  3011. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3012. {
  3013. * DisposeOTListSearchUPP()
  3014. *
  3015. * Availability:
  3016. * Mac OS X: in version 10.0 and later in CoreServices.framework
  3017. * CarbonLib: in CarbonLib 1.0 and later
  3018. * Non-Carbon CFM: available as macro/inline
  3019. }
  3020. procedure DisposeOTListSearchUPP( userUPP: OTListSearchUPP ); external name '_DisposeOTListSearchUPP';
  3021. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3022. {
  3023. * InvokeOTListSearchUPP()
  3024. *
  3025. * Availability:
  3026. * Mac OS X: in version 10.0 and later in CoreServices.framework
  3027. * CarbonLib: in CarbonLib 1.0 and later
  3028. * Non-Carbon CFM: available as macro/inline
  3029. }
  3030. function InvokeOTListSearchUPP( ref: {const} UnivPtr; var linkToCheck: OTLink; userUPP: OTListSearchUPP ): Boolean; external name '_InvokeOTListSearchUPP';
  3031. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3032. type
  3033. OTListPtr = ^OTList;
  3034. OTList = record
  3035. fHead: OTLinkPtr;
  3036. end;
  3037. { Add the link to the list at the front}
  3038. {
  3039. * OTAddFirst() *** DEPRECATED ***
  3040. *
  3041. * Availability:
  3042. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3043. * CarbonLib: in CarbonLib 1.0 and later
  3044. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3045. }
  3046. procedure OTAddFirst( var list: OTList; var link: OTLink ); external name '_OTAddFirst';
  3047. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3048. { Add the link to the list at the end}
  3049. {
  3050. * OTAddLast() *** DEPRECATED ***
  3051. *
  3052. * Availability:
  3053. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3054. * CarbonLib: in CarbonLib 1.0 and later
  3055. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3056. }
  3057. procedure OTAddLast( var list: OTList; var link: OTLink ); external name '_OTAddLast';
  3058. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3059. { Remove the first link from the list}
  3060. {
  3061. * OTRemoveFirst() *** DEPRECATED ***
  3062. *
  3063. * Availability:
  3064. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3065. * CarbonLib: in CarbonLib 1.0 and later
  3066. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3067. }
  3068. function OTRemoveFirst( var list: OTList ): OTLinkPtr; external name '_OTRemoveFirst';
  3069. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3070. { Remove the last link from the list}
  3071. {
  3072. * OTRemoveLast() *** DEPRECATED ***
  3073. *
  3074. * Availability:
  3075. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3076. * CarbonLib: in CarbonLib 1.0 and later
  3077. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3078. }
  3079. function OTRemoveLast( var list: OTList ): OTLinkPtr; external name '_OTRemoveLast';
  3080. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3081. { Return the first link from the list}
  3082. {
  3083. * OTGetFirst() *** DEPRECATED ***
  3084. *
  3085. * Availability:
  3086. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3087. * CarbonLib: in CarbonLib 1.0 and later
  3088. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3089. }
  3090. function OTGetFirst( var list: OTList ): OTLinkPtr; external name '_OTGetFirst';
  3091. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3092. { Return the last link from the list}
  3093. {
  3094. * OTGetLast() *** DEPRECATED ***
  3095. *
  3096. * Availability:
  3097. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3098. * CarbonLib: in CarbonLib 1.0 and later
  3099. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3100. }
  3101. function OTGetLast( var list: OTList ): OTLinkPtr; external name '_OTGetLast';
  3102. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3103. { Return true if the link is present in the list}
  3104. {
  3105. * OTIsInList() *** DEPRECATED ***
  3106. *
  3107. * Availability:
  3108. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3109. * CarbonLib: in CarbonLib 1.0 and later
  3110. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3111. }
  3112. function OTIsInList( var list: OTList; var link: OTLink ): Boolean; external name '_OTIsInList';
  3113. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3114. {
  3115. Find a link in the list which matches the search criteria
  3116. established by the search proc and the refPtr. This is done
  3117. by calling the search proc, passing it the refPtr and each
  3118. link in the list, until the search proc returns true.
  3119. NULL is returned if the search proc never returned true.
  3120. }
  3121. {
  3122. * OTFindLink() *** DEPRECATED ***
  3123. *
  3124. * Availability:
  3125. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3126. * CarbonLib: in CarbonLib 1.0 and later
  3127. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3128. }
  3129. function OTFindLink( var list: OTList; proc: OTListSearchUPP; ref: {const} UnivPtr ): OTLinkPtr; external name '_OTFindLink';
  3130. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3131. { Remove the specified link from the list, returning true if it was found}
  3132. {
  3133. * OTRemoveLink() *** DEPRECATED ***
  3134. *
  3135. * Availability:
  3136. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3137. * CarbonLib: in CarbonLib 1.0 and later
  3138. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3139. }
  3140. function OTRemoveLink( var list: OTList; var link: OTLink ): Boolean; external name '_OTRemoveLink';
  3141. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3142. { Similar to OTFindLink, but it also removes it from the list.}
  3143. {
  3144. * OTFindAndRemoveLink() *** DEPRECATED ***
  3145. *
  3146. * Availability:
  3147. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3148. * CarbonLib: in CarbonLib 1.0 and later
  3149. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3150. }
  3151. function OTFindAndRemoveLink( var list: OTList; proc: OTListSearchUPP; ref: {const} UnivPtr ): OTLinkPtr; external name '_OTFindAndRemoveLink';
  3152. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3153. { Return the "index"th link in the list}
  3154. {
  3155. * OTGetIndexedLink() *** DEPRECATED ***
  3156. *
  3157. * Availability:
  3158. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3159. * CarbonLib: in CarbonLib 1.0 and later
  3160. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3161. }
  3162. function OTGetIndexedLink( var list: OTList; index: OTItemCount ): OTLinkPtr; external name '_OTGetIndexedLink';
  3163. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3164. { OTEnqueue/OTDequeue}
  3165. {
  3166. These routines are atomic, mighty weird, and generally not
  3167. worth the complexity. If you need atomic list operations,
  3168. use OTLIFO instead.
  3169. }
  3170. {
  3171. This function puts "object" on the listHead, and places the
  3172. previous value at listHead into the pointer at "object" plus
  3173. linkOffset.
  3174. }
  3175. {
  3176. * OTEnqueue() *** DEPRECATED ***
  3177. *
  3178. * Availability:
  3179. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3180. * CarbonLib: in CarbonLib 1.0 and later
  3181. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3182. }
  3183. procedure OTEnqueue( var listHead: UnivPtr; objct: UnivPtr; linkOffset: OTByteCount ); external name '_OTEnqueue';
  3184. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3185. {
  3186. This function returns the head object of the list, and places
  3187. the pointer at "object" + linkOffset into the listHead
  3188. }
  3189. {
  3190. * OTDequeue() *** DEPRECATED ***
  3191. *
  3192. * Availability:
  3193. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3194. * CarbonLib: in CarbonLib 1.0 and later
  3195. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3196. }
  3197. function OTDequeue( var listHead: UnivPtr; linkOffset: OTByteCount ): UnivPtr; external name '_OTDequeue';
  3198. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3199. { Atomic Operations}
  3200. {
  3201. Note:
  3202. The Bit operations return the previous value of the bit (0 or non-zero).
  3203. The memory pointed to must be a single byte and only bits 0 through 7 are
  3204. valid. Bit 0 corresponds to a mask of 0x01, and Bit 7 to a mask of 0x80.
  3205. }
  3206. {
  3207. WARNING!
  3208. void* and UInt32 locations MUST be on 4-byte boundaries.
  3209. UInt16 locations must not cross a 4-byte boundary.
  3210. }
  3211. {
  3212. * OTAtomicSetBit() *** DEPRECATED ***
  3213. *
  3214. * Availability:
  3215. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3216. * CarbonLib: in CarbonLib 1.0 and later
  3217. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3218. }
  3219. function OTAtomicSetBit( bytePtr: UInt8Ptr; bitNumber: OTByteCount ): Boolean; external name '_OTAtomicSetBit';
  3220. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3221. {
  3222. bset.b d0,(a0)
  3223. sne d0
  3224. moveq #1,d1
  3225. and.l d1,d0
  3226. }
  3227. {
  3228. * OTAtomicClearBit() *** DEPRECATED ***
  3229. *
  3230. * Availability:
  3231. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3232. * CarbonLib: in CarbonLib 1.0 and later
  3233. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3234. }
  3235. function OTAtomicClearBit( bytePtr: UInt8Ptr; bitNumber: OTByteCount ): Boolean; external name '_OTAtomicClearBit';
  3236. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3237. {
  3238. bclr.b d0,(a0)
  3239. sne d0
  3240. moveq #1,d1
  3241. and.l d1,d0
  3242. }
  3243. {
  3244. * OTAtomicTestBit() *** DEPRECATED ***
  3245. *
  3246. * Availability:
  3247. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3248. * CarbonLib: in CarbonLib 1.0 and later
  3249. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3250. }
  3251. function OTAtomicTestBit( bytePtr: UInt8Ptr; bitNumber: OTByteCount ): Boolean; external name '_OTAtomicTestBit';
  3252. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3253. {
  3254. btst.b d0,(a0)
  3255. sne d0 *|
  3256. moveq #1,d1
  3257. and.l d1,d0 *|
  3258. }
  3259. {
  3260. * OTCompareAndSwapPtr() *** DEPRECATED ***
  3261. *
  3262. * Availability:
  3263. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3264. * CarbonLib: in CarbonLib 1.0 and later
  3265. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3266. }
  3267. function OTCompareAndSwapPtr( oldValue: UnivPtr; newValue: UnivPtr; var dest: UnivPtr ): Boolean; external name '_OTCompareAndSwapPtr';
  3268. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3269. {
  3270. cas.l d0,d1,(a0) *|
  3271. seq d0 *|
  3272. moveq #1,d1; and.l d1,d0 *|
  3273. }
  3274. {
  3275. * OTCompareAndSwap32() *** DEPRECATED ***
  3276. *
  3277. * Availability:
  3278. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3279. * CarbonLib: in CarbonLib 1.0 and later
  3280. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3281. }
  3282. function OTCompareAndSwap32( oldValue: UInt32; newValue: UInt32; var dest: UInt32 ): Boolean; external name '_OTCompareAndSwap32';
  3283. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3284. {
  3285. cas.l d0,d1,(a0) *|
  3286. seq d0 *|
  3287. moveq #1,d1; and.l d1,d0 *|
  3288. }
  3289. {
  3290. * OTCompareAndSwap16() *** DEPRECATED ***
  3291. *
  3292. * Availability:
  3293. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3294. * CarbonLib: in CarbonLib 1.0 and later
  3295. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3296. }
  3297. function OTCompareAndSwap16( oldValue: UInt32; newValue: UInt32; var dest: UInt16 ): Boolean; external name '_OTCompareAndSwap16';
  3298. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3299. {
  3300. cas.w d0,d1,(a0) *|
  3301. seq d0 *|
  3302. moveq #1,d1; and.l d1,d0 *|
  3303. }
  3304. {
  3305. * OTCompareAndSwap8() *** DEPRECATED ***
  3306. *
  3307. * Availability:
  3308. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3309. * CarbonLib: in CarbonLib 1.0 and later
  3310. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3311. }
  3312. function OTCompareAndSwap8( oldValue: UInt32; newValue: UInt32; var dest: UInt8 ): Boolean; external name '_OTCompareAndSwap8';
  3313. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3314. {
  3315. cas.b d0,d1,(a0) *|
  3316. seq d0 *|
  3317. moveq #1,d1; and.l d1,d0 *|
  3318. }
  3319. {
  3320. * OTAtomicAdd32() *** DEPRECATED ***
  3321. *
  3322. * Availability:
  3323. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3324. * CarbonLib: in CarbonLib 1.0 and later
  3325. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3326. }
  3327. function OTAtomicAdd32( toAdd: SInt32; var dest: SInt32 ): SInt32; external name '_OTAtomicAdd32';
  3328. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3329. {
  3330. move.l d0,a1 *|
  3331. move.l (a0),d1 *|
  3332. move.l d1,d0 *|
  3333. add.l a1,d0 *|
  3334. cas.l d1,d0,(a0) *|
  3335. bne.s @1 *|
  3336. }
  3337. {
  3338. * OTAtomicAdd16() *** DEPRECATED ***
  3339. *
  3340. * Availability:
  3341. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3342. * CarbonLib: in CarbonLib 1.0 and later
  3343. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3344. }
  3345. function OTAtomicAdd16( toAdd: SInt32; var dest: SInt16 ): SInt16; external name '_OTAtomicAdd16';
  3346. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3347. { Not used frequently enough to justify inlining.}
  3348. {
  3349. * OTAtomicAdd8() *** DEPRECATED ***
  3350. *
  3351. * Availability:
  3352. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.4
  3353. * CarbonLib: in CarbonLib 1.0 and later
  3354. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3355. }
  3356. function OTAtomicAdd8( toAdd: SInt32; var dest: SInt8 ): SInt8; external name '_OTAtomicAdd8';
  3357. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)
  3358. { Not used frequently enough to justify inlining.}
  3359. { OTLock is just a convenience type with some convenient macros.}
  3360. type
  3361. OTLock = UInt8;
  3362. // #define OTClearLock(lockPtr) *(lockPtr) = 0
  3363. // #define OTAcquireLock(lockPtr) (OTAtomicSetBit(lockPtr, 0) == 0)
  3364. {******************************************************************************
  3365. **
  3366. ** FROM HERE ON DOWN ARE THE C++ Interfaces to Open Transport
  3367. **
  3368. *******************************************************************************}
  3369. end.