SCDynamicStoreKey.pas 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. {
  2. * Copyright (c) 2000-2002, 2004, 2005, 2008 Apple Inc. All rights reserved.
  3. *
  4. * @APPLE_LICENSE_HEADER_START@
  5. *
  6. * This file contains Original Code and/or Modifications of Original Code
  7. * as defined in and that are subject to the Apple Public Source License
  8. * Version 2.0 (the 'License'). You may not use this file except in
  9. * compliance with the License. Please obtain a copy of the License at
  10. * http://www.opensource.apple.com/apsl/ and read it before using this
  11. * file.
  12. *
  13. * The Original Code and all software distributed under the License are
  14. * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  15. * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  16. * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  18. * Please see the License for the specific language governing rights and
  19. * limitations under the License.
  20. *
  21. * @APPLE_LICENSE_HEADER_END@
  22. }
  23. { Pascal Translation: Peter N Lewis, <[email protected]>, 2004 }
  24. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  25. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  26. {
  27. Modified for use with Free Pascal
  28. Version 308
  29. Please report any bugs to <[email protected]>
  30. }
  31. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  32. {$mode macpas}
  33. {$modeswitch cblocks}
  34. {$packenum 1}
  35. {$macro on}
  36. {$inline on}
  37. {$calling mwpascal}
  38. unit SCDynamicStoreKey;
  39. interface
  40. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  41. {$setc GAP_INTERFACES_VERSION := $0308}
  42. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  43. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  44. {$endc}
  45. {$ifc defined CPUPOWERPC and defined CPUI386}
  46. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  47. {$endc}
  48. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  49. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  50. {$endc}
  51. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  52. {$setc __ppc__ := 1}
  53. {$elsec}
  54. {$setc __ppc__ := 0}
  55. {$endc}
  56. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  57. {$setc __ppc64__ := 1}
  58. {$elsec}
  59. {$setc __ppc64__ := 0}
  60. {$endc}
  61. {$ifc not defined __i386__ and defined CPUI386}
  62. {$setc __i386__ := 1}
  63. {$elsec}
  64. {$setc __i386__ := 0}
  65. {$endc}
  66. {$ifc not defined __x86_64__ and defined CPUX86_64}
  67. {$setc __x86_64__ := 1}
  68. {$elsec}
  69. {$setc __x86_64__ := 0}
  70. {$endc}
  71. {$ifc not defined __arm__ and defined CPUARM}
  72. {$setc __arm__ := 1}
  73. {$elsec}
  74. {$setc __arm__ := 0}
  75. {$endc}
  76. {$ifc not defined __arm64__ and defined CPUAARCH64}
  77. {$setc __arm64__ := 1}
  78. {$elsec}
  79. {$setc __arm64__ := 0}
  80. {$endc}
  81. {$ifc defined cpu64}
  82. {$setc __LP64__ := 1}
  83. {$elsec}
  84. {$setc __LP64__ := 0}
  85. {$endc}
  86. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  87. {$error Conflicting definitions for __ppc__ and __i386__}
  88. {$endc}
  89. {$ifc defined __ppc__ and __ppc__}
  90. {$setc TARGET_CPU_PPC := TRUE}
  91. {$setc TARGET_CPU_PPC64 := FALSE}
  92. {$setc TARGET_CPU_X86 := FALSE}
  93. {$setc TARGET_CPU_X86_64 := FALSE}
  94. {$setc TARGET_CPU_ARM := FALSE}
  95. {$setc TARGET_CPU_ARM64 := FALSE}
  96. {$setc TARGET_OS_MAC := TRUE}
  97. {$setc TARGET_OS_IPHONE := FALSE}
  98. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  99. {$setc TARGET_OS_EMBEDDED := FALSE}
  100. {$elifc defined __ppc64__ and __ppc64__}
  101. {$setc TARGET_CPU_PPC := FALSE}
  102. {$setc TARGET_CPU_PPC64 := TRUE}
  103. {$setc TARGET_CPU_X86 := FALSE}
  104. {$setc TARGET_CPU_X86_64 := FALSE}
  105. {$setc TARGET_CPU_ARM := FALSE}
  106. {$setc TARGET_CPU_ARM64 := FALSE}
  107. {$setc TARGET_OS_MAC := TRUE}
  108. {$setc TARGET_OS_IPHONE := FALSE}
  109. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  110. {$setc TARGET_OS_EMBEDDED := FALSE}
  111. {$elifc defined __i386__ and __i386__}
  112. {$setc TARGET_CPU_PPC := FALSE}
  113. {$setc TARGET_CPU_PPC64 := FALSE}
  114. {$setc TARGET_CPU_X86 := TRUE}
  115. {$setc TARGET_CPU_X86_64 := FALSE}
  116. {$setc TARGET_CPU_ARM := FALSE}
  117. {$setc TARGET_CPU_ARM64 := FALSE}
  118. {$ifc defined iphonesim}
  119. {$setc TARGET_OS_MAC := FALSE}
  120. {$setc TARGET_OS_IPHONE := TRUE}
  121. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  122. {$elsec}
  123. {$setc TARGET_OS_MAC := TRUE}
  124. {$setc TARGET_OS_IPHONE := FALSE}
  125. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  126. {$endc}
  127. {$setc TARGET_OS_EMBEDDED := FALSE}
  128. {$elifc defined __x86_64__ and __x86_64__}
  129. {$setc TARGET_CPU_PPC := FALSE}
  130. {$setc TARGET_CPU_PPC64 := FALSE}
  131. {$setc TARGET_CPU_X86 := FALSE}
  132. {$setc TARGET_CPU_X86_64 := TRUE}
  133. {$setc TARGET_CPU_ARM := FALSE}
  134. {$setc TARGET_CPU_ARM64 := FALSE}
  135. {$ifc defined iphonesim}
  136. {$setc TARGET_OS_MAC := FALSE}
  137. {$setc TARGET_OS_IPHONE := TRUE}
  138. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  139. {$elsec}
  140. {$setc TARGET_OS_MAC := TRUE}
  141. {$setc TARGET_OS_IPHONE := FALSE}
  142. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  143. {$endc}
  144. {$setc TARGET_OS_EMBEDDED := FALSE}
  145. {$elifc defined __arm__ and __arm__}
  146. {$setc TARGET_CPU_PPC := FALSE}
  147. {$setc TARGET_CPU_PPC64 := FALSE}
  148. {$setc TARGET_CPU_X86 := FALSE}
  149. {$setc TARGET_CPU_X86_64 := FALSE}
  150. {$setc TARGET_CPU_ARM := TRUE}
  151. {$setc TARGET_CPU_ARM64 := FALSE}
  152. {$setc TARGET_OS_MAC := FALSE}
  153. {$setc TARGET_OS_IPHONE := TRUE}
  154. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  155. {$setc TARGET_OS_EMBEDDED := TRUE}
  156. {$elifc defined __arm64__ and __arm64__}
  157. {$setc TARGET_CPU_PPC := FALSE}
  158. {$setc TARGET_CPU_PPC64 := FALSE}
  159. {$setc TARGET_CPU_X86 := FALSE}
  160. {$setc TARGET_CPU_X86_64 := FALSE}
  161. {$setc TARGET_CPU_ARM := FALSE}
  162. {$setc TARGET_CPU_ARM64 := TRUE}
  163. {$ifc defined ios}
  164. {$setc TARGET_OS_MAC := FALSE}
  165. {$setc TARGET_OS_IPHONE := TRUE}
  166. {$setc TARGET_OS_EMBEDDED := TRUE}
  167. {$elsec}
  168. {$setc TARGET_OS_MAC := TRUE}
  169. {$setc TARGET_OS_IPHONE := FALSE}
  170. {$setc TARGET_OS_EMBEDDED := FALSE}
  171. {$endc}
  172. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  173. {$elsec}
  174. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  175. {$endc}
  176. {$ifc defined __LP64__ and __LP64__ }
  177. {$setc TARGET_CPU_64 := TRUE}
  178. {$elsec}
  179. {$setc TARGET_CPU_64 := FALSE}
  180. {$endc}
  181. {$ifc defined FPC_BIG_ENDIAN}
  182. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  183. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  184. {$elifc defined FPC_LITTLE_ENDIAN}
  185. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  186. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  187. {$elsec}
  188. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  189. {$endc}
  190. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  191. {$setc CALL_NOT_IN_CARBON := FALSE}
  192. {$setc OLDROUTINENAMES := FALSE}
  193. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  194. {$setc OPAQUE_UPP_TYPES := TRUE}
  195. {$setc OTCARBONAPPLICATION := TRUE}
  196. {$setc OTKERNEL := FALSE}
  197. {$setc PM_USE_SESSION_APIS := TRUE}
  198. {$setc TARGET_API_MAC_CARBON := TRUE}
  199. {$setc TARGET_API_MAC_OS8 := FALSE}
  200. {$setc TARGET_API_MAC_OSX := TRUE}
  201. {$setc TARGET_CARBON := TRUE}
  202. {$setc TARGET_CPU_68K := FALSE}
  203. {$setc TARGET_CPU_MIPS := FALSE}
  204. {$setc TARGET_CPU_SPARC := FALSE}
  205. {$setc TARGET_OS_UNIX := FALSE}
  206. {$setc TARGET_OS_WIN32 := FALSE}
  207. {$setc TARGET_RT_MAC_68881 := FALSE}
  208. {$setc TARGET_RT_MAC_CFM := FALSE}
  209. {$setc TARGET_RT_MAC_MACHO := TRUE}
  210. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  211. {$setc TYPE_BOOL := FALSE}
  212. {$setc TYPE_EXTENDED := FALSE}
  213. {$setc TYPE_LONGLONG := TRUE}
  214. uses MacTypes,CFBase;
  215. {$endc} {not MACOSALLINCLUDE}
  216. { until the __IPHONE_NA is automatically handled}
  217. {$ifc TARGET_OS_MAC}
  218. {$ALIGN POWER}
  219. {!
  220. @header SCDynamicStoreKey
  221. @discussion The SCDynamicStoreKey API provides convenience functions
  222. that an application can use to create a correctly formatted
  223. dynamic store key for accessing specific items in the dynamic
  224. store. An application can then use the resulting string in
  225. any function that requires a dynamic store key.
  226. }
  227. {
  228. * SCDynamicStoreKeyCreate
  229. * - convenience routines that create a CFString key for an item in the store
  230. }
  231. {!
  232. @function SCDynamicStoreKeyCreate
  233. @discussion Creates a dynamic store key using the given format.
  234. @param allocator The CFAllocator that should be used to allocate
  235. memory for this key.
  236. This parameter may be NULL in which case the current
  237. default CFAllocator is used. If this reference is not
  238. a valid CFAllocator, the behavior is undefined.
  239. @param fmt A CFStringRef describing the format for this key.
  240. @result Returns a string containing the formatted key.
  241. }
  242. function SCDynamicStoreKeyCreate( allocator: CFAllocatorRef; fmt: CFStringRef; ... ): CFStringRef; external name '_SCDynamicStoreKeyCreate';
  243. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  244. {!
  245. @function SCDynamicStoreKeyCreateNetworkGlobalEntity
  246. @discussion Creates a dynamic store key that can be used to access
  247. a specific global (as opposed to a per-service or per-interface)
  248. network configuration entity.
  249. @param allocator The CFAllocator that should be used to allocate
  250. memory for this key.
  251. This parameter may be NULL in which case the current
  252. default CFAllocator is used. If this reference is not
  253. a valid CFAllocator, the behavior is undefined.
  254. @param domain A string specifying the desired domain, such as the
  255. requested configuration (kSCDynamicStoreDomainSetup) or the
  256. actual state (kSCDynamicStoreDomainState).
  257. @param entity A string containing the specific global entity, such
  258. as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
  259. @result Returns a string containing the formatted key.
  260. }
  261. function SCDynamicStoreKeyCreateNetworkGlobalEntity( allocator: CFAllocatorRef; domain: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkGlobalEntity';
  262. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  263. {!
  264. @function SCDynamicStoreKeyCreateNetworkInterface
  265. @discussion Creates a dynamic store key that can be used to access
  266. the network interface configuration information stored in
  267. the dynamic store.
  268. @param allocator The CFAllocator that should be used to allocate
  269. memory for this key.
  270. This parameter may be NULL in which case the current
  271. default CFAllocator is used. If this reference is not
  272. a valid CFAllocator, the behavior is undefined.
  273. @param domain A string specifying the desired domain, such as the
  274. requested configuration (kSCDynamicStoreDomainSetup) or the
  275. actual state (kSCDynamicStoreDomainState).
  276. @result Returns a string containing the formatted key.
  277. }
  278. function SCDynamicStoreKeyCreateNetworkInterface( allocator: CFAllocatorRef; domain: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkInterface';
  279. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  280. {!
  281. @function SCDynamicStoreKeyCreateNetworkInterfaceEntity
  282. @discussion Creates a dynamic store key that can be used to access
  283. the per-interface network configuration information stored in
  284. the dynamic store.
  285. @param allocator The CFAllocator that should be used to allocate
  286. memory for this key.
  287. This parameter may be NULL in which case the current
  288. default CFAllocator is used. If this reference is not
  289. a valid CFAllocator, the behavior is undefined.
  290. @param domain A string specifying the desired domain, such as the
  291. requested configuration (kSCDynamicStoreDomainSetup) or the
  292. actual state (kSCDynamicStoreDomainState).
  293. @param ifname A string containing the interface name or a regular
  294. expression pattern.
  295. @param entity A string containing the specific global entity, such
  296. as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
  297. @result Returns a string containing the formatted key.
  298. }
  299. function SCDynamicStoreKeyCreateNetworkInterfaceEntity( allocator: CFAllocatorRef; domain: CFStringRef; ifname: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkInterfaceEntity';
  300. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  301. {!
  302. @function SCDynamicStoreKeyCreateNetworkServiceEntity
  303. @discussion Creates a dynamic store key that can be used to access
  304. the per-service network configuration information stored in
  305. the dynamic store.
  306. @param allocator The CFAllocator that should be used to allocate
  307. memory for this key.
  308. This parameter may be NULL in which case the current
  309. default CFAllocator is used. If this reference is not
  310. a valid CFAllocator, the behavior is undefined.
  311. @param domain A string specifying the desired domain, such as the
  312. requested configuration (kSCDynamicStoreDomainSetup) or the
  313. actual state (kSCDynamicStoreDomainState).
  314. @param serviceID A string containing the service ID or a regular
  315. expression pattern.
  316. @param entity A string containing the specific global entity, such
  317. as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
  318. @result Returns a string containing the formatted key.
  319. }
  320. function SCDynamicStoreKeyCreateNetworkServiceEntity( allocator: CFAllocatorRef; domain: CFStringRef; serviceID: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkServiceEntity';
  321. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  322. {!
  323. @function SCDynamicStoreKeyCreateComputerName
  324. @discussion Creates a key that can be used in conjuntion with
  325. SCDynamicStoreSetNotificationKeys function to receive
  326. notifications when the current computer name changes.
  327. @param allocator The CFAllocator that should be used to allocate
  328. memory for this key.
  329. This parameter may be NULL in which case the current
  330. default CFAllocator is used. If this reference is not
  331. a valid CFAllocator, the behavior is undefined.
  332. @result Returns a notification string for the current computer or
  333. host name.
  334. }
  335. function SCDynamicStoreKeyCreateComputerName( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateComputerName';
  336. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  337. {!
  338. @function SCDynamicStoreKeyCreateConsoleUser
  339. @discussion Creates a key that can be used in conjunction with
  340. SCDynamicStoreSetNotificationKeys function to receive
  341. notifications when the current console user changes.
  342. @param allocator The CFAllocator that should be used to allocate
  343. memory for this key.
  344. This parameter may be NULL in which case the current
  345. default CFAllocator is used. If this reference is not
  346. a valid CFAllocator, the behavior is undefined.
  347. @result Returns a notification string for the current console user.
  348. }
  349. function SCDynamicStoreKeyCreateConsoleUser( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateConsoleUser';
  350. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  351. {!
  352. @function SCDynamicStoreKeyCreateHostNames
  353. @discussion Creates a key that can be used in conjunction with the
  354. SCDynamicStoreSetNotificationKeys function to receive
  355. notifications when the HostNames entity changes. The
  356. HostNames entity includes the local host name.
  357. @param allocator The CFAllocator that should be used to allocate
  358. memory for this key.
  359. This parameter may be NULL in which case the current
  360. default CFAllocator is used. If this reference is not
  361. a valid CFAllocator, the behavior is undefined.
  362. @result Returns a notification string for the HostNames entity.
  363. }
  364. function SCDynamicStoreKeyCreateHostNames( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateHostNames';
  365. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_NA) *)
  366. {!
  367. @function SCDynamicStoreKeyCreateLocation
  368. @discussion Creates a key that can be used in conjunction with the
  369. SCDynamicStoreSetNotificationKeys function to receive
  370. notifications when the location identifier changes.
  371. @param allocator The CFAllocator that should be used to allocate
  372. memory for this key.
  373. This parameter may be NULL in which case the current
  374. default CFAllocator is used. If this reference is not
  375. a valid CFAllocator, the behavior is undefined.
  376. @result Returns a notification string for the current location
  377. identifier.
  378. }
  379. function SCDynamicStoreKeyCreateLocation( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateLocation';
  380. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_NA) *)
  381. {!
  382. @function SCDynamicStoreKeyCreateProxies
  383. @discussion Creates a key that can be used in conjunction with
  384. the SCDynamicStoreSetNotificationKeys function to receive
  385. notifications when the current network proxy settings
  386. (such as HTTP or FTP) are changed.
  387. @param allocator The CFAllocator that should be used to allocate
  388. memory for this key.
  389. This parameter may be NULL in which case the current
  390. default CFAllocator is used. If this reference is not
  391. a valid CFAllocator, the behavior is undefined.
  392. @result Returns a notification string for the current proxy settings.
  393. }
  394. function SCDynamicStoreKeyCreateProxies( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateProxies';
  395. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  396. {$endc} {TARGET_OS_MAC}
  397. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  398. end.
  399. {$endc} {not MACOSALLINCLUDE}