NSLCore.pas 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. {
  2. File: NSLCore.p
  3. Contains: Interface to API for using the NSL Manager
  4. Version: Technology: Mac OS X
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1985-2002 by Apple Computer, Inc., all rights reserved
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  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 NSLCore;
  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,CodeFragments,Files,Threads;
  92. {$ALIGN MAC68K}
  93. const
  94. kNSLMinSystemVersion = $0900; { equivalent to 9.0 }
  95. kNSLMinOTVersion = $0130; { equivalent to 1.3 }
  96. kNSLDefaultListSize = 256; { default list size for service and protocol lists }
  97. kNSLURLDelimiter = 44; { delimits URL's within memory buffers }
  98. kNSLNoContext = 0; { the default context for NSLError structs }
  99. type
  100. NSLErrorPtr = ^NSLError;
  101. NSLError = record
  102. theErr: OSStatus;
  103. theContext: UInt32;
  104. end;
  105. const
  106. { Constants to use with NSLPrepareRequest }
  107. { kNSLDuplicateSearchInProgress is not strictly an error. The client is free to ignore }
  108. { this result, and nothing bad will happen if it does. It is }
  109. { informational only. }
  110. kNSLDuplicateSearchInProgress = 100;
  111. kNSLUserCanceled = -128; { User hit cancel from the NSLStandardGetURL dialog }
  112. { Invalid enumeratorRef }
  113. kNSLInvalidEnumeratorRef = 0; { this is not an error; it is the equiv to a NULL ptr }
  114. type
  115. NSLSearchState = UInt16;
  116. const
  117. { State codes for notifiers. }
  118. kNSLSearchStateBufferFull = 1;
  119. kNSLSearchStateOnGoing = 2;
  120. kNSLSearchStateComplete = 3;
  121. kNSLSearchStateStalled = 4;
  122. kNSLWaitingForContinue = 5;
  123. type
  124. NSLEventCode = UInt32;
  125. const
  126. { Event codes }
  127. kNSLServicesLookupDataEvent = 6;
  128. kNSLNeighborhoodLookupDataEvent = 7;
  129. kNSLNewDataEvent = 8;
  130. kNSLContinueLookupEvent = 9;
  131. type
  132. NSLClientRef = UInt32;
  133. NSLRequestRef = UInt32;
  134. NSLOneBasedIndex = UInt32;
  135. NSLPath = ^char;
  136. NSLServiceType = ^char;
  137. NSLServicesList = Handle;
  138. NSLNeighborhood = ^UInt8;
  139. {
  140. cstring which is a comma delimited list of protocols which can be used to
  141. create a NSLProtocolList internally
  142. }
  143. { the async information block for client<->manager interaction }
  144. NSLClientAsyncInfoPtr = ^NSLClientAsyncInfo;
  145. NSLClientAsyncInfo = record
  146. clientContextPtr: Ptr; { set by the client for its own use }
  147. mgrContextPtr: Ptr; { set by NSL mgr; ptr to request object ptr }
  148. resultBuffer: CStringPtr;
  149. bufferLen: SInt32;
  150. maxBufferSize: SInt32;
  151. startTime: UInt32; { when the search starts, to use with maxSearchTime to determine time-out condition }
  152. intStartTime: UInt32; { used with alertInterval }
  153. maxSearchTime: UInt32; { total time for search, in ticks (0 == no time limit) }
  154. alertInterval: UInt32; { call client's notifier or return, every this many ticks ( 0 == don't use this param) }
  155. totalItems: UInt32; { total number of tuples currently in buffer }
  156. alertThreshold: UInt32; { call client's notifier or return, every this many items found ( 0 == don't use this param) }
  157. searchState: NSLSearchState;
  158. searchResult: NSLError;
  159. searchDataType: NSLEventCode; { this is a data type code which allows the client's asyncNotifier to properly }
  160. { handle the data in resultBuffer. }
  161. end;
  162. { the async information block plugin<->manager interaction }
  163. NSLPluginAsyncInfoPtr = ^NSLPluginAsyncInfo;
  164. NSLPluginAsyncInfo = record
  165. mgrContextPtr: Ptr; { set by NSL mgr; ptr to request object ptr }
  166. pluginContextPtr: Ptr; { set/used by individual plugins }
  167. pluginPtr: Ptr; { ptr to the plugin object waiting for continue lookup call }
  168. resultBuffer: CStringPtr; { set by plugin to point at data }
  169. bufferLen: SInt32;
  170. maxBufferSize: SInt32;
  171. maxSearchTime: UInt32; { total time for search, in ticks (0 == no time limit) }
  172. reserved1: UInt32;
  173. reserved2: UInt32;
  174. reserved3: UInt32;
  175. clientRef: NSLClientRef;
  176. requestRef: NSLRequestRef;
  177. searchState: NSLSearchState;
  178. searchResult: OSStatus;
  179. end;
  180. { the manager asynchronous notifier routine. }
  181. {$ifc TYPED_FUNCTION_POINTERS}
  182. NSLMgrNotifyProcPtr = procedure(var thePluginAsyncInfo: NSLPluginAsyncInfo);
  183. {$elsec}
  184. NSLMgrNotifyProcPtr = ProcPtr;
  185. {$endc}
  186. { the client asynchronous notifier routine. }
  187. {$ifc TYPED_FUNCTION_POINTERS}
  188. NSLClientNotifyProcPtr = procedure(var theClientAsyncInfo: NSLClientAsyncInfo);
  189. {$elsec}
  190. NSLClientNotifyProcPtr = ProcPtr;
  191. {$endc}
  192. {$ifc OPAQUE_UPP_TYPES}
  193. NSLMgrNotifyUPP = ^SInt32; { an opaque UPP }
  194. {$elsec}
  195. NSLMgrNotifyUPP = UniversalProcPtr;
  196. {$endc}
  197. {$ifc OPAQUE_UPP_TYPES}
  198. NSLClientNotifyUPP = ^SInt32; { an opaque UPP }
  199. {$elsec}
  200. NSLClientNotifyUPP = UniversalProcPtr;
  201. {$endc}
  202. const
  203. uppNSLMgrNotifyProcInfo = $000000C0;
  204. uppNSLClientNotifyProcInfo = $000000C0;
  205. {
  206. * NewNSLMgrNotifyUPP()
  207. *
  208. * Availability:
  209. * Non-Carbon CFM: available as macro/inline
  210. * CarbonLib: in CarbonLib 1.0 and later
  211. * Mac OS X: in version 10.0 and later
  212. }
  213. function NewNSLMgrNotifyUPP(userRoutine: NSLMgrNotifyProcPtr): NSLMgrNotifyUPP; external name '_NewNSLMgrNotifyUPP'; { old name was NewNSLMgrNotifyProc }
  214. {
  215. * NewNSLClientNotifyUPP()
  216. *
  217. * Availability:
  218. * Non-Carbon CFM: available as macro/inline
  219. * CarbonLib: in CarbonLib 1.0 and later
  220. * Mac OS X: in version 10.0 and later
  221. }
  222. function NewNSLClientNotifyUPP(userRoutine: NSLClientNotifyProcPtr): NSLClientNotifyUPP; external name '_NewNSLClientNotifyUPP'; { old name was NewNSLClientNotifyProc }
  223. {
  224. * DisposeNSLMgrNotifyUPP()
  225. *
  226. * Availability:
  227. * Non-Carbon CFM: available as macro/inline
  228. * CarbonLib: in CarbonLib 1.0 and later
  229. * Mac OS X: in version 10.0 and later
  230. }
  231. procedure DisposeNSLMgrNotifyUPP(userUPP: NSLMgrNotifyUPP); external name '_DisposeNSLMgrNotifyUPP';
  232. {
  233. * DisposeNSLClientNotifyUPP()
  234. *
  235. * Availability:
  236. * Non-Carbon CFM: available as macro/inline
  237. * CarbonLib: in CarbonLib 1.0 and later
  238. * Mac OS X: in version 10.0 and later
  239. }
  240. procedure DisposeNSLClientNotifyUPP(userUPP: NSLClientNotifyUPP); external name '_DisposeNSLClientNotifyUPP';
  241. {
  242. * InvokeNSLMgrNotifyUPP()
  243. *
  244. * Availability:
  245. * Non-Carbon CFM: available as macro/inline
  246. * CarbonLib: in CarbonLib 1.0 and later
  247. * Mac OS X: in version 10.0 and later
  248. }
  249. procedure InvokeNSLMgrNotifyUPP(var thePluginAsyncInfo: NSLPluginAsyncInfo; userRoutine: NSLMgrNotifyUPP); external name '_InvokeNSLMgrNotifyUPP'; { old name was CallNSLMgrNotifyProc }
  250. {
  251. * InvokeNSLClientNotifyUPP()
  252. *
  253. * Availability:
  254. * Non-Carbon CFM: available as macro/inline
  255. * CarbonLib: in CarbonLib 1.0 and later
  256. * Mac OS X: in version 10.0 and later
  257. }
  258. procedure InvokeNSLClientNotifyUPP(var theClientAsyncInfo: NSLClientAsyncInfo; userRoutine: NSLClientNotifyUPP); external name '_InvokeNSLClientNotifyUPP'; { old name was CallNSLClientNotifyProc }
  259. {
  260. this struct is a format for dealing with our internal data representation. Typed data will be contiguous chunk of
  261. memory, with the first 4 bytes being a data "descriptor".
  262. }
  263. type
  264. NSLTypedDataPtr = ^NSLTypedData;
  265. NSLTypedData = record
  266. dataType: UInt32;
  267. lengthOfData: UInt32;
  268. end;
  269. {
  270. This is just a header at the beginning of a handle that stores our list of service types.
  271. Each service type is a pascal string, so each service type starts after the end of the
  272. previous one.
  273. }
  274. NSLServicesListHeaderPtr = ^NSLServicesListHeader;
  275. NSLServicesListHeader = record
  276. numServices: UInt32;
  277. logicalLen: UInt32; { length of all usable data in handle }
  278. end;
  279. { some defs for common protocols }
  280. {
  281. general information from a plug-in. Includes supported protocols, data types and services,
  282. as well as an info/comment string describing the function of the plug-in in human-readable
  283. form. The offsets point to the beginning of each list of data returned, and the protocol
  284. data offset is the startOfData member of the struct
  285. }
  286. NSLPluginDataPtr = ^NSLPluginData;
  287. NSLPluginData = record
  288. reserved1: SInt32;
  289. reserved2: SInt32;
  290. reserved3: SInt32;
  291. supportsRegistration: boolean;
  292. isPurgeable: boolean;
  293. totalLen: UInt16; { length of everything, including header }
  294. dataTypeOffset: UInt16;
  295. serviceListOffset: UInt16;
  296. protocolListOffset: UInt16;
  297. commentStringOffset: UInt16;
  298. { protocol data is first on the list }
  299. end;
  300. {
  301. -----------------------------------------------------------------------------
  302. Finding out if the library is present and getting its version
  303. -----------------------------------------------------------------------------
  304. }
  305. {
  306. * NSLLibraryVersion()
  307. *
  308. * Availability:
  309. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  310. * CarbonLib: in CarbonLib 1.0 and later
  311. * Mac OS X: in version 10.0 and later
  312. }
  313. function NSLLibraryVersion: UInt32; external name '_NSLLibraryVersion';
  314. {
  315. NSLLibraryPresent() is a macro available only in C/C++.
  316. }
  317. {
  318. -----------------------------------------------------------------------------
  319. High level API calls: the following two calls are ALL an application needs
  320. to register/deregister its service.
  321. If you use these, you don't need to make any of the other calls to NSLAPI
  322. (including NSLOpenNavigationAPI)
  323. -----------------------------------------------------------------------------
  324. }
  325. { <--- error code from registration }
  326. { ---> urlToRegister is a null terminated url that has only legal characters defined for URLs. Use HexEncodeText to encode}
  327. { portions of the url that have illegal characters }
  328. { ---> neighborhoodToRegisterIn is an optional parameter for explicitly defining a neighborhood to register in.
  329. If parameter is NULL, then the plugins will determine where to register the service }
  330. {
  331. * NSLStandardRegisterURL()
  332. *
  333. * Availability:
  334. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  335. * CarbonLib: in CarbonLib 1.0 and later
  336. * Mac OS X: in version 10.0 and later
  337. }
  338. function NSLStandardRegisterURL(urlToRegister: NSLPath; neighborhoodToRegisterIn: NSLNeighborhood): NSLError; external name '_NSLStandardRegisterURL';
  339. { <--- error code from registration }
  340. { ---> urlToRegister is a null terminated url that has only legal characters defined for URLs. Use HexEncodeText to encode}
  341. { portions of the url that have illegal characters }
  342. { ---> neighborhoodToDeregisterIn is an optional parameter for explicitly defining a neighborhood to register in.
  343. If parameter is NULL, then the plugins will determine where to register the service }
  344. {
  345. * NSLStandardDeregisterURL()
  346. *
  347. * Availability:
  348. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  349. * CarbonLib: in CarbonLib 1.0 and later
  350. * Mac OS X: in version 10.0 and later
  351. }
  352. function NSLStandardDeregisterURL(urlToDeregister: NSLPath; neighborhoodToDeregisterIn: NSLNeighborhood): NSLError; external name '_NSLStandardDeregisterURL';
  353. { ----------------------------------------------------------------------------- }
  354. {
  355. * NSLHexEncodeText()
  356. *
  357. * Availability:
  358. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  359. * CarbonLib: in CarbonLib 1.0 and later
  360. * Mac OS X: in version 10.0 and later
  361. }
  362. function NSLHexEncodeText(rawText: ConstCStringPtr; rawTextLen: UInt16; newTextBuffer: CStringPtr; var newTextBufferLen: UInt16; var textChanged: boolean): OSStatus; external name '_NSLHexEncodeText';
  363. {
  364. * NSLHexDecodeText()
  365. *
  366. * Availability:
  367. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  368. * CarbonLib: in CarbonLib 1.0 and later
  369. * Mac OS X: in version 10.0 and later
  370. }
  371. function NSLHexDecodeText(encodedText: ConstCStringPtr; encodedTextLen: UInt16; decodedTextBuffer: CStringPtr; var decodedTextBufferLen: UInt16; var textChanged: boolean): OSStatus; external name '_NSLHexDecodeText';
  372. {
  373. -----------------------------------------------------------------------------
  374. Basic API Utility calls: sufficient to create, and parse data structures
  375. -----------------------------------------------------------------------------
  376. }
  377. {
  378. * NSLMakeNewServicesList()
  379. *
  380. * Availability:
  381. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  382. * CarbonLib: in CarbonLib 1.0 and later
  383. * Mac OS X: in version 10.0 and later
  384. }
  385. function NSLMakeNewServicesList(initialServiceList: ConstCStringPtr): NSLServicesList; external name '_NSLMakeNewServicesList';
  386. {
  387. * NSLAddServiceToServicesList()
  388. *
  389. * Availability:
  390. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  391. * CarbonLib: in CarbonLib 1.0 and later
  392. * Mac OS X: in version 10.0 and later
  393. }
  394. function NSLAddServiceToServicesList(serviceList: NSLServicesList; serviceType: NSLServiceType): NSLError; external name '_NSLAddServiceToServicesList';
  395. {
  396. * NSLDisposeServicesList()
  397. *
  398. * Availability:
  399. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  400. * CarbonLib: in CarbonLib 1.0 and later
  401. * Mac OS X: in version 10.0 and later
  402. }
  403. procedure NSLDisposeServicesList(theList: NSLServicesList); external name '_NSLDisposeServicesList';
  404. {
  405. The name reflects the name of the Neighborhood, i.e. "apple.com." or "AppleTalk Zone One".
  406. The protocolList is a comma delimited list of protocols that the Neighborhood might exist in.
  407. If the user passes in NULL, then all protocols will be queried. The result must be disposed
  408. of by the user by calling NSLFreeNeighborhood.
  409. }
  410. {
  411. * NSLMakeNewNeighborhood()
  412. *
  413. * Availability:
  414. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  415. * CarbonLib: in CarbonLib 1.0 and later
  416. * Mac OS X: in version 10.0 and later
  417. }
  418. function NSLMakeNewNeighborhood(name: ConstCStringPtr; protocolList: ConstCStringPtr): NSLNeighborhood; external name '_NSLMakeNewNeighborhood';
  419. { creates an exact copy of an existing neighborhood }
  420. {
  421. * NSLCopyNeighborhood()
  422. *
  423. * Availability:
  424. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  425. * CarbonLib: in CarbonLib 1.0 and later
  426. * Mac OS X: in version 10.0 and later
  427. }
  428. function NSLCopyNeighborhood(neighborhood: NSLNeighborhood): NSLNeighborhood; external name '_NSLCopyNeighborhood';
  429. {
  430. * NSLFreeNeighborhood()
  431. *
  432. * Availability:
  433. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  434. * CarbonLib: in CarbonLib 1.0 and later
  435. * Mac OS X: in version 10.0 and later
  436. }
  437. function NSLFreeNeighborhood(neighborhood: NSLNeighborhood): NSLNeighborhood; external name '_NSLFreeNeighborhood';
  438. {
  439. * NSLGetNameFromNeighborhood()
  440. *
  441. * Availability:
  442. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  443. * CarbonLib: in CarbonLib 1.0 and later
  444. * Mac OS X: in version 10.0 and later
  445. }
  446. procedure NSLGetNameFromNeighborhood(neighborhood: NSLNeighborhood; var name: CStringPtr; var length: SInt32); external name '_NSLGetNameFromNeighborhood';
  447. {
  448. create a block of formatted data, pointed to by newDataPtr. This will be used
  449. in calls (typically request-related calls) for plug-ins that handle the NSL data type.
  450. }
  451. {
  452. * NSLMakeServicesRequestPB()
  453. *
  454. * Availability:
  455. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  456. * CarbonLib: in CarbonLib 1.0 and later
  457. * Mac OS X: in version 10.0 and later
  458. }
  459. function NSLMakeServicesRequestPB(serviceList: NSLServicesList; var newDataPtr: NSLTypedDataPtr): OSStatus; external name '_NSLMakeServicesRequestPB';
  460. { releases any storage created with MakeXXXPB calls, associated with TypedData. }
  461. {
  462. * NSLFreeTypedDataPtr()
  463. *
  464. * Availability:
  465. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  466. * CarbonLib: in CarbonLib 1.0 and later
  467. * Mac OS X: in version 10.0 and later
  468. }
  469. function NSLFreeTypedDataPtr(nslTypeData: NSLTypedDataPtr): NSLTypedDataPtr; external name '_NSLFreeTypedDataPtr';
  470. {
  471. utility function that returns whether a url was found, a pointer to the beginning
  472. of the url, and the length of the URL.
  473. }
  474. {
  475. * NSLGetNextUrl()
  476. *
  477. * Availability:
  478. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  479. * CarbonLib: in CarbonLib 1.0 and later
  480. * Mac OS X: in version 10.0 and later
  481. }
  482. function NSLGetNextUrl(infoPtr: NSLClientAsyncInfoPtr; var urlPtr: CStringPtr; var urlLength: SInt32): boolean; external name '_NSLGetNextUrl';
  483. {
  484. utility function that returns whether a Neighborhood was found, a pointer to the beginning
  485. of the Neighborhood, and the length of the Neighborhood.
  486. }
  487. {
  488. * NSLGetNextNeighborhood()
  489. *
  490. * Availability:
  491. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  492. * CarbonLib: in CarbonLib 1.0 and later
  493. * Mac OS X: in version 10.0 and later
  494. }
  495. function NSLGetNextNeighborhood(infoPtr: NSLClientAsyncInfoPtr; var neighborhood: NSLNeighborhood; var neighborhoodLength: SInt32): boolean; external name '_NSLGetNextNeighborhood';
  496. {
  497. NSLErrorToString: convert a numeric error code to its string equivalent. Caller must
  498. have allocated sufficient space to store both strings. (Max 255 chars each)
  499. The errorString parameter will return a textual explanation of what is wrong,
  500. while the solutionString returns a possible solution to get around the problem
  501. }
  502. {
  503. * NSLErrorToString()
  504. *
  505. * Availability:
  506. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  507. * CarbonLib: in CarbonLib 1.0 and later
  508. * Mac OS X: in version 10.0 and later
  509. }
  510. function NSLErrorToString(theErr: NSLError; errorString: CStringPtr; solutionString: CStringPtr): OSStatus; external name '_NSLErrorToString';
  511. {
  512. -----------------------------------------------------------------------------
  513. Basic API calls: sufficient to create simple requests, and receive answers
  514. -----------------------------------------------------------------------------
  515. }
  516. {
  517. * NSLOpenNavigationAPI()
  518. *
  519. * Availability:
  520. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  521. * CarbonLib: in CarbonLib 1.0 and later
  522. * Mac OS X: in version 10.0 and later
  523. }
  524. function NSLOpenNavigationAPI(var newRef: NSLClientRef): OSStatus; external name '_NSLOpenNavigationAPI';
  525. {
  526. * NSLCloseNavigationAPI()
  527. *
  528. * Availability:
  529. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  530. * CarbonLib: in CarbonLib 1.0 and later
  531. * Mac OS X: in version 10.0 and later
  532. }
  533. procedure NSLCloseNavigationAPI(theClient: NSLClientRef); external name '_NSLCloseNavigationAPI';
  534. {
  535. NSLPrepareRequest: creates an NSLRequestRef, sets up some internal data
  536. notifier is an NSLClientNotifyUPP that will be called when data is available, when the lookup has
  537. completed, or if an error occurs. When the notifier is called, the cookie will be the NSLRequestRef.
  538. If notifier is NULL, then the NSLManager will assume that the request is made synchronously. This
  539. should only be used while in a separate thread, so that the client app can still process events, etc.
  540. contextPtr is a void* which is passed as the contextPtr argument when the notifier is called.
  541. upon exit:
  542. 1) ref will contain a pointer to a NSLRequestRef which must be passed to all other functions
  543. which require a NSLRequestRef.
  544. 2) infoPtr will point to a newly created ClientAsycnInfoPtr which will be disposed by the manager when the search is completed
  545. NOTE: Only one search can be running at a time per clientRef.
  546. }
  547. {
  548. * NSLPrepareRequest()
  549. *
  550. * Availability:
  551. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  552. * CarbonLib: in CarbonLib 1.0 and later
  553. * Mac OS X: in version 10.0 and later
  554. }
  555. function NSLPrepareRequest(notifier: NSLClientNotifyUPP; contextPtr: UnivPtr; theClient: NSLClientRef; var ref: NSLRequestRef; bufPtr: CStringPtr; bufLen: UInt32; var infoPtr: NSLClientAsyncInfoPtr): NSLError; external name '_NSLPrepareRequest';
  556. {
  557. NSLStartNeighborhoodLookup: looking for neighborhoods associated with or neighboring a particular neighborhood
  558. Passing in NULL for neighborhood will generate a list of a default neighborhood(s)
  559. }
  560. {
  561. * NSLStartNeighborhoodLookup()
  562. *
  563. * Availability:
  564. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  565. * CarbonLib: in CarbonLib 1.0 and later
  566. * Mac OS X: in version 10.0 and later
  567. }
  568. function NSLStartNeighborhoodLookup(ref: NSLRequestRef; neighborhood: NSLNeighborhood; var asyncInfo: NSLClientAsyncInfo): NSLError; external name '_NSLStartNeighborhoodLookup';
  569. {
  570. NSLStartServicesLookup: starts looking for entities if the specified type in the specified neighborhood
  571. }
  572. {
  573. * NSLStartServicesLookup()
  574. *
  575. * Availability:
  576. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  577. * CarbonLib: in CarbonLib 1.0 and later
  578. * Mac OS X: in version 10.0 and later
  579. }
  580. function NSLStartServicesLookup(ref: NSLRequestRef; neighborhood: NSLNeighborhood; requestData: NSLTypedDataPtr; var asyncInfo: NSLClientAsyncInfo): NSLError; external name '_NSLStartServicesLookup';
  581. { NSLContinueLookup: continues a paused/outstanding lookup }
  582. {
  583. * NSLContinueLookup()
  584. *
  585. * Availability:
  586. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  587. * CarbonLib: in CarbonLib 1.0 and later
  588. * Mac OS X: in version 10.0 and later
  589. }
  590. function NSLContinueLookup(var asyncInfo: NSLClientAsyncInfo): NSLError; external name '_NSLContinueLookup';
  591. { NSLCancelRequest: cancels an ongoing search }
  592. {
  593. * NSLCancelRequest()
  594. *
  595. * Availability:
  596. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  597. * CarbonLib: in CarbonLib 1.0 and later
  598. * Mac OS X: in version 10.0 and later
  599. }
  600. function NSLCancelRequest(ref: NSLRequestRef): NSLError; external name '_NSLCancelRequest';
  601. {
  602. NSLDeleteRequest: deletes info associated with this ref. The ClientAsyncInfoPtr will no longer be valid
  603. This must be called when the client is no longer using this requestRef.
  604. }
  605. {
  606. * NSLDeleteRequest()
  607. *
  608. * Availability:
  609. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  610. * CarbonLib: in CarbonLib 1.0 and later
  611. * Mac OS X: in version 10.0 and later
  612. }
  613. function NSLDeleteRequest(ref: NSLRequestRef): NSLError; external name '_NSLDeleteRequest';
  614. {
  615. -----------------------------------------------------------------------------
  616. Utility API calls: use these accessors to manipulate NSL's typed data
  617. -----------------------------------------------------------------------------
  618. }
  619. { NSLParseServicesRequestPB provides the inverse of NSLMakeRequestPB, filling out the offsets found within newDataPtr }
  620. { <--- returns an OSStatus if any errors occur parsing the data }
  621. { <--- newDataPtr is the construct passed to the plugin }
  622. { ---> serviceListPtr is the address of a pointer which will be set to point at the portion of the newDataPtr that holds the serviceList to be searched }
  623. { ---> serviceListLen is the length of the serviceListPtr data pointed to by serviceListPtr }
  624. {
  625. * NSLParseServicesRequestPB()
  626. *
  627. * Availability:
  628. * Non-Carbon CFM: in NSLPPCLib 1.0 and later
  629. * CarbonLib: in CarbonLib 1.0 and later
  630. * Mac OS X: in version 10.0 and later
  631. }
  632. function NSLParseServicesRequestPB(newDataPtr: NSLTypedDataPtr; var serviceListPtr: CStringPtr; var serviceListLen: UInt16): OSStatus; external name '_NSLParseServicesRequestPB';
  633. { NSLParseServiceRegistrationPB provides for breaking apart a registration request from a client to a plugin }
  634. { <--- returns an OSStatus if any errors occur parsing the data }
  635. { <--- newDataPtr is the construct passed to the plugin }
  636. { ---> neighborhoodPtr gets set to point at the portion of the newDataPtr that contains the neighborhood }
  637. { ---> neighborhoodLen is the length of the neighborhood pointed to by neighborhoodPtr }
  638. { ---> urlPtr is the address of a pointer which will be set to point at the portion of the newDataPtr that holds the url to be registered }
  639. { ---> urlLen is the length of the url data pointed to by urlPtr }
  640. {
  641. * NSLParseServiceRegistrationPB()
  642. *
  643. * Availability:
  644. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  645. * CarbonLib: in CarbonLib 1.0 and later
  646. * Mac OS X: in version 10.0 and later
  647. }
  648. function NSLParseServiceRegistrationPB(newDataPtr: NSLTypedDataPtr; var neighborhoodPtr: NSLNeighborhood; var neighborhoodLen: UInt16; var urlPtr: CStringPtr; var urlLen: UInt16): OSStatus; external name '_NSLParseServiceRegistrationPB';
  649. { NSLGetErrorStringsFromResource is obsolete in X. It will ignore the fileSpecPtr }
  650. { and errorResID parameters and return the standard error strings. }
  651. { NSLGetErrorStringsFromResource makes a basic assumption: }
  652. { errorString and solutionString both point to valid memory of at least 256 bytes! }
  653. { <--- returns an OSStatus if any errors occur }
  654. { ---> theErr is an OSStatus to be matched against a resource list of errors }
  655. { ---> fileSpecPtr is a FSSpecPtr to the resource containing the list of errors }
  656. { ---> errorResID is the resourceID of the NSLI resource of the list of errors }
  657. { <--> errorString is a pointer to valid memory of at least 256 bytes which will be filled out by the error portion of the error string }
  658. { <--> solutionString is a pointer to valid memory of at least 256 bytes which will be filled out by the solution portion of the error string }
  659. {
  660. * NSLGetErrorStringsFromResource()
  661. *
  662. * Availability:
  663. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  664. * CarbonLib: in CarbonLib 1.0 and later
  665. * Mac OS X: in version 10.0 and later
  666. }
  667. function NSLGetErrorStringsFromResource(theErr: OSStatus; const (*var*) fileSpecPtr: FSSpec; errorResID: SInt16; errorString: CStringPtr; solutionString: CStringPtr): OSStatus; external name '_NSLGetErrorStringsFromResource';
  668. { <--- Returns true if given service is in the given service list }
  669. { ---> serviceList is a valid NSLServicesList containing information about services to be searched }
  670. { ---> svcToFind is an NSLServiceType of a particular service to check if it is in the serviceList }
  671. {
  672. * NSLServiceIsInServiceList()
  673. *
  674. * Availability:
  675. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  676. * CarbonLib: in CarbonLib 1.0 and later
  677. * Mac OS X: in version 10.0 and later
  678. }
  679. function NSLServiceIsInServiceList(serviceList: NSLServicesList; svcToFind: NSLServiceType): boolean; external name '_NSLServiceIsInServiceList';
  680. { <--- returns an OSStatus if any errors occur parsing the data }
  681. { ---> svcString is the address of a pointer which will be set to point at the portion of theURL that holds the serviceType of theURL }
  682. { ---> svcLen is the length of the serviceType pointed to by svcString }
  683. {
  684. * NSLGetServiceFromURL()
  685. *
  686. * Availability:
  687. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  688. * CarbonLib: in CarbonLib 1.0 and later
  689. * Mac OS X: in version 10.0 and later
  690. }
  691. function NSLGetServiceFromURL(theURL: CStringPtr; var svcString: CStringPtr; var svcLen: UInt16): OSStatus; external name '_NSLGetServiceFromURL';
  692. { <--- returns the length of a Neighborhood data structure }
  693. { ---> neighborhood is a valid NSLNeighborhood }
  694. {
  695. * NSLGetNeighborhoodLength()
  696. *
  697. * Availability:
  698. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  699. * CarbonLib: in CarbonLib 1.0 and later
  700. * Mac OS X: in version 10.0 and later
  701. }
  702. function NSLGetNeighborhoodLength(neighborhood: NSLNeighborhood): SInt32; external name '_NSLGetNeighborhoodLength';
  703. {
  704. -------------------------------------------------------------------------------------
  705. Utility API calls: use these routines to separate plugin threads from client threads
  706. -------------------------------------------------------------------------------------
  707. }
  708. { this routine works the same as the Thread manager's routine NewThread, except }
  709. { that the thread is added to the NSL manager's thread list. }
  710. {
  711. * NSLNewThread()
  712. *
  713. * Availability:
  714. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  715. * CarbonLib: in CarbonLib 1.0 and later
  716. * Mac OS X: in version 10.0 and later
  717. }
  718. function NSLNewThread(threadStyle_: ThreadStyle; threadEntry: ThreadEntryProcPtr; threadParam: UnivPtr; stackSize: Size; options: ThreadOptions; var threadResult: UnivPtr; var threadMade: ThreadID): OSErr; external name '_NSLNewThread';
  719. { this routine works the same as the Thread manager's routine DisposeThread, except }
  720. { that the thread is removed from the NSL manager's thread list. }
  721. {
  722. * NSLDisposeThread()
  723. *
  724. * Availability:
  725. * Non-Carbon CFM: in NSLPPCLib 1.1 and later
  726. * CarbonLib: in CarbonLib 1.0 and later
  727. * Mac OS X: in version 10.0 and later
  728. }
  729. function NSLDisposeThread(threadToDump: ThreadID; threadResult: UnivPtr; recycleThread: boolean): OSErr; external name '_NSLDisposeThread';
  730. {$ifc OLDROUTINENAMES}
  731. type
  732. ClientAsyncInfo = NSLClientAsyncInfo;
  733. ClientAsyncInfoPtr = ^ClientAsyncInfo;
  734. PluginAsyncInfo = NSLPluginAsyncInfo;
  735. PluginAsyncInfoPtr = ^PluginAsyncInfo;
  736. TypedData = NSLTypedData;
  737. TypedDataPtr = ^TypedData;
  738. PluginData = NSLPluginData;
  739. PluginDataPtr = ^PluginData;
  740. {$endc} {OLDROUTINENAMES}
  741. {$ALIGN MAC68K}
  742. end.