/packages/univint/src/CFStream.pas

https://github.com/slibre/freepascal · Pascal · 404 lines · 96 code · 53 blank · 255 comment · 0 complexity · 24010b9bee0a6a355e5b6bea17259e63 MD5 · raw file

  1. { CFStream.h
  2. Copyright (c) 2000-2012, Apple Inc. All rights reserved.
  3. }
  4. { Pascal Translation: Peter N Lewis, <peter@stairways.com.au>, 2004 }
  5. { Pascal Translation Updated: Peter N Lewis, <peter@stairways.com.au>, November 2005 }
  6. { Pascal Translation Updated: Gale R Paeper, <gpaeper@empirenet.com>, 2008 }
  7. { Pascal Translation Updated: Gorazd Krosl, <gorazd_1957@yahoo.ca>, October 2009 }
  8. { Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2009 }
  9. { Pascal Translation Updated: Jonas Maebe <jonas@freepascal.org>, September 2012 }
  10. {
  11. Modified for use with Free Pascal
  12. Version 308
  13. Please report any bugs to <gpc@microbizz.nl>
  14. }
  15. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit CFStream;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  24. {$setc GAP_INTERFACES_VERSION := $0308}
  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 CPUPOWERPC32}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  40. {$setc __ppc64__ := 1}
  41. {$elsec}
  42. {$setc __ppc64__ := 0}
  43. {$endc}
  44. {$ifc not defined __i386__ and defined CPUI386}
  45. {$setc __i386__ := 1}
  46. {$elsec}
  47. {$setc __i386__ := 0}
  48. {$endc}
  49. {$ifc not defined __x86_64__ and defined CPUX86_64}
  50. {$setc __x86_64__ := 1}
  51. {$elsec}
  52. {$setc __x86_64__ := 0}
  53. {$endc}
  54. {$ifc not defined __arm__ and defined CPUARM}
  55. {$setc __arm__ := 1}
  56. {$elsec}
  57. {$setc __arm__ := 0}
  58. {$endc}
  59. {$ifc defined cpu64}
  60. {$setc __LP64__ := 1}
  61. {$elsec}
  62. {$setc __LP64__ := 0}
  63. {$endc}
  64. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  65. {$error Conflicting definitions for __ppc__ and __i386__}
  66. {$endc}
  67. {$ifc defined __ppc__ and __ppc__}
  68. {$setc TARGET_CPU_PPC := TRUE}
  69. {$setc TARGET_CPU_PPC64 := FALSE}
  70. {$setc TARGET_CPU_X86 := FALSE}
  71. {$setc TARGET_CPU_X86_64 := FALSE}
  72. {$setc TARGET_CPU_ARM := FALSE}
  73. {$setc TARGET_OS_MAC := TRUE}
  74. {$setc TARGET_OS_IPHONE := FALSE}
  75. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  76. {$setc TARGET_OS_EMBEDDED := FALSE}
  77. {$elifc defined __ppc64__ and __ppc64__}
  78. {$setc TARGET_CPU_PPC := FALSE}
  79. {$setc TARGET_CPU_PPC64 := TRUE}
  80. {$setc TARGET_CPU_X86 := FALSE}
  81. {$setc TARGET_CPU_X86_64 := FALSE}
  82. {$setc TARGET_CPU_ARM := FALSE}
  83. {$setc TARGET_OS_MAC := TRUE}
  84. {$setc TARGET_OS_IPHONE := FALSE}
  85. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  86. {$setc TARGET_OS_EMBEDDED := FALSE}
  87. {$elifc defined __i386__ and __i386__}
  88. {$setc TARGET_CPU_PPC := FALSE}
  89. {$setc TARGET_CPU_PPC64 := FALSE}
  90. {$setc TARGET_CPU_X86 := TRUE}
  91. {$setc TARGET_CPU_X86_64 := FALSE}
  92. {$setc TARGET_CPU_ARM := FALSE}
  93. {$ifc defined(iphonesim)}
  94. {$setc TARGET_OS_MAC := FALSE}
  95. {$setc TARGET_OS_IPHONE := TRUE}
  96. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  97. {$elsec}
  98. {$setc TARGET_OS_MAC := TRUE}
  99. {$setc TARGET_OS_IPHONE := FALSE}
  100. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  101. {$endc}
  102. {$setc TARGET_OS_EMBEDDED := FALSE}
  103. {$elifc defined __x86_64__ and __x86_64__}
  104. {$setc TARGET_CPU_PPC := FALSE}
  105. {$setc TARGET_CPU_PPC64 := FALSE}
  106. {$setc TARGET_CPU_X86 := FALSE}
  107. {$setc TARGET_CPU_X86_64 := TRUE}
  108. {$setc TARGET_CPU_ARM := FALSE}
  109. {$setc TARGET_OS_MAC := TRUE}
  110. {$setc TARGET_OS_IPHONE := FALSE}
  111. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  112. {$setc TARGET_OS_EMBEDDED := FALSE}
  113. {$elifc defined __arm__ and __arm__}
  114. {$setc TARGET_CPU_PPC := FALSE}
  115. {$setc TARGET_CPU_PPC64 := FALSE}
  116. {$setc TARGET_CPU_X86 := FALSE}
  117. {$setc TARGET_CPU_X86_64 := FALSE}
  118. {$setc TARGET_CPU_ARM := TRUE}
  119. { will require compiler define when/if other Apple devices with ARM cpus ship }
  120. {$setc TARGET_OS_MAC := FALSE}
  121. {$setc TARGET_OS_IPHONE := TRUE}
  122. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  123. {$setc TARGET_OS_EMBEDDED := TRUE}
  124. {$elsec}
  125. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
  126. {$endc}
  127. {$ifc defined __LP64__ and __LP64__ }
  128. {$setc TARGET_CPU_64 := TRUE}
  129. {$elsec}
  130. {$setc TARGET_CPU_64 := FALSE}
  131. {$endc}
  132. {$ifc defined FPC_BIG_ENDIAN}
  133. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  134. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  135. {$elifc defined FPC_LITTLE_ENDIAN}
  136. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  137. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  138. {$elsec}
  139. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  140. {$endc}
  141. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  142. {$setc CALL_NOT_IN_CARBON := FALSE}
  143. {$setc OLDROUTINENAMES := FALSE}
  144. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  145. {$setc OPAQUE_UPP_TYPES := TRUE}
  146. {$setc OTCARBONAPPLICATION := TRUE}
  147. {$setc OTKERNEL := FALSE}
  148. {$setc PM_USE_SESSION_APIS := TRUE}
  149. {$setc TARGET_API_MAC_CARBON := TRUE}
  150. {$setc TARGET_API_MAC_OS8 := FALSE}
  151. {$setc TARGET_API_MAC_OSX := TRUE}
  152. {$setc TARGET_CARBON := TRUE}
  153. {$setc TARGET_CPU_68K := FALSE}
  154. {$setc TARGET_CPU_MIPS := FALSE}
  155. {$setc TARGET_CPU_SPARC := FALSE}
  156. {$setc TARGET_OS_UNIX := FALSE}
  157. {$setc TARGET_OS_WIN32 := FALSE}
  158. {$setc TARGET_RT_MAC_68881 := FALSE}
  159. {$setc TARGET_RT_MAC_CFM := FALSE}
  160. {$setc TARGET_RT_MAC_MACHO := TRUE}
  161. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  162. {$setc TYPE_BOOL := FALSE}
  163. {$setc TYPE_EXTENDED := FALSE}
  164. {$setc TYPE_LONGLONG := TRUE}
  165. uses MacTypes,CFBase,CFString,CFDictionary,CFURL,CFRunLoop,CFSocket,CFError;
  166. {$endc} {not MACOSALLINCLUDE}
  167. {$ALIGN POWER}
  168. const
  169. kCFStreamStatusNotOpen = 0;
  170. kCFStreamStatusOpening = 1; { open is in-progress }
  171. kCFStreamStatusOpen = 2;
  172. kCFStreamStatusReading = 3;
  173. kCFStreamStatusWriting = 4;
  174. kCFStreamStatusAtEnd = 5; { no further bytes can be read/written }
  175. kCFStreamStatusClosed = 6;
  176. kCFStreamStatusError = 7;
  177. type
  178. CFStreamStatus = CFIndex;
  179. const
  180. kCFStreamEventNone = 0;
  181. kCFStreamEventOpenCompleted = 1;
  182. kCFStreamEventHasBytesAvailable = 2;
  183. kCFStreamEventCanAcceptBytes = 4;
  184. kCFStreamEventErrorOccurred = 8;
  185. kCFStreamEventEndEncountered = 16;
  186. type
  187. CFStreamEventType = CFOptionFlags;
  188. type
  189. CFStreamClientContext = record
  190. version: CFIndex;
  191. info: UnivPtr;
  192. retain: function( info: {const} UnivPtr ): UnivPtr;
  193. release: procedure( info: {const} UnivPtr );
  194. copyDescription: function( info: {const} UnivPtr ): CFStringRef;
  195. end;
  196. type
  197. CFReadStreamRef = ^__CFReadStream; { an opaque type }
  198. __CFReadStream = record end;
  199. CFWriteStreamRefPtr = ^CFWriteStreamRef;
  200. CFWriteStreamRef = ^__CFWriteStream; { an opaque type }
  201. __CFWriteStream = record end;
  202. CFReadStreamRefPtr = ^CFReadStreamRef;
  203. type
  204. CFReadStreamClientCallBack = procedure( stream: CFReadStreamRef; typ: CFStreamEventType; clientCallBackInfo: UnivPtr );
  205. CFWriteStreamClientCallBack = procedure( stream: CFWriteStreamRef; typ: CFStreamEventType; clientCallBackInfo: UnivPtr );
  206. function CFReadStreamGetTypeID: CFTypeID; external name '_CFReadStreamGetTypeID';
  207. function CFWriteStreamGetTypeID: CFTypeID; external name '_CFWriteStreamGetTypeID';
  208. { Memory streams }
  209. { Value will be a CFData containing all bytes thusfar written; used to recover the data written to a memory write stream. }
  210. var kCFStreamPropertyDataWritten: CFStringRef; external name '_kCFStreamPropertyDataWritten'; (* attribute const *)
  211. { Pass kCFAllocatorNull for bytesDeallocator to prevent CFReadStream from deallocating bytes; otherwise, CFReadStream will deallocate bytes when the stream is destroyed }
  212. function CFReadStreamCreateWithBytesNoCopy( alloc: CFAllocatorRef; bytes: UnivPtr; length: CFIndex; bytesDeallocator: CFAllocatorRef ): CFReadStreamRef; external name '_CFReadStreamCreateWithBytesNoCopy';
  213. { The stream writes into the buffer given; when bufferCapacity is exhausted, the stream is exhausted (status becomes kCFStreamStatusAtEnd) }
  214. function CFWriteStreamCreateWithBuffer( alloc: CFAllocatorRef; buffer: UnivPtr; bufferCapacity: CFIndex ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithBuffer';
  215. { New buffers are allocated from bufferAllocator as bytes are written to the stream. At any point, you can recover the bytes thusfar written by asking for the property kCFStreamPropertyDataWritten, above }
  216. function CFWriteStreamCreateWithAllocatedBuffers( alloc: CFAllocatorRef; bufferAllocator: CFAllocatorRef ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithAllocatedBuffers';
  217. { File streams }
  218. function CFReadStreamCreateWithFile( alloc: CFAllocatorRef; fileURL: CFURLRef ): CFReadStreamRef; external name '_CFReadStreamCreateWithFile';
  219. function CFWriteStreamCreateWithFile( alloc: CFAllocatorRef; fileURL: CFURLRef ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithFile';
  220. { CF_IMPLICIT_BRIDGING_DISABLED }
  221. procedure CFStreamCreateBoundPair( alloc: CFAllocatorRef; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef; transferBufferSize: CFIndex ); external name '_CFStreamCreateBoundPair';
  222. { CF_IMPLICIT_BRIDGING_ENABLED }
  223. {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
  224. { Property for file write streams; value should be a CFBoolean. Set to TRUE to append to a file, rather than to replace its contents }
  225. var kCFStreamPropertyAppendToFile: CFStringRef; external name '_kCFStreamPropertyAppendToFile'; (* attribute const *)
  226. {#endif}
  227. // Value is a CFNumber
  228. var kCFStreamPropertyFileCurrentOffset: CFStringRef; external name '_kCFStreamPropertyFileCurrentOffset'; (* attribute const *)
  229. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  230. { Socket stream properties }
  231. { Value will be a CFData containing the native handle }
  232. var kCFStreamPropertySocketNativeHandle: CFStringRef; external name '_kCFStreamPropertySocketNativeHandle'; (* attribute const *)
  233. { Value will be a CFString, or NULL if unknown }
  234. var kCFStreamPropertySocketRemoteHostName: CFStringRef; external name '_kCFStreamPropertySocketRemoteHostName'; (* attribute const *)
  235. { Value will be a CFNumber, or NULL if unknown }
  236. var kCFStreamPropertySocketRemotePortNumber: CFStringRef; external name '_kCFStreamPropertySocketRemotePortNumber'; (* attribute const *)
  237. { Socket streams; the returned streams are paired such that they use the same socket; pass NULL if you want only the read stream or the write stream }
  238. procedure CFStreamCreatePairWithSocket( alloc: CFAllocatorRef; sock: CFSocketNativeHandle; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithSocket';
  239. procedure CFStreamCreatePairWithSocketToHost( alloc: CFAllocatorRef; host: CFStringRef; port: UInt32; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithSocketToHost';
  240. {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
  241. procedure CFStreamCreatePairWithPeerSocketSignature( alloc: CFAllocatorRef; const (*var*) signature: CFSocketSignature; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithPeerSocketSignature';
  242. {#endif}
  243. { Returns the current state of the stream }
  244. function CFReadStreamGetStatus( stream: CFReadStreamRef ): CFStreamStatus; external name '_CFReadStreamGetStatus';
  245. function CFWriteStreamGetStatus( stream: CFWriteStreamRef ): CFStreamStatus; external name '_CFWriteStreamGetStatus';
  246. { Returns NULL if no error has occurred; otherwise returns the error. }
  247. function CFReadStreamCopyError( stream: CFReadStreamRef ): CFErrorRef; external name '_CFReadStreamCopyError';
  248. (* CF_AVAILABLE_STARTING(10_5, 2_0) *)
  249. function CFWriteStreamCopyError( stream: CFWriteStreamRef ): CFErrorRef; external name '_CFWriteStreamCopyError';
  250. (* CF_AVAILABLE_STARTING(10_5, 2_0) *)
  251. { Returns success/failure. Opening a stream causes it to reserve all the system
  252. resources it requires. If the stream can open non-blocking, this will always
  253. return TRUE; listen to the run loop source to find out when the open completes
  254. and whether it was successful, or poll using CFRead/WriteStreamGetStatus(), waiting
  255. for a status of kCFStreamStatusOpen or kCFStreamStatusError. }
  256. function CFReadStreamOpen( stream: CFReadStreamRef ): Boolean; external name '_CFReadStreamOpen';
  257. function CFWriteStreamOpen( stream: CFWriteStreamRef ): Boolean; external name '_CFWriteStreamOpen';
  258. { Terminates the flow of bytes; releases any system resources required by the
  259. stream. The stream may not fail to close. You may call CFStreamClose() to
  260. effectively abort a stream. }
  261. procedure CFReadStreamClose( stream: CFReadStreamRef ); external name '_CFReadStreamClose';
  262. procedure CFWriteStreamClose( stream: CFWriteStreamRef ); external name '_CFWriteStreamClose';
  263. { Whether there is data currently available for reading; returns TRUE if it's
  264. impossible to tell without trying }
  265. function CFReadStreamHasBytesAvailable( stream: CFReadStreamRef ): Boolean; external name '_CFReadStreamHasBytesAvailable';
  266. { Returns the number of bytes read, or -1 if an error occurs preventing any
  267. bytes from being read, or 0 if the stream's end was encountered.
  268. It is an error to try and read from a stream that hasn't been opened first.
  269. This call will block until at least one byte is available; it will NOT block
  270. until the entire buffer can be filled. To avoid blocking, either poll using
  271. CFReadStreamHasBytesAvailable() or use the run loop and listen for the
  272. kCFStreamCanRead event for notification of data available. }
  273. function CFReadStreamRead( stream: CFReadStreamRef; buffer: UnivPtr; bufferLength: CFIndex ): CFIndex; external name '_CFReadStreamRead';
  274. { Returns a pointer to an internal buffer if possible (setting *numBytesRead
  275. to the length of the returned buffer), otherwise returns NULL; guaranteed
  276. to return in O(1). Bytes returned in the buffer are considered read from
  277. the stream; if maxBytesToRead is greater than 0, not more than maxBytesToRead
  278. will be returned. If maxBytesToRead is less than or equal to zero, as many bytes
  279. as are readily available will be returned. The returned buffer is good only
  280. until the next stream operation called on the stream. Caller should neither
  281. change the contents of the returned buffer nor attempt to deallocate the buffer;
  282. it is still owned by the stream. }
  283. function CFReadStreamGetBuffer( stream: CFReadStreamRef; maxBytesToRead: CFIndex; var numBytesRead: CFIndex ): UInt8Ptr; external name '_CFReadStreamGetBuffer';
  284. { Whether the stream can currently be written to without blocking;
  285. returns TRUE if it's impossible to tell without trying }
  286. function CFWriteStreamCanAcceptBytes( stream: CFWriteStreamRef ): Boolean; external name '_CFWriteStreamCanAcceptBytes';
  287. { Returns the number of bytes successfully written, -1 if an error has
  288. occurred, or 0 if the stream has been filled to capacity (for fixed-length
  289. streams). If the stream is not full, this call will block until at least
  290. one byte is written. To avoid blocking, either poll via CFWriteStreamCanAcceptBytes
  291. or use the run loop and listen for the kCFStreamCanWrite event. }
  292. function CFWriteStreamWrite( stream: CFWriteStreamRef; buffer: UnivPtr; bufferLength: CFIndex ): CFIndex; external name '_CFWriteStreamWrite';
  293. { Particular streams can name properties and assign meanings to them; you
  294. access these properties through the following calls. A property is any interesting
  295. information about the stream other than the data being transmitted itself.
  296. Examples include the headers from an HTTP transmission, or the expected
  297. number of bytes, or permission information, etc. Properties that can be set
  298. configure the behavior of the stream, and may only be settable at particular times
  299. (like before the stream has been opened). See the documentation for particular
  300. properties to determine their get- and set-ability. }
  301. function CFReadStreamCopyProperty( stream: CFReadStreamRef; propertyName: CFStringRef ): CFTypeRef; external name '_CFReadStreamCopyProperty';
  302. function CFWriteStreamCopyProperty( stream: CFWriteStreamRef; propertyName: CFStringRef ): CFTypeRef; external name '_CFWriteStreamCopyProperty';
  303. {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
  304. { Returns TRUE if the stream recognizes and accepts the given property-value pair;
  305. FALSE otherwise. }
  306. function CFReadStreamSetProperty( stream: CFReadStreamRef; propertyName: CFStringRef; propertyValue: CFTypeRef ): Boolean; external name '_CFReadStreamSetProperty';
  307. function CFWriteStreamSetProperty( stream: CFWriteStreamRef; propertyName: CFStringRef; propertyValue: CFTypeRef ): Boolean; external name '_CFWriteStreamSetProperty';
  308. {#endif}
  309. { Asynchronous processing - If you wish to neither poll nor block, you may register
  310. a client to hear about interesting events that occur on a stream. Only one client
  311. per stream is allowed; registering a new client replaces the previous one.
  312. Once you have set a client, you need to schedule a run loop on which that client
  313. can be notified. You may schedule multiple run loops (for instance, if you are
  314. using a thread pool). The client callback will be triggered via one of the scheduled
  315. run loops; It is the caller's responsibility to ensure that at least one of the
  316. scheduled run loops is being run.
  317. NOTE: Unlike other CoreFoundation APIs, pasing a NULL clientContext here will remove
  318. the client. If you do not care about the client context (i.e. your only concern
  319. is that your callback be called), you should pass in a valid context where every
  320. entry is 0 or NULL.
  321. }
  322. function CFReadStreamSetClient( stream: CFReadStreamRef; streamEvents: CFOptionFlags; clientCB: CFReadStreamClientCallBack; var clientContext: CFStreamClientContext ): Boolean; external name '_CFReadStreamSetClient';
  323. function CFWriteStreamSetClient( stream: CFWriteStreamRef; streamEvents: CFOptionFlags; clientCB: CFWriteStreamClientCallBack; var clientContext: CFStreamClientContext ): Boolean; external name '_CFWriteStreamSetClient';
  324. procedure CFReadStreamScheduleWithRunLoop( stream: CFReadStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFReadStreamScheduleWithRunLoop';
  325. procedure CFWriteStreamScheduleWithRunLoop( stream: CFWriteStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFWriteStreamScheduleWithRunLoop';
  326. procedure CFReadStreamUnscheduleFromRunLoop( stream: CFReadStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFReadStreamUnscheduleFromRunLoop';
  327. procedure CFWriteStreamUnscheduleFromRunLoop( stream: CFWriteStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFWriteStreamUnscheduleFromRunLoop';
  328. { The following API is deprecated starting in 10.5; please use CFRead/WriteStreamCopyError(), above, instead }
  329. const
  330. kCFStreamErrorDomainCustom = -1; { custom to the kind of stream in question }
  331. kCFStreamErrorDomainPOSIX = 1; { POSIX errno; interpret using <sys/errno.h> }
  332. kCFStreamErrorDomainMacOSStatus = 2; { OSStatus type from Carbon APIs; interpret using <MacTypes.h> }
  333. type
  334. CFStreamErrorDomain = CFIndex;
  335. type
  336. CFStreamError = record
  337. domain: CFIndex;
  338. error: SInt32;
  339. end;
  340. CFStreamErrorPtr = ^CFStreamError;
  341. { 0 is returned if no error has occurred. errorDomain specifies the domain
  342. in which the error code should be interpretted; pass NULL if you are not
  343. interested. }
  344. function CFReadStreamGetError( stream: CFReadStreamRef ): CFStreamError; external name '_CFReadStreamGetError';
  345. function CFWriteStreamGetError( stream: CFWriteStreamRef ): CFStreamError; external name '_CFWriteStreamGetError';
  346. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  347. end.
  348. {$endc} {not MACOSALLINCLUDE}