CFSocketStream.pas 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. {
  2. File: CFNetwork/CFSocketStream.h
  3. Contains: CoreFoundation Network socket streams header
  4. Version: CFNetwork-71.2~1
  5. Copyright: © 2001-2003 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Pascal Translation: Peter N Lewis, <[email protected]>, 2004 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit CFSocketStream;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  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 CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,CFStream,CFBase,CFHost,CFNetServices;
  92. {$ALIGN MAC68K}
  93. {
  94. * kCFStreamErrorDomainSSL
  95. *
  96. * Discussion:
  97. * Errors located in Security/SecureTransport.h
  98. *
  99. * Availability:
  100. * Mac OS X: in version 10.2 and later
  101. * CarbonLib: not available
  102. * Non-Carbon CFM: not available
  103. }
  104. var kCFStreamErrorDomainSSL: SInt32; external name '_kCFStreamErrorDomainSSL'; (* attribute const *)
  105. {
  106. * kCFStreamPropertySocketSecurityLevel
  107. *
  108. * Discussion:
  109. * Stream property key, for both set and copy operations. To set a
  110. * stream to be secure, call CFReadStreamSetProperty or
  111. * CFWriteStreamSetPropertywith the property name set to
  112. * kCFStreamPropertySocketSecurityLevel and the value being one of
  113. * the following values. Streams may set a security level after
  114. * open in order to allow on-the-fly securing of a stream.
  115. *
  116. * Availability:
  117. * Mac OS X: in version 10.2 and later
  118. * CarbonLib: not available
  119. * Non-Carbon CFM: not available
  120. }
  121. var kCFStreamPropertySocketSecurityLevel: CFStringRef; external name '_kCFStreamPropertySocketSecurityLevel'; (* attribute const *)
  122. {
  123. * kCFStreamSocketSecurityLevelNone
  124. *
  125. * Discussion:
  126. * Stream property value, for both set and copy operations.
  127. * Indicates to use no security (default setting).
  128. *
  129. * Availability:
  130. * Mac OS X: in version 10.2 and later
  131. * CarbonLib: not available
  132. * Non-Carbon CFM: not available
  133. }
  134. var kCFStreamSocketSecurityLevelNone: CFStringRef; external name '_kCFStreamSocketSecurityLevelNone'; (* attribute const *)
  135. {
  136. * kCFStreamSocketSecurityLevelSSLv2
  137. *
  138. * Discussion:
  139. * Stream property value, for both set and copy operations.
  140. * Indicates to use SSLv2 security.
  141. *
  142. * Availability:
  143. * Mac OS X: in version 10.2 and later
  144. * CarbonLib: not available
  145. * Non-Carbon CFM: not available
  146. }
  147. var kCFStreamSocketSecurityLevelSSLv2: CFStringRef; external name '_kCFStreamSocketSecurityLevelSSLv2'; (* attribute const *)
  148. {
  149. * kCFStreamSocketSecurityLevelSSLv3
  150. *
  151. * Discussion:
  152. * Stream property value, for both set and copy operations.
  153. * Indicates to use SSLv3 security.
  154. *
  155. * Availability:
  156. * Mac OS X: in version 10.2 and later
  157. * CarbonLib: not available
  158. * Non-Carbon CFM: not available
  159. }
  160. var kCFStreamSocketSecurityLevelSSLv3: CFStringRef; external name '_kCFStreamSocketSecurityLevelSSLv3'; (* attribute const *)
  161. {
  162. * kCFStreamSocketSecurityLevelTLSv1
  163. *
  164. * Discussion:
  165. * Stream property value, for both set and copy operations.
  166. * Indicates to use TLSv1 security.
  167. *
  168. * Availability:
  169. * Mac OS X: in version 10.2 and later
  170. * CarbonLib: not available
  171. * Non-Carbon CFM: not available
  172. }
  173. var kCFStreamSocketSecurityLevelTLSv1: CFStringRef; external name '_kCFStreamSocketSecurityLevelTLSv1'; (* attribute const *)
  174. {
  175. * kCFStreamSocketSecurityLevelNegotiatedSSL
  176. *
  177. * Discussion:
  178. * Stream property value, for both set and copy operations.
  179. * Indicates to use TLS or SSL with fallback to lower versions. This
  180. * is what HTTPS does, for instance.
  181. *
  182. * Availability:
  183. * Mac OS X: in version 10.2 and later
  184. * CarbonLib: not available
  185. * Non-Carbon CFM: not available
  186. }
  187. var kCFStreamSocketSecurityLevelNegotiatedSSL: CFStringRef; external name '_kCFStreamSocketSecurityLevelNegotiatedSSL'; (* attribute const *)
  188. {
  189. * kCFStreamErrorDomainSOCKS
  190. *
  191. * Discussion:
  192. * SOCKS proxy error domain. Errors formulated using inlines below.
  193. *
  194. * Availability:
  195. * Mac OS X: in version 10.2 and later
  196. * CarbonLib: not available
  197. * Non-Carbon CFM: not available
  198. }
  199. var kCFStreamErrorDomainSOCKS: SInt32; external name '_kCFStreamErrorDomainSOCKS'; (* attribute const *)
  200. {
  201. CF_INLINE
  202. SInt32 CFSocketStreamSOCKSGetErrorSubdomain(CFStreamError* error)
  203. return ((error->domain >> 16) & 0x0000FFFF);
  204. CF_INLINE
  205. SInt32 CFSocketStreamSOCKSGetError(CFStreamError* error)
  206. return (error->domain & 0x0000FFFF);
  207. }
  208. const
  209. kCFStreamErrorSOCKSSubDomainNone = 0; { Error code is a general SOCKS error }
  210. kCFStreamErrorSOCKSSubDomainVersionCode = 1; { Error code is the version of SOCKS which the server wishes to use }
  211. kCFStreamErrorSOCKS4SubDomainResponse = 2; { Error code is the status code returned by the server }
  212. kCFStreamErrorSOCKS5SubDomainUserPass = 3; { Error code is the status code that the server returned }
  213. kCFStreamErrorSOCKS5SubDomainMethod = 4; { Error code is the server's desired negotiation method }
  214. kCFStreamErrorSOCKS5SubDomainResponse = 5; { Error code is the response code that the server returned in reply to the connection request }
  215. { kCFStreamErrorSOCKSSubDomainNone}
  216. const
  217. kCFStreamErrorSOCKS5BadResponseAddr = 1;
  218. kCFStreamErrorSOCKS5BadState = 2;
  219. kCFStreamErrorSOCKSUnknownClientVersion = 3;
  220. { kCFStreamErrorSOCKS4SubDomainResponse}
  221. const
  222. kCFStreamErrorSOCKS4RequestFailed = 91; { request rejected or failed }
  223. kCFStreamErrorSOCKS4IdentdFailed = 92; { request rejected because SOCKS server cannot connect to identd on the client }
  224. kCFStreamErrorSOCKS4IdConflict = 93; { request rejected because the client program and identd report different user-ids }
  225. { kCFStreamErrorSOCKS5SubDomainMethod}
  226. const
  227. kSOCKS5NoAcceptableMethod = $0FF; { other values indicate the server's desired method }
  228. {
  229. * kCFStreamPropertySOCKSProxy
  230. *
  231. * Discussion:
  232. * Stream property key, for both set and copy operations. To set a
  233. * stream to use a SOCKS proxy, call CFReadStreamSetProperty or
  234. * CFWriteStreamSetProperty with the property name set to
  235. * kCFStreamPropertySOCKSProxy and the value being a dictionary with
  236. * at least the following two keys: kCFStreamPropertySOCKSProxyHost
  237. * and kCFStreamPropertySOCKSProxyPort. The dictionary returned by
  238. * SystemConfiguration for SOCKS proxies will work without
  239. * alteration.
  240. *
  241. * Availability:
  242. * Mac OS X: in version 10.2 and later
  243. * CarbonLib: not available
  244. * Non-Carbon CFM: not available
  245. }
  246. var kCFStreamPropertySOCKSProxy: CFStringRef; external name '_kCFStreamPropertySOCKSProxy'; (* attribute const *)
  247. {
  248. * kCFStreamPropertySOCKSProxyHost
  249. *
  250. * Discussion:
  251. * CFDictinary key for SOCKS proxy information. The key
  252. * kCFStreamPropertySOCKSProxyHost should contain a CFStringRef
  253. * value representing the SOCKS proxy host. Defined to match
  254. * kSCPropNetProxiesSOCKSProxy
  255. *
  256. * Availability:
  257. * Mac OS X: in version 10.2 and later
  258. * CarbonLib: not available
  259. * Non-Carbon CFM: not available
  260. }
  261. var kCFStreamPropertySOCKSProxyHost: CFStringRef; external name '_kCFStreamPropertySOCKSProxyHost'; (* attribute const *)
  262. {
  263. * kCFStreamPropertySOCKSProxyPort
  264. *
  265. * Discussion:
  266. * CFDictinary key for SOCKS proxy information. The key
  267. * kCFStreamPropertySOCKSProxyPort should contain a CFNumberRef
  268. * which itself is of type kCFNumberSInt32Type. This value should
  269. * represent the port on which the proxy is listening. Defined to
  270. * match kSCPropNetProxiesSOCKSPort
  271. *
  272. * Availability:
  273. * Mac OS X: in version 10.2 and later
  274. * CarbonLib: not available
  275. * Non-Carbon CFM: not available
  276. }
  277. var kCFStreamPropertySOCKSProxyPort: CFStringRef; external name '_kCFStreamPropertySOCKSProxyPort'; (* attribute const *)
  278. {
  279. * kCFStreamPropertySOCKSVersion
  280. *
  281. * Discussion:
  282. * CFDictinary key for SOCKS proxy information. By default, SOCKS5
  283. * will be used unless there is a kCFStreamPropertySOCKSVersion key
  284. * in the dictionary. Its value must be
  285. * kCFStreamSocketSOCKSVersion4 or kCFStreamSocketSOCKSVersion5 to
  286. * set SOCKS4 or SOCKS5, respectively.
  287. *
  288. * Availability:
  289. * Mac OS X: in version 10.2 and later
  290. * CarbonLib: not available
  291. * Non-Carbon CFM: not available
  292. }
  293. var kCFStreamPropertySOCKSVersion: CFStringRef; external name '_kCFStreamPropertySOCKSVersion'; (* attribute const *)
  294. {
  295. * kCFStreamSocketSOCKSVersion4
  296. *
  297. * Discussion:
  298. * CFDictionary value for SOCKS proxy information. Indcates that
  299. * SOCKS will or is using version 4 of the SOCKS protocol.
  300. *
  301. * Availability:
  302. * Mac OS X: in version 10.2 and later
  303. * CarbonLib: not available
  304. * Non-Carbon CFM: not available
  305. }
  306. var kCFStreamSocketSOCKSVersion4: CFStringRef; external name '_kCFStreamSocketSOCKSVersion4'; (* attribute const *)
  307. {
  308. * kCFStreamSocketSOCKSVersion5
  309. *
  310. * Discussion:
  311. * CFDictionary value for SOCKS proxy information. Indcates that
  312. * SOCKS will or is using version 5 of the SOCKS protocol.
  313. *
  314. * Availability:
  315. * Mac OS X: in version 10.2 and later
  316. * CarbonLib: not available
  317. * Non-Carbon CFM: not available
  318. }
  319. var kCFStreamSocketSOCKSVersion5: CFStringRef; external name '_kCFStreamSocketSOCKSVersion5'; (* attribute const *)
  320. {
  321. * kCFStreamPropertySOCKSUser
  322. *
  323. * Discussion:
  324. * CFDictinary key for SOCKS proxy information. To set a user name
  325. * and/or password, if required, the dictionary must contain the
  326. * key(s) kCFStreamPropertySOCKSUser and/or
  327. * kCFStreamPropertySOCKSPassword with the value being the user's
  328. * name as a CFStringRef and/or the user's password as a
  329. * CFStringRef, respectively.
  330. *
  331. * Availability:
  332. * Mac OS X: in version 10.2 and later
  333. * CarbonLib: not available
  334. * Non-Carbon CFM: not available
  335. }
  336. var kCFStreamPropertySOCKSUser: CFStringRef; external name '_kCFStreamPropertySOCKSUser'; (* attribute const *)
  337. {
  338. * kCFStreamPropertySOCKSPassword
  339. *
  340. * Discussion:
  341. * CFDictinary key for SOCKS proxy information. To set a user name
  342. * and/or password, if required, the dictionary must contain the
  343. * key(s) kCFStreamPropertySOCKSUser and/or
  344. * kCFStreamPropertySOCKSPassword with the value being the user's
  345. * name as a CFStringRef and/or the user's password as a
  346. * CFStringRef, respectively.
  347. *
  348. * Availability:
  349. * Mac OS X: in version 10.2 and later
  350. * CarbonLib: not available
  351. * Non-Carbon CFM: not available
  352. }
  353. var kCFStreamPropertySOCKSPassword: CFStringRef; external name '_kCFStreamPropertySOCKSPassword'; (* attribute const *)
  354. {
  355. * kCFStreamPropertyShouldCloseNativeSocket
  356. *
  357. * Discussion:
  358. * Set the value to kCFBooleanTrue if the stream should close and
  359. * release the underlying native socket when the stream is released.
  360. * Set the value to kCFBooleanFalse to keep the native socket from
  361. * closing and releasing when the stream is released. If the stream
  362. * was created with a native socket, the default property setting on
  363. * the stream is kCFBooleanFalse. The
  364. * kCFStreamPropertyShouldCloseNativeSocket can be set through
  365. * CFReadStreamSetProperty or CFWriteStreamSetProperty. The
  366. * property can be copied through CFReadStreamCopyProperty or
  367. * CFWriteStreamCopyProperty.
  368. *
  369. * Availability:
  370. * Mac OS X: in version 10.2 and later
  371. * CarbonLib: not available
  372. * Non-Carbon CFM: not available
  373. }
  374. var kCFStreamPropertyShouldCloseNativeSocket: CFStringRef; external name '_kCFStreamPropertyShouldCloseNativeSocket'; (* attribute const *)
  375. {
  376. * kCFStreamPropertySocketRemoteHost
  377. *
  378. * Discussion:
  379. * Stream property key for copy operations. Returns a CFHostRef if
  380. * known, otherwise NULL.
  381. *
  382. * Availability:
  383. * Mac OS X: in version 10.3 and later in CoreServices.framework
  384. * CarbonLib: not available
  385. * Non-Carbon CFM: not available
  386. }
  387. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  388. var kCFStreamPropertySocketRemoteHost: CFStringRef; external name '_kCFStreamPropertySocketRemoteHost'; (* attribute const *)
  389. {
  390. * kCFStreamPropertySocketRemoteNetService
  391. *
  392. * Discussion:
  393. * Stream property key for copy operations. Returns a
  394. * CFNetServiceRef if known, otherwise NULL.
  395. *
  396. * Availability:
  397. * Mac OS X: in version 10.3 and later in CoreServices.framework
  398. * CarbonLib: not available
  399. * Non-Carbon CFM: not available
  400. }
  401. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  402. var kCFStreamPropertySocketRemoteNetService: CFStringRef; external name '_kCFStreamPropertySocketRemoteNetService'; (* attribute const *)
  403. {
  404. * CFStreamCreatePairWithSocketToCFHost()
  405. *
  406. * Discussion:
  407. * Given a CFHostRef, this function will create a pair of streams
  408. * suitable for connecting to the host. If there is a failure
  409. * during creation, the stream references will be set to NULL.
  410. *
  411. * Mac OS X threading:
  412. * Thread safe
  413. *
  414. * Parameters:
  415. *
  416. * alloc:
  417. * The CFAllocator which should be used to allocate memory for the
  418. * streams. If this reference is not a valid CFAllocator, the
  419. * behavior is undefined.
  420. *
  421. * host:
  422. * A reference to a CFHost to which the streams are desired. If
  423. * unresolved, the host will be resolved prior to connecting.
  424. *
  425. * port:
  426. * The port to which the connection should be established.
  427. *
  428. * readStream:
  429. * A pointer to a CFReadStreamRef which will be set to the new
  430. * read stream instance. Can be set to NULL if not desired.
  431. *
  432. * writeStream:
  433. * A pointer to a CFWriteStreamRef which will be set to the new
  434. * write stream instance. Can be set to NULL if not desired.
  435. *
  436. * Availability:
  437. * Mac OS X: in version 10.3 and later in CoreServices.framework
  438. * CarbonLib: not available
  439. * Non-Carbon CFM: not available
  440. }
  441. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  442. procedure CFStreamCreatePairWithSocketToCFHost( alloc: CFAllocatorRef; host: CFHostRef; port: UInt32; readStream: CFReadStreamRefPtr; writeStream: CFWriteStreamRefPtr ); external name '_CFStreamCreatePairWithSocketToCFHost';
  443. {
  444. * CFStreamCreatePairWithSocketToNetService()
  445. *
  446. * Discussion:
  447. * Given a CFNetService, this function will create a pair of streams
  448. * suitable for connecting to the service. If there is a failure
  449. * during creation, the stream references will be set to NULL.
  450. *
  451. * Mac OS X threading:
  452. * Thread safe
  453. *
  454. * Parameters:
  455. *
  456. * alloc:
  457. * The CFAllocator which should be used to allocate memory for the
  458. * streams. If this reference is not a valid CFAllocator, the
  459. * behavior is undefined.
  460. *
  461. * service:
  462. * A reference to a CFNetService to which the streams are desired.
  463. * If unresolved, the service will be resolved prior to
  464. * connecting.
  465. *
  466. * readStream:
  467. * A pointer to a CFReadStreamRef which will be set to the new
  468. * read stream instance. Can be set to NULL if not desired.
  469. *
  470. * writeStream:
  471. * A pointer to a CFWriteStreamRef which will be set to the new
  472. * write stream instance. Can be set to NULL if not desired.
  473. *
  474. * Availability:
  475. * Mac OS X: in version 10.3 and later in CoreServices.framework
  476. * CarbonLib: not available
  477. * Non-Carbon CFM: not available
  478. }
  479. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  480. procedure CFStreamCreatePairWithSocketToNetService( alloc: CFAllocatorRef; service: CFNetServiceRef; readStream: CFReadStreamRefPtr; writeStream: CFWriteStreamRefPtr ); external name '_CFStreamCreatePairWithSocketToNetService';
  481. {
  482. * CFStreamSocketSecurityProtocol
  483. *
  484. * Discussion:
  485. * These enum values and CFSocketStreamPairSetSecurityProtocol have
  486. * been deprecated in favor of CFReadStreamSetProperty and
  487. * CFWriteStreamSetProperty with the previously mentioned property
  488. * and values.
  489. }
  490. type
  491. CFStreamSocketSecurityProtocol = SInt32;
  492. const
  493. {
  494. * DEPRECATED, use kCFStreamSocketSecurityLevelNone
  495. }
  496. kCFStreamSocketSecurityNone = 0;
  497. {
  498. * DEPRECATED, use kCFStreamSocketSecurityLevelSSLv2
  499. }
  500. kCFStreamSocketSecuritySSLv2 = 1;
  501. {
  502. * DEPRECATED, use kCFStreamSocketSecurityLevelSSLv3
  503. }
  504. kCFStreamSocketSecuritySSLv3 = 2;
  505. {
  506. * DEPRECATED, use kCFStreamSocketSecurityLevelNegotiatedSSL
  507. }
  508. kCFStreamSocketSecuritySSLv23 = 3;
  509. {
  510. * DEPRECATED, use kCFStreamSocketSecurityLevelTLSv1
  511. }
  512. kCFStreamSocketSecurityTLSv1 = 4;
  513. {
  514. * CFSocketStreamPairSetSecurityProtocol() *** DEPRECATED ***
  515. *
  516. * Discussion:
  517. * CFSocketStreamPairSetSecurityProtocol has been deprecated in
  518. * favor of CFReadStreamSetProperty and CFWriteStreamSetProperty
  519. * with the previously mentioned property and values. Sets the
  520. * security level on a pair of streams.
  521. *
  522. * Mac OS X threading:
  523. * Thread safe
  524. *
  525. * Parameters:
  526. *
  527. * socketReadStream:
  528. * Read stream reference which is to have its security level
  529. * changed.
  530. *
  531. * socketWriteStream:
  532. * Write stream reference which is to have its security level
  533. * changed.
  534. *
  535. * securityProtocol:
  536. * CFStreamSocketSecurityProtocol enum indicating the security
  537. * level to be set.
  538. *
  539. * Result:
  540. * Returns TRUE if the settings were placed on the stream, FALSE
  541. * otherwise.
  542. *
  543. * Availability:
  544. * Mac OS X: in version 10.1 and later in CoreServices.framework but deprecated in 10.2
  545. * CarbonLib: not available
  546. * Non-Carbon CFM: not available
  547. }
  548. // AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_2
  549. function CFSocketStreamPairSetSecurityProtocol( socketReadStream: CFReadStreamRef; socketWriteStream: CFWriteStreamRef; securityProtocol: CFStreamSocketSecurityProtocol ): Boolean; external name '_CFSocketStreamPairSetSecurityProtocol';
  550. end.