ssl.h 1.42 KB
Newer Older
Leigh Stoller's avatar
Leigh Stoller committed
1 2 3 4 5 6
/*
 * EMULAB-COPYRIGHT
 * Copyright (c) 2000-2002 University of Utah and the Flux Group.
 * All rights reserved.
 */

7 8 9 10 11 12 13 14 15 16 17
/*
 * SSL prototypes and definitions.
 */

int		tmcd_server_sslinit(void);
int		tmcd_client_sslinit(void);
int		tmcd_sslaccept(int sock, struct sockaddr *, socklen_t *);
int		tmcd_sslconnect(int sock, const struct sockaddr *, socklen_t);
int		tmcd_sslwrite(int sock, const void *buf, size_t nbytes);
int		tmcd_sslread(int sock, void *buf, size_t nbytes);
int		tmcd_sslclose(int sock);
18 19 20 21 22 23 24 25
int		tmcd_sslverify_client(char *, char *, char *, int);
int		isssl;

/*
 * The client sends this tag to indicate that it is SSL capable.
 * Only local nodes can skip SSL. Remote nodes must use SSL!
 */
#define SPEAKSSL	"ISPEAKSSL_TMCDV10"
26 27 28 29 30 31 32 33 34 35 36

/*
 * When compiled to use SSL, redefine the routines appropriately
 */
#ifdef WITHSSL
#define ACCEPT		tmcd_sslaccept
#define CONNECT		tmcd_sslconnect
#define WRITE		tmcd_sslwrite
#define READ		tmcd_sslread
#define CLOSE		tmcd_sslclose
#else
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#ifdef _WIN32
inline int win_send(SOCKET s, const char FAR* buf, int len)
{
        return send(s,buf,len,0);
}
inline int win_recv(SOCKET s, char FAR* buf, int len)
{
        return recv(s,buf,len,0);
}
#define ACCEPT		accept
#define CONNECT		connect
#define WRITE		win_send
#define READ		win_recv
#define CLOSE		close
#else
52 53 54 55 56
#define ACCEPT		accept
#define CONNECT		connect
#define WRITE		write
#define READ		read
#define CLOSE		close
57 58
#endif /*_WIN32*/
#endif /*WITHSSL*/