mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-12 23:27:42 +08:00
engine: http: add TLS backend using mbedTLS
This commit is contained in:
@@ -17,10 +17,37 @@ GNU General Public License for more details.
|
||||
|
||||
#include "xash3d_types.h"
|
||||
|
||||
// No TLS for you! Yet.
|
||||
static inline qboolean HTTP_TlsAvailable( void )
|
||||
typedef struct tlsctx_s tlsctx_t;
|
||||
|
||||
enum
|
||||
{
|
||||
return false;
|
||||
}
|
||||
HTTP_TLS_OK = 0, // handshake/op completed
|
||||
HTTP_TLS_WANT = -1, // would block, retry next frame
|
||||
HTTP_TLS_ERROR = -2 // permanent failure, tear the connection down
|
||||
};
|
||||
|
||||
#if XASH_MBEDTLS
|
||||
|
||||
void HTTP_TlsInit( void );
|
||||
void HTTP_TlsShutdown( void );
|
||||
qboolean HTTP_TlsAvailable( void );
|
||||
tlsctx_t *HTTP_TlsNew( int socket, const char *hostname );
|
||||
void HTTP_TlsFree( tlsctx_t *ctx );
|
||||
int HTTP_TlsHandshake( tlsctx_t *ctx );
|
||||
int HTTP_TlsSend( tlsctx_t *ctx, const void *buf, int len );
|
||||
int HTTP_TlsRecv( tlsctx_t *ctx, void *buf, int len );
|
||||
|
||||
#else // !XASH_MBEDTLS
|
||||
|
||||
static inline void HTTP_TlsInit( void ) { }
|
||||
static inline void HTTP_TlsShutdown( void ) { }
|
||||
static inline qboolean HTTP_TlsAvailable( void ) { return false; }
|
||||
static inline tlsctx_t *HTTP_TlsNew( int socket, const char *hostname ) { return NULL; }
|
||||
static inline void HTTP_TlsFree( tlsctx_t *ctx ) { }
|
||||
static inline int HTTP_TlsHandshake( tlsctx_t *ctx ) { return HTTP_TLS_ERROR; }
|
||||
static inline int HTTP_TlsSend( tlsctx_t *ctx, const void *buf, int len ) { return HTTP_TLS_ERROR; }
|
||||
static inline int HTTP_TlsRecv( tlsctx_t *ctx, void *buf, int len ) { return HTTP_TLS_ERROR; }
|
||||
|
||||
#endif // XASH_MBEDTLS
|
||||
|
||||
#endif // NET_HTTP_TLS_H
|
||||
|
||||
Reference in New Issue
Block a user