SystemConfiguration.pas 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. {
  2. * Copyright (c) 2000-2003 Apple Computer, 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. {
  25. Modified for use with Free Pascal
  26. Version 200
  27. Please report any bugs to <[email protected]>
  28. }
  29. {$mode macpas}
  30. {$packenum 1}
  31. {$macro on}
  32. {$inline on}
  33. {$CALLING MWPASCAL}
  34. unit SystemConfiguration;
  35. interface
  36. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  37. {$setc GAP_INTERFACES_VERSION := $0200}
  38. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  39. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  40. {$endc}
  41. {$ifc defined CPUPOWERPC and defined CPUI386}
  42. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  43. {$endc}
  44. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  45. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  46. {$endc}
  47. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  48. {$setc __ppc__ := 1}
  49. {$elsec}
  50. {$setc __ppc__ := 0}
  51. {$endc}
  52. {$ifc not defined __i386__ and defined CPUI386}
  53. {$setc __i386__ := 1}
  54. {$elsec}
  55. {$setc __i386__ := 0}
  56. {$endc}
  57. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  58. {$error Conflicting definitions for __ppc__ and __i386__}
  59. {$endc}
  60. {$ifc defined __ppc__ and __ppc__}
  61. {$setc TARGET_CPU_PPC := TRUE}
  62. {$setc TARGET_CPU_X86 := FALSE}
  63. {$elifc defined __i386__ and __i386__}
  64. {$setc TARGET_CPU_PPC := FALSE}
  65. {$setc TARGET_CPU_X86 := TRUE}
  66. {$elsec}
  67. {$error Neither __ppc__ nor __i386__ is defined.}
  68. {$endc}
  69. {$setc TARGET_CPU_PPC_64 := FALSE}
  70. {$ifc defined FPC_BIG_ENDIAN}
  71. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  72. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  73. {$elifc defined FPC_LITTLE_ENDIAN}
  74. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  75. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  76. {$elsec}
  77. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  78. {$endc}
  79. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  80. {$setc CALL_NOT_IN_CARBON := FALSE}
  81. {$setc OLDROUTINENAMES := FALSE}
  82. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  83. {$setc OPAQUE_UPP_TYPES := TRUE}
  84. {$setc OTCARBONAPPLICATION := TRUE}
  85. {$setc OTKERNEL := FALSE}
  86. {$setc PM_USE_SESSION_APIS := TRUE}
  87. {$setc TARGET_API_MAC_CARBON := TRUE}
  88. {$setc TARGET_API_MAC_OS8 := FALSE}
  89. {$setc TARGET_API_MAC_OSX := TRUE}
  90. {$setc TARGET_CARBON := TRUE}
  91. {$setc TARGET_CPU_68K := FALSE}
  92. {$setc TARGET_CPU_MIPS := FALSE}
  93. {$setc TARGET_CPU_SPARC := FALSE}
  94. {$setc TARGET_OS_MAC := TRUE}
  95. {$setc TARGET_OS_UNIX := FALSE}
  96. {$setc TARGET_OS_WIN32 := FALSE}
  97. {$setc TARGET_RT_MAC_68881 := FALSE}
  98. {$setc TARGET_RT_MAC_CFM := FALSE}
  99. {$setc TARGET_RT_MAC_MACHO := TRUE}
  100. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  101. {$setc TYPE_BOOL := FALSE}
  102. {$setc TYPE_EXTENDED := FALSE}
  103. {$setc TYPE_LONGLONG := TRUE}
  104. uses MacTypes,CFBase;
  105. {$ALIGN MAC68K}
  106. {!
  107. @header SystemConfiguration.h
  108. The SystemConfiguration framework provides access to the
  109. data used to configure a running system. The APIs provided
  110. by this framework communicate with the "configd" daemon.
  111. The "configd" daemon manages a "dynamic store" reflecting the
  112. desired configuration settings as well as the current state
  113. of the system. The daemon provides a notification mechanism
  114. for user-level processes which need to be aware of changes
  115. made to the data. Lastly, the daemon loads a number of
  116. bundles (or plug-ins) that monitor low-level kernel events
  117. and, via a set of policy modules, keep the state data up
  118. to date.
  119. }
  120. {!
  121. @enum
  122. @discussion Returned status codes.
  123. @constant kSCStatusOK Success
  124. @constant kSCStatusFailed Non-specific Failure
  125. @constant kSCStatusInvalidArgument Invalid argument
  126. @constant kSCStatusAccessError Permission denied
  127. @constant kSCStatusNoKey No such key
  128. @constant kSCStatusKeyExists Data associated with key already defined
  129. @constant kSCStatusLocked Lock already held
  130. @constant kSCStatusNeedLock Lock required for this operation
  131. @constant kSCStatusNoStoreSession Configuration daemon session not active
  132. @constant kSCStatusNoStoreServer Configuration daemon not (no longer) available
  133. @constant kSCStatusNotifierActive Notifier is currently active
  134. @constant kSCStatusNoPrefsSession Preference session not active
  135. @constant kSCStatusPrefsBusy Preferences update currently in progress
  136. @constant kSCStatusNoConfigFile Configuration file not found
  137. @constant kSCStatusNoLink No such link
  138. @constant kSCStatusStale Write attempted on stale version of object
  139. @constant kSCStatusMaxLink Maximum link count exceeded
  140. @constant kSCStatusReachabilityUnknown
  141. A determination could not be made regarding the reachability
  142. of the specified nodename/address.
  143. }
  144. const
  145. {
  146. * Generic status codes
  147. }
  148. kSCStatusOK = 0; { Success }
  149. kSCStatusFailed = 1001; { Non-specific failure }
  150. kSCStatusInvalidArgument = 1002; { Invalid argument }
  151. kSCStatusAccessError = 1003; { Permission denied
  152. - must be root to obtain lock
  153. - could not create access/create preferences
  154. }
  155. kSCStatusNoKey = 1004; { No such key }
  156. kSCStatusKeyExists = 1005; { Key already defined }
  157. kSCStatusLocked = 1006; { Lock already held }
  158. kSCStatusNeedLock = 1007; { Lock required for this operation }
  159. {
  160. * SCDynamicStore status codes
  161. }
  162. kSCStatusNoStoreSession = 2001; { Configuration daemon session not active }
  163. kSCStatusNoStoreServer = 2002; { Configuration daemon not (no longer) available }
  164. kSCStatusNotifierActive = 2003; { Notifier is currently active }
  165. {
  166. * SCPreferences status codes
  167. }
  168. kSCStatusNoPrefsSession = 3001; { Preference session not active }
  169. kSCStatusPrefsBusy = 3002; { Preferences update currently in progress }
  170. kSCStatusNoConfigFile = 3003; { Configuration file not found }
  171. kSCStatusNoLink = 3004; { No such link }
  172. kSCStatusStale = 3005; { Write attempted on stale version of object }
  173. kSCStatusMaxLink = 3006; { Maximum link count exceeded }
  174. {
  175. * SCNetwork status codes
  176. }
  177. kSCStatusReachabilityUnknown = 4001; { Network reachability cannot be determined }
  178. {!
  179. @function SCError
  180. @discussion Returns a last SystemConfiguration.framework API error code.
  181. @result The last error encountered.
  182. }
  183. function SCError: SInt32; external name '_SCError';
  184. {!
  185. @function SCErrorString
  186. @discussion Returns a pointer to the error message string associated
  187. with the specified status.
  188. @param status The SCDynamicStoreStatus to be returned.
  189. @result The error message string.
  190. }
  191. function SCErrorString( status: SInt32 ): ConstCStringPtr; external name '_SCErrorString';
  192. end.