]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/threadTest/ioSockThr.h
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / clxutils / threadTest / ioSockThr.h
1 /*
2 * ioSockThr.h - socket-based I/O routines for SecureTransport tests
3 */
4
5 #ifndef _IO_SOCK_THR_H_
6 #define _IO_SOCK_THR_H_
7
8 #include <MacTypes.h>
9 #include <Security/SecureTransport.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /*
16 * Opaque reference to a connection.
17 */
18 typedef int otSocket;
19
20 /*
21 * info about a peer returned from MakeServerConnection() and
22 * AcceptClientConnection().
23 */
24 typedef struct
25 { UInt32 ipAddr;
26 int port;
27 } PeerSpec;
28
29 /*
30 * Ont-time only init.
31 */
32 void initSslOt();
33
34 /*
35 * Connect to server.
36 */
37 extern OSStatus MakeServerConnection(
38 const char *hostName,
39 int port,
40 otSocket *socketNo, // RETURNED
41 PeerSpec *peer); // RETURNED
42
43 /*
44 * Accept a client connection.
45 */
46 OSStatus AcceptClientConnection(
47 int port,
48 otSocket *socketNo, // RETURNED
49 PeerSpec *peer); // RETURNED
50
51 /*
52 * Shut down a connection.
53 */
54 void endpointShutdown(
55 otSocket socket);
56
57 /*
58 * R/W. Called out from SSL.
59 */
60 OSStatus SocketRead(
61 SSLConnectionRef connection,
62 void *data, /* owned by
63 * caller, data
64 * RETURNED */
65 size_t *dataLength); /* IN/OUT */
66
67 OSStatus SocketWrite(
68 SSLConnectionRef connection,
69 const void *data,
70 size_t *dataLength); /* IN/OUT */
71
72 #ifdef __cplusplus
73 }
74 #endif
75
76 #endif /* _IO_SOCK_THR_H_ */