// LemonOSLib (lolib): simple system abstractions made specifically for LemonBBS #ifndef LEMONBBS_OSLIB_H #define LEMONBBS_OSLIB_H #include #ifdef _WIN32 #include #elif defined(unix) typedef int SOCKET; #define INVALID_SOCKET -1 #include #include #include #else #error Platform not supported. #endif struct LemonClientSocket { int type; union Descriptor { SSL* sslDescriptor; SOCKET tcpDescriptor; } descriptor; }; typedef SOCKET LemonServerSocket; int lolib_init(); int lolib_quit(); int lolib_finalize(struct LemonClientSocket *socket); int lolib_enableSsl(const char* certfilePath, const char* keyfilePath, char* keyfilePassword); int lolib_createServerSocket(const char* bindAddress, unsigned short port, LemonServerSocket *dst); int lolib_acceptTcpSocket(LemonServerSocket serverSocket, struct LemonClientSocket *dst); int lolib_acceptSslSocket(LemonServerSocket serverSocket, struct LemonClientSocket *dst); int lolib_writeSocket(struct LemonClientSocket *socket, const char* data, unsigned int dataLength); int lolib_readSocket(struct LemonClientSocket *socket, char *data, unsigned int bytesToRead); #endif