From 3483172b50b269bc5333708701663721ad2cd230 Mon Sep 17 00:00:00 2001 From: James Benton Date: Mon, 18 Jun 2018 11:13:25 +0100 Subject: [PATCH] nsysnet: Add NSSL* functions. --- include/nsysnet/nssl.h | 62 ++++++++++++++++++++++++++++++++++++++++ include/nsysnet/socket.h | 8 +++--- 2 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 include/nsysnet/nssl.h diff --git a/include/nsysnet/nssl.h b/include/nsysnet/nssl.h new file mode 100644 index 0000000..ba5f27b --- /dev/null +++ b/include/nsysnet/nssl.h @@ -0,0 +1,62 @@ +#pragma once +#include + +/** + * \defgroup nsysnet_nssl Nintendo SSL + * \ingroup nsysnet + * @{ + */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *NSSLContext; +typedef void *NSSLConnection; + +int32_t +NSSLInit(); + +int32_t +NSSLFinish(); + +NSSLContext +NSSLCreateContext(int32_t unk); + +int32_t +NSSLDestroyContext(NSSLContext context); + +int32_t +NSSLAddServerPKIExternal(NSSLContext context, + const void *cert, + int32_t length, + int32_t unk); + +int32_t +NSSLAddServerPKI(NSSLContext context, + int32_t pki); + +NSSLConnection +NSSLCreateConnection(NSSLContext context, + const char *host, + int32_t hostLength, + int32_t options, + int32_t socket, + int32_t block); + +int32_t +NSSLRead(NSSLConnection connection, + const void *buffer, + int32_t length, + int32_t *outBytesRead); + +int32_t +NSSLWrite(NSSLConnection connection, + const void *buffer, + int32_t length, + int32_t *outBytesWritten); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/include/nsysnet/socket.h b/include/nsysnet/socket.h index 6da99dd..f35cd45 100644 --- a/include/nsysnet/socket.h +++ b/include/nsysnet/socket.h @@ -12,6 +12,10 @@ * \ingroup nsysnet * @{ */ +#ifdef __cplusplus +extern "C" { +#endif + #define SOL_SOCKET -1 #define INADDR_ANY 0 @@ -99,10 +103,6 @@ struct sockaddr_in char sin_zero[8]; }; -#ifdef __cplusplus -extern "C" { -#endif - void socket_lib_init();