2 * sslRingBufferThreads.h - SecureTransport client and server thread
3 * routines which use ringBufferIo for I/O (no sockets).
6 #include <Security/SecureTransport.h>
7 #include <clAppUtils/ringBufferIo.h>
8 #include <CoreFoundation/CoreFoundation.h>
10 #ifndef _SSL_RING_BUFFER_THREADS_H_
11 #define _SSL_RING_BUFFER_THREADS_H_
18 * arguments to client thread and server pseudothread
21 CFArrayRef idArray
; /* required for server, optional for client */
22 CFArrayRef trustedRoots
; /* generally from server's idArray */
23 unsigned xferSize
; /* total bytes for client to write and server to
25 void *xferBuf
; /* move to/from here */
26 unsigned chunkSize
; /* size of xferBuf; client writes this much at
28 bool runForever
; /* if true, ignore xferSize and move data forever
30 SSLCipherSuite cipherSuite
;
32 RingBuffer
*ringWrite
; /* I/O writes to this... */
33 RingBuffer
*ringRead
; /* ...and reads from this */
35 /* client's goFlag is &(server's iAmReady); vice versa */
36 bool iAmReady
; /* this thread is ready for handshake */
37 bool *goFlag
; /* when both threads see this, they start
39 bool *abortFlag
; /* anyone sets this on error */
40 /* everyone aborts when they see this true */
41 bool pauseOnError
; /* call testError() on error */
43 /* returned on success */
44 SSLProtocol negotiatedProt
;
45 SSLCipherSuite negotiatedCipher
;
47 CFAbsoluteTime startHandshake
;
48 CFAbsoluteTime startData
;
49 CFAbsoluteTime endData
;
53 * Client thread - handshake and write sslArgs->xferSize bytes of data.
55 void *sslRbClientThread(void *arg
);
58 * Server function - like clientThread except it runs from the main thread.
59 * handshake and read sslArgs->xferSize bytes of data.
61 OSStatus
sslRbServerThread(SslRingBufferArgs
*sslArgs
);
67 #endif /* _SSL_RING_BUFFER_THREADS_H_*/