added TLS/SSL support
This commit is contained in:
@@ -1,9 +1,24 @@
|
||||
#ifndef NETCODE_H
|
||||
#define NETCODE_H
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SSL *ssl;
|
||||
int sockfd;
|
||||
SSL_CTX *ctx;
|
||||
} sslSockfd_t;
|
||||
|
||||
// Returns a socket file descriptor.
|
||||
int NET_Connect(const char* host, int port);
|
||||
void NET_Send(int sockfd, const char* toSend);
|
||||
void NET_Close(int sockfd);
|
||||
sslSockfd_t NET_Connect(const char* host, int port);
|
||||
void NET_Send(sslSockfd_t info, const char* toSend);
|
||||
void NET_Close(sslSockfd_t info);
|
||||
|
||||
// TLS versions of the same thing
|
||||
sslSockfd_t NET_TLS_Connect(const char* host, int port);
|
||||
void NET_TLS_Send(sslSockfd_t info, const char* toSend);
|
||||
void NET_TLS_Close(sslSockfd_t info);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user