2 * ringBufferThreads.h - SecureTransport client and server thread
3 * routines which use ringBufferIo for I/O (no sockets).
6 #include <Security/SecureTransport.h>
7 #include <Security/SecureTransportPriv.h>
8 #include <clAppUtils/ringBufferIo.h>
9 #include <CoreFoundation/CoreFoundation.h>
11 #ifndef _RING_BUFFER_THREADS_H_
12 #define _RING_BUFFER_THREADS_H_
18 #define SHARED_SECRET_SIZE 32
21 * arguments to client thread and server pseudothread
24 unsigned xferSize
; /* total bytes for client to write and server to
26 void *xferBuf
; /* move to/from here */
27 unsigned chunkSize
; /* size of xferBuf; client writes this much at
29 RingBuffer
*ringWrite
; /* I/O writes to this... */
30 RingBuffer
*ringRead
; /* ...and reads from this */
32 /* client's goFlag is &(server's iAmReady); vice versa */
33 bool iAmReady
; /* this thread is ready for handshake */
34 bool *goFlag
; /* when both threads see this, they start
36 bool *abortFlag
; /* anyone sets this on error */
37 /* everyone aborts when they see this true */
38 bool pauseOnError
; /* call testError() on error */
40 char *hostName
; /* optional for client */
42 /* EAP-specific stuff */
43 unsigned char sharedSecret
[SHARED_SECRET_SIZE
];
44 unsigned char *sessionTicket
; /* for client only */
45 unsigned sessionTicketLen
;
48 * setMasterSecret indicates wheter we call SSLInternalSetMasterSecretFunction().
49 * If false, the server better have a signing identity in idArray.
52 CFArrayRef idArray
; /* optional, server only */
53 CFArrayRef trustedRoots
; /* generally from server's idArray */
55 /* returned on success */
56 SSLProtocol negotiatedProt
;
57 SSLCipherSuite negotiatedCipher
;
58 Boolean sessionWasResumed
;
60 CFAbsoluteTime startHandshake
;
61 CFAbsoluteTime startData
;
62 CFAbsoluteTime endData
;
66 * Client thread - handshake and write sslArgs->xferSize bytes of data.
68 void *rbClientThread(void *arg
);
71 * Server function - like clientThread except it runs from the main thread.
72 * handshake and read sslArgs->xferSize bytes of data.
74 OSStatus
rbServerThread(RingBufferArgs
*sslArgs
);
80 #endif /* _RING_BUFFER_THREADS_H_*/