SCDynamicStoreCopyDHCPInfos.pas 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. {
  2. * Copyright (c) 2001-2002 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. { Unit name changed to SCDynamicStoreCopyDHCPInfos to avoid conflict with
  25. SCDynamicStoreCopyDHCPInfo function }
  26. {
  27. Modified for use with Free Pascal
  28. Version 200
  29. Please report any bugs to <[email protected]>
  30. }
  31. {$mode macpas}
  32. {$packenum 1}
  33. {$macro on}
  34. {$inline on}
  35. {$CALLING MWPASCAL}
  36. unit SCDynamicStoreCopyDHCPInfos;
  37. interface
  38. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  39. {$setc GAP_INTERFACES_VERSION := $0200}
  40. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  41. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  42. {$endc}
  43. {$ifc defined CPUPOWERPC and defined CPUI386}
  44. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  45. {$endc}
  46. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  47. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  48. {$endc}
  49. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  50. {$setc __ppc__ := 1}
  51. {$elsec}
  52. {$setc __ppc__ := 0}
  53. {$endc}
  54. {$ifc not defined __i386__ and defined CPUI386}
  55. {$setc __i386__ := 1}
  56. {$elsec}
  57. {$setc __i386__ := 0}
  58. {$endc}
  59. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  60. {$error Conflicting definitions for __ppc__ and __i386__}
  61. {$endc}
  62. {$ifc defined __ppc__ and __ppc__}
  63. {$setc TARGET_CPU_PPC := TRUE}
  64. {$setc TARGET_CPU_X86 := FALSE}
  65. {$elifc defined __i386__ and __i386__}
  66. {$setc TARGET_CPU_PPC := FALSE}
  67. {$setc TARGET_CPU_X86 := TRUE}
  68. {$elsec}
  69. {$error Neither __ppc__ nor __i386__ is defined.}
  70. {$endc}
  71. {$setc TARGET_CPU_PPC_64 := FALSE}
  72. {$ifc defined FPC_BIG_ENDIAN}
  73. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  74. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  75. {$elifc defined FPC_LITTLE_ENDIAN}
  76. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  77. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  78. {$elsec}
  79. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  80. {$endc}
  81. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  82. {$setc CALL_NOT_IN_CARBON := FALSE}
  83. {$setc OLDROUTINENAMES := FALSE}
  84. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  85. {$setc OPAQUE_UPP_TYPES := TRUE}
  86. {$setc OTCARBONAPPLICATION := TRUE}
  87. {$setc OTKERNEL := FALSE}
  88. {$setc PM_USE_SESSION_APIS := TRUE}
  89. {$setc TARGET_API_MAC_CARBON := TRUE}
  90. {$setc TARGET_API_MAC_OS8 := FALSE}
  91. {$setc TARGET_API_MAC_OSX := TRUE}
  92. {$setc TARGET_CARBON := TRUE}
  93. {$setc TARGET_CPU_68K := FALSE}
  94. {$setc TARGET_CPU_MIPS := FALSE}
  95. {$setc TARGET_CPU_SPARC := FALSE}
  96. {$setc TARGET_OS_MAC := TRUE}
  97. {$setc TARGET_OS_UNIX := FALSE}
  98. {$setc TARGET_OS_WIN32 := FALSE}
  99. {$setc TARGET_RT_MAC_68881 := FALSE}
  100. {$setc TARGET_RT_MAC_CFM := FALSE}
  101. {$setc TARGET_RT_MAC_MACHO := TRUE}
  102. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  103. {$setc TYPE_BOOL := FALSE}
  104. {$setc TYPE_EXTENDED := FALSE}
  105. {$setc TYPE_LONGLONG := TRUE}
  106. uses MacTypes,CFBase,SCDynamicStore,CFDictionary,CFData,CFDate;
  107. {$ALIGN MAC68K}
  108. {!
  109. @header SCDynamicStoreCopyDHCPInfo.h
  110. The following APIs allow an application to retrieve DHCP/BOOTP
  111. information, in particular DHCP/BOOTP options.
  112. }
  113. {!
  114. @function SCDynamicStoreCopyDHCPInfo
  115. @discussion Copies the DHCP/BOOTP information dictionary for the
  116. requested serviceID, or the primary service if
  117. serviceID == NULL.
  118. @param store An SCDynamicStoreRef that should be used for communication
  119. with the server.
  120. If NULL, a temporary session will be used.
  121. @param serviceID A CFStringRef containing the requested service.
  122. If NULL, returns information for the primary service.
  123. @result A dictionary containing DHCP/BOOTP information if successful,
  124. NULL otherwise.
  125. Use the DHCPInfoGetOption() to retrieve
  126. individual options from the returned dictionary.
  127. A non-NULL return value must be released using CFRelease().
  128. }
  129. function SCDynamicStoreCopyDHCPInfo( store: SCDynamicStoreRef; serviceID: CFStringRef ): CFDictionaryRef; external name '_SCDynamicStoreCopyDHCPInfo';
  130. {!
  131. @function DHCPInfoGetOptionData
  132. @discussion Returns a non-NULL CFDataRef containing the BOOTP/DHCP
  133. option data if present, NULL otherwise.
  134. @param info The non-NULL DHCP information dictionary returned by
  135. calling SCDynamicStoreCopyDHCPInfo.
  136. @param code The DHCP/BOOTP option code (see RFC 2132) to return
  137. data for.
  138. @result A non-NULL CFDataRef containing the option data,
  139. NULL otherwise.
  140. The return value must NOT be released.
  141. }
  142. function DHCPInfoGetOptionData( info: CFDictionaryRef; code: UInt8 ): CFDataRef; external name '_DHCPInfoGetOptionData';
  143. {!
  144. @function DHCPInfoGetLeaseStartTime
  145. @discussion Returns a CFDateRef corresponding to the lease start time,
  146. if present, NULL otherwise. A NULL return value is returned
  147. if the configuration method is BOOTP.
  148. @param info The non-NULL DHCP information dictionary returned by
  149. calling SCDynamicStoreCopyDHCPInfo.
  150. @result A non-NULL CFDateRef if present, NULL otherwise.
  151. The return value must NOT be released.
  152. }
  153. function DHCPInfoGetLeaseStartTime( info: CFDictionaryRef ): CFDateRef; external name '_DHCPInfoGetLeaseStartTime';
  154. end.