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

7 8 9 10 11 12
/*
 * SSL prototypes and definitions.
 */

int		tmcd_server_sslinit(void);
int		tmcd_client_sslinit(void);
13
int		tmcd_sslaccept(int sock, struct sockaddr *, socklen_t *, int);
14 15 16 17
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
int		tmcd_sslverify_client(char *, char *, char *, int);
int		isssl;
20
int		nousessl;
21 22 23 24 25 26

/*
 * 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"
27 28 29 30 31 32 33 34 35 36 37

/*
 * 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
38 39 40 41 42 43 44 45 46
#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);
}
47
#define ACCEPT		tmcd_accept
48 49 50 51 52
#define CONNECT		connect
#define WRITE		win_send
#define READ		win_recv
#define CLOSE		close
#else
53
#define ACCEPT		tmcd_accept
54 55 56 57
#define CONNECT		connect
#define WRITE		write
#define READ		read
#define CLOSE		close
58 59
#endif /*_WIN32*/
#endif /*WITHSSL*/