summaryrefslogtreecommitdiffstats
path: root/nanohttp/nanohttp-ssl.h
diff options
context:
space:
mode:
authorGravatar m0gg2006-03-06 13:37:38 +0000
committerGravatar m0gg2006-03-06 13:37:38 +0000
commit52767927889b305fe18b28ddfc5351f08b703d2d (patch)
tree6dbfd60ef92ec9781553ee8cc9c50a5359088b5f /nanohttp/nanohttp-ssl.h
parent45e68a4a2394cf415b157b08a15a5cf8ac0df8f8 (diff)
downloadcsoap-52767927889b305fe18b28ddfc5351f08b703d2d.tar.gz
csoap-52767927889b305fe18b28ddfc5351f08b703d2d.tar.bz2
Various changes see ChangeLog
Diffstat (limited to 'nanohttp/nanohttp-ssl.h')
-rw-r--r--nanohttp/nanohttp-ssl.h99
1 files changed, 41 insertions, 58 deletions
diff --git a/nanohttp/nanohttp-ssl.h b/nanohttp/nanohttp-ssl.h
index 1cdafb2..82a7db7 100644
--- a/nanohttp/nanohttp-ssl.h
+++ b/nanohttp/nanohttp-ssl.h
@@ -18,68 +18,53 @@
/*
* Author: Matt Campbell
- * Contrib:
- * Descrip: Common ssl routines
*/
-
-/* Do enter only if --with-ssl was specified by the configure script */
-#ifdef HAVE_SSL
-
-#ifdef TRU64
-#include <arpa/inet.h>
-typedef unsigned int uint32_t;
-#endif
-
#ifndef __NANOHTTP_SSL_H_
#define __NANOHTTP_SSL_H_
-#include <openssl/ssl.h>
-
-#ifdef WIN32
-typedef unsigned int uint32_t;
-#else
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
#endif
-#define SSL_SERVER 0
-#define SSL_CLIENT 1
-
-#define CERT_SUBJECT 0
-#define CERT_ISSUER 1
-
-typedef struct Con
-{
- SSL *ssl;
- int sock;
-} Con;
+#ifdef HAVE_SSL
-/*
- * Callback for password checker
- */
+#ifdef HAVE_OPENSSL_SSL_H
+#include <openssl/ssl.h>
+#endif
#ifdef __cplusplus
extern "C" {
#endif
-//static int pw_cb(char* buf, int num, int rwflag, void *userdata);
+/**
+ *
+ * Initialization and shutdown of the SSL module
+ *
+ */
+herror_t hssl_module_init(int argc, char **argv);
+void hssl_module_destroy(void);
-/*
- * Start the ssl library
+/**
+ *
+ * Socket initialization and shutdown
+ *
*/
-void start_ssl( void );
+herror_t hssl_client_ssl(hsocket_t *sock);
+herror_t hssl_server_ssl(hsocket_t *sock);
+
+void hssl_cleanup(hsocket_t *sock);
+
/*
- * Initialize the context
+ * Callback for password checker
*/
-
-SSL_CTX *initialize_ctx(const char *keyfile,
- const char *password,
- const char *calist);
+//static int pw_cb(char* buf, int num, int rwflag, void *userdata);
/*
* Quick function for verifying a portion of the cert
* nid is any NID_ defined in <openssl/objects.h>
* returns non-zero if everything went ok
*/
+#define CERT_SUBJECT 1
int verify_sn(X509 * cert, int who, int nid, char *str);
@@ -95,33 +80,31 @@ int verify_sn(X509 * cert, int who, int nid, char *str);
int user_verify(X509 * cert);
-/*
- * Create the ssl socket and return it
- * pass in the context and an open socket
- */
+#ifdef __cplusplus
+}
+#endif
-SSL *init_ssl(SSL_CTX * ctx, int sock, int type);
+#else /* HAVE_SSL */
-/*
- * Close the ssl connection (socket is still left open)
- */
+static inline herror_t hssl_module_init(int argc, char **argv) { return H_OK; }
+static inline void hssl_module_destroy(void) { return; }
-void ssl_cleanup();
+static inline herror_t hssl_client_ssl(hsocket_t *sock) { return H_OK; }
+static inline herror_t hssl_server_ssl(hsocket_t *sock) { return H_OK; }
-/**
- Log funtion to report ssl failures
- @param ssl
- @param ret
- */
-void
-log_ssl_error (SSL * ssl, int ret);
+static inline void hssl_cleanup(hsocket_t *sock) { return; }
-int ssl_checkFatal( SSL *ssl, int status );
+#endif /* HAVE_SSL */
+#ifdef __cplusplus
+extern "C" {
#endif
+herror_t hssl_read(hsocket_t *sock, char *buf, size_t len, size_t *received);
+herror_t hssl_write(hsocket_t *sock, const char *buf, size_t len, size_t *sent);
+
#ifdef __cplusplus
}
#endif
-#endif /* HAVE_SSL */
+#endif