SCDynamicStoreKey.pas 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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. {$packenum 1}
  34. {$macro on}
  35. {$inline on}
  36. {$calling mwpascal}
  37. unit SCDynamicStoreKey;
  38. interface
  39. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  40. {$setc GAP_INTERFACES_VERSION := $0308}
  41. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  42. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  43. {$endc}
  44. {$ifc defined CPUPOWERPC and defined CPUI386}
  45. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  46. {$endc}
  47. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  48. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  49. {$endc}
  50. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  51. {$setc __ppc__ := 1}
  52. {$elsec}
  53. {$setc __ppc__ := 0}
  54. {$endc}
  55. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  56. {$setc __ppc64__ := 1}
  57. {$elsec}
  58. {$setc __ppc64__ := 0}
  59. {$endc}
  60. {$ifc not defined __i386__ and defined CPUI386}
  61. {$setc __i386__ := 1}
  62. {$elsec}
  63. {$setc __i386__ := 0}
  64. {$endc}
  65. {$ifc not defined __x86_64__ and defined CPUX86_64}
  66. {$setc __x86_64__ := 1}
  67. {$elsec}
  68. {$setc __x86_64__ := 0}
  69. {$endc}
  70. {$ifc not defined __arm__ and defined CPUARM}
  71. {$setc __arm__ := 1}
  72. {$elsec}
  73. {$setc __arm__ := 0}
  74. {$endc}
  75. {$ifc defined cpu64}
  76. {$setc __LP64__ := 1}
  77. {$elsec}
  78. {$setc __LP64__ := 0}
  79. {$endc}
  80. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  81. {$error Conflicting definitions for __ppc__ and __i386__}
  82. {$endc}
  83. {$ifc defined __ppc__ and __ppc__}
  84. {$setc TARGET_CPU_PPC := TRUE}
  85. {$setc TARGET_CPU_PPC64 := FALSE}
  86. {$setc TARGET_CPU_X86 := FALSE}
  87. {$setc TARGET_CPU_X86_64 := FALSE}
  88. {$setc TARGET_CPU_ARM := FALSE}
  89. {$setc TARGET_OS_MAC := TRUE}
  90. {$setc TARGET_OS_IPHONE := FALSE}
  91. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  92. {$setc TARGET_OS_EMBEDDED := FALSE}
  93. {$elifc defined __ppc64__ and __ppc64__}
  94. {$setc TARGET_CPU_PPC := FALSE}
  95. {$setc TARGET_CPU_PPC64 := TRUE}
  96. {$setc TARGET_CPU_X86 := FALSE}
  97. {$setc TARGET_CPU_X86_64 := FALSE}
  98. {$setc TARGET_CPU_ARM := FALSE}
  99. {$setc TARGET_OS_MAC := TRUE}
  100. {$setc TARGET_OS_IPHONE := FALSE}
  101. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  102. {$setc TARGET_OS_EMBEDDED := FALSE}
  103. {$elifc defined __i386__ and __i386__}
  104. {$setc TARGET_CPU_PPC := FALSE}
  105. {$setc TARGET_CPU_PPC64 := FALSE}
  106. {$setc TARGET_CPU_X86 := TRUE}
  107. {$setc TARGET_CPU_X86_64 := FALSE}
  108. {$setc TARGET_CPU_ARM := FALSE}
  109. {$ifc defined(iphonesim)}
  110. {$setc TARGET_OS_MAC := FALSE}
  111. {$setc TARGET_OS_IPHONE := TRUE}
  112. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  113. {$elsec}
  114. {$setc TARGET_OS_MAC := TRUE}
  115. {$setc TARGET_OS_IPHONE := FALSE}
  116. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  117. {$endc}
  118. {$setc TARGET_OS_EMBEDDED := FALSE}
  119. {$elifc defined __x86_64__ and __x86_64__}
  120. {$setc TARGET_CPU_PPC := FALSE}
  121. {$setc TARGET_CPU_PPC64 := FALSE}
  122. {$setc TARGET_CPU_X86 := FALSE}
  123. {$setc TARGET_CPU_X86_64 := TRUE}
  124. {$setc TARGET_CPU_ARM := FALSE}
  125. {$setc TARGET_OS_MAC := TRUE}
  126. {$setc TARGET_OS_IPHONE := FALSE}
  127. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  128. {$setc TARGET_OS_EMBEDDED := FALSE}
  129. {$elifc defined __arm__ and __arm__}
  130. {$setc TARGET_CPU_PPC := FALSE}
  131. {$setc TARGET_CPU_PPC64 := FALSE}
  132. {$setc TARGET_CPU_X86 := FALSE}
  133. {$setc TARGET_CPU_X86_64 := FALSE}
  134. {$setc TARGET_CPU_ARM := TRUE}
  135. { will require compiler define when/if other Apple devices with ARM cpus ship }
  136. {$setc TARGET_OS_MAC := FALSE}
  137. {$setc TARGET_OS_IPHONE := TRUE}
  138. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  139. {$setc TARGET_OS_EMBEDDED := TRUE}
  140. {$elsec}
  141. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
  142. {$endc}
  143. {$ifc defined __LP64__ and __LP64__ }
  144. {$setc TARGET_CPU_64 := TRUE}
  145. {$elsec}
  146. {$setc TARGET_CPU_64 := FALSE}
  147. {$endc}
  148. {$ifc defined FPC_BIG_ENDIAN}
  149. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  150. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  151. {$elifc defined FPC_LITTLE_ENDIAN}
  152. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  153. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  154. {$elsec}
  155. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  156. {$endc}
  157. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  158. {$setc CALL_NOT_IN_CARBON := FALSE}
  159. {$setc OLDROUTINENAMES := FALSE}
  160. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  161. {$setc OPAQUE_UPP_TYPES := TRUE}
  162. {$setc OTCARBONAPPLICATION := TRUE}
  163. {$setc OTKERNEL := FALSE}
  164. {$setc PM_USE_SESSION_APIS := TRUE}
  165. {$setc TARGET_API_MAC_CARBON := TRUE}
  166. {$setc TARGET_API_MAC_OS8 := FALSE}
  167. {$setc TARGET_API_MAC_OSX := TRUE}
  168. {$setc TARGET_CARBON := TRUE}
  169. {$setc TARGET_CPU_68K := FALSE}
  170. {$setc TARGET_CPU_MIPS := FALSE}
  171. {$setc TARGET_CPU_SPARC := FALSE}
  172. {$setc TARGET_OS_UNIX := FALSE}
  173. {$setc TARGET_OS_WIN32 := FALSE}
  174. {$setc TARGET_RT_MAC_68881 := FALSE}
  175. {$setc TARGET_RT_MAC_CFM := FALSE}
  176. {$setc TARGET_RT_MAC_MACHO := TRUE}
  177. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  178. {$setc TYPE_BOOL := FALSE}
  179. {$setc TYPE_EXTENDED := FALSE}
  180. {$setc TYPE_LONGLONG := TRUE}
  181. uses MacTypes,CFBase;
  182. {$endc} {not MACOSALLINCLUDE}
  183. { until the __IPHONE_NA is automatically handled}
  184. {$ifc TARGET_OS_MAC}
  185. {$ALIGN POWER}
  186. {!
  187. @header SCDynamicStoreKey
  188. @discussion The SCDynamicStoreKey API provides convenience functions
  189. that an application can use to create a correctly formatted
  190. dynamic store key for accessing specific items in the dynamic
  191. store. An application can then use the resulting string in
  192. any function that requires a dynamic store key.
  193. }
  194. {
  195. * SCDynamicStoreKeyCreate
  196. * - convenience routines that create a CFString key for an item in the store
  197. }
  198. {!
  199. @function SCDynamicStoreKeyCreate
  200. @discussion Creates a dynamic store key using the given format.
  201. @param allocator The CFAllocator that should be used to allocate
  202. memory for this key.
  203. This parameter may be NULL in which case the current
  204. default CFAllocator is used. If this reference is not
  205. a valid CFAllocator, the behavior is undefined.
  206. @param fmt A CFStringRef describing the format for this key.
  207. @result Returns a string containing the formatted key.
  208. }
  209. function SCDynamicStoreKeyCreate( allocator: CFAllocatorRef; fmt: CFStringRef; ... ): CFStringRef; external name '_SCDynamicStoreKeyCreate';
  210. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  211. {!
  212. @function SCDynamicStoreKeyCreateNetworkGlobalEntity
  213. @discussion Creates a dynamic store key that can be used to access
  214. a specific global (as opposed to a per-service or per-interface)
  215. network configuration entity.
  216. @param allocator The CFAllocator that should be used to allocate
  217. memory for this key.
  218. This parameter may be NULL in which case the current
  219. default CFAllocator is used. If this reference is not
  220. a valid CFAllocator, the behavior is undefined.
  221. @param domain A string specifying the desired domain, such as the
  222. requested configuration (kSCDynamicStoreDomainSetup) or the
  223. actual state (kSCDynamicStoreDomainState).
  224. @param entity A string containing the specific global entity, such
  225. as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
  226. @result Returns a string containing the formatted key.
  227. }
  228. function SCDynamicStoreKeyCreateNetworkGlobalEntity( allocator: CFAllocatorRef; domain: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkGlobalEntity';
  229. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  230. {!
  231. @function SCDynamicStoreKeyCreateNetworkInterface
  232. @discussion Creates a dynamic store key that can be used to access
  233. the network interface configuration information stored in
  234. the dynamic store.
  235. @param allocator The CFAllocator that should be used to allocate
  236. memory for this key.
  237. This parameter may be NULL in which case the current
  238. default CFAllocator is used. If this reference is not
  239. a valid CFAllocator, the behavior is undefined.
  240. @param domain A string specifying the desired domain, such as the
  241. requested configuration (kSCDynamicStoreDomainSetup) or the
  242. actual state (kSCDynamicStoreDomainState).
  243. @result Returns a string containing the formatted key.
  244. }
  245. function SCDynamicStoreKeyCreateNetworkInterface( allocator: CFAllocatorRef; domain: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkInterface';
  246. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  247. {!
  248. @function SCDynamicStoreKeyCreateNetworkInterfaceEntity
  249. @discussion Creates a dynamic store key that can be used to access
  250. the per-interface network configuration information stored in
  251. the dynamic store.
  252. @param allocator The CFAllocator that should be used to allocate
  253. memory for this key.
  254. This parameter may be NULL in which case the current
  255. default CFAllocator is used. If this reference is not
  256. a valid CFAllocator, the behavior is undefined.
  257. @param domain A string specifying the desired domain, such as the
  258. requested configuration (kSCDynamicStoreDomainSetup) or the
  259. actual state (kSCDynamicStoreDomainState).
  260. @param ifname A string containing the interface name or a regular
  261. expression pattern.
  262. @param entity A string containing the specific global entity, such
  263. as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
  264. @result Returns a string containing the formatted key.
  265. }
  266. function SCDynamicStoreKeyCreateNetworkInterfaceEntity( allocator: CFAllocatorRef; domain: CFStringRef; ifname: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkInterfaceEntity';
  267. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  268. {!
  269. @function SCDynamicStoreKeyCreateNetworkServiceEntity
  270. @discussion Creates a dynamic store key that can be used to access
  271. the per-service network configuration information stored in
  272. the dynamic store.
  273. @param allocator The CFAllocator that should be used to allocate
  274. memory for this key.
  275. This parameter may be NULL in which case the current
  276. default CFAllocator is used. If this reference is not
  277. a valid CFAllocator, the behavior is undefined.
  278. @param domain A string specifying the desired domain, such as the
  279. requested configuration (kSCDynamicStoreDomainSetup) or the
  280. actual state (kSCDynamicStoreDomainState).
  281. @param serviceID A string containing the service ID or a regular
  282. expression pattern.
  283. @param entity A string containing the specific global entity, such
  284. as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
  285. @result Returns a string containing the formatted key.
  286. }
  287. function SCDynamicStoreKeyCreateNetworkServiceEntity( allocator: CFAllocatorRef; domain: CFStringRef; serviceID: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkServiceEntity';
  288. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  289. {!
  290. @function SCDynamicStoreKeyCreateComputerName
  291. @discussion Creates a key that can be used in conjuntion with
  292. SCDynamicStoreSetNotificationKeys function to receive
  293. notifications when the current computer name changes.
  294. @param allocator The CFAllocator that should be used to allocate
  295. memory for this key.
  296. This parameter may be NULL in which case the current
  297. default CFAllocator is used. If this reference is not
  298. a valid CFAllocator, the behavior is undefined.
  299. @result Returns a notification string for the current computer or
  300. host name.
  301. }
  302. function SCDynamicStoreKeyCreateComputerName( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateComputerName';
  303. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  304. {!
  305. @function SCDynamicStoreKeyCreateConsoleUser
  306. @discussion Creates a key that can be used in conjunction with
  307. SCDynamicStoreSetNotificationKeys function to receive
  308. notifications when the current console user changes.
  309. @param allocator The CFAllocator that should be used to allocate
  310. memory for this key.
  311. This parameter may be NULL in which case the current
  312. default CFAllocator is used. If this reference is not
  313. a valid CFAllocator, the behavior is undefined.
  314. @result Returns a notification string for the current console user.
  315. }
  316. function SCDynamicStoreKeyCreateConsoleUser( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateConsoleUser';
  317. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  318. {!
  319. @function SCDynamicStoreKeyCreateHostNames
  320. @discussion Creates a key that can be used in conjunction with the
  321. SCDynamicStoreSetNotificationKeys function to receive
  322. notifications when the HostNames entity changes. The
  323. HostNames entity includes the local host name.
  324. @param allocator The CFAllocator that should be used to allocate
  325. memory for this key.
  326. This parameter may be NULL in which case the current
  327. default CFAllocator is used. If this reference is not
  328. a valid CFAllocator, the behavior is undefined.
  329. @result Returns a notification string for the HostNames entity.
  330. }
  331. function SCDynamicStoreKeyCreateHostNames( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateHostNames';
  332. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_NA) *)
  333. {!
  334. @function SCDynamicStoreKeyCreateLocation
  335. @discussion Creates a key that can be used in conjunction with the
  336. SCDynamicStoreSetNotificationKeys function to receive
  337. notifications when the location identifier changes.
  338. @param allocator The CFAllocator that should be used to allocate
  339. memory for this key.
  340. This parameter may be NULL in which case the current
  341. default CFAllocator is used. If this reference is not
  342. a valid CFAllocator, the behavior is undefined.
  343. @result Returns a notification string for the current location
  344. identifier.
  345. }
  346. function SCDynamicStoreKeyCreateLocation( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateLocation';
  347. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_NA) *)
  348. {!
  349. @function SCDynamicStoreKeyCreateProxies
  350. @discussion Creates a key that can be used in conjunction with
  351. the SCDynamicStoreSetNotificationKeys function to receive
  352. notifications when the current network proxy settings
  353. (such as HTTP or FTP) are changed.
  354. @param allocator The CFAllocator that should be used to allocate
  355. memory for this key.
  356. This parameter may be NULL in which case the current
  357. default CFAllocator is used. If this reference is not
  358. a valid CFAllocator, the behavior is undefined.
  359. @result Returns a notification string for the current proxy settings.
  360. }
  361. function SCDynamicStoreKeyCreateProxies( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateProxies';
  362. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA) *)
  363. {$endc} {TARGET_OS_MAC}
  364. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  365. end.
  366. {$endc} {not MACOSALLINCLUDE}