nanohttp-ssl.c File Reference

#include "nanohttp-error.h"
#include "nanohttp-common.h"
#include "nanohttp-socket.h"
#include "nanohttp-logging.h"
#include "nanohttp-ssl.h"

Go to the source code of this file.

Defines

#define CERT_SUBJECT   1

Functions

int verify_sn (X509 *cert, int who, int nid, char *str)
void hssl_set_hssl_verify_cert (int func(X509 *cert))
void hssl_set_certificate (const char *filename)
void hssl_set_certpass (const char *password)
void hssl_set_ca_list (const char *filename)
void hssl_enable (void)
herror_t hssl_module_init (int argc, char **argv)
void hssl_module_destroy (void)
int hssl_enabled (void)
herror_t hssl_client_ssl (struct hsocket_t *sock)
herror_t hssl_server_ssl (struct hsocket_t *sock)
void hssl_cleanup (struct hsocket_t *sock)
herror_t hssl_read (struct hsocket_t *sock, char *buf, size_t len, size_t *received)
herror_t hssl_write (struct hsocket_t *sock, const char *buf, size_t len, size_t *sent)

Variables

int(* _hssl_verify_cert )(X509 *cert) = _hssl_dummy_verify_cert


Define Documentation

#define CERT_SUBJECT   1
 

Definition at line 87 of file nanohttp-ssl.c.

Referenced by verify_sn().


Function Documentation

void hssl_cleanup struct hsocket_t sock  ) 
 

SSL socket cleanup.

Definition at line 547 of file nanohttp-ssl.c.

References hsocket_t::ssl.

Referenced by hsocket_close().

herror_t hssl_client_ssl struct hsocket_t sock  ) 
 

SSL client socket initialization.

Returns:
H_OK on success.

Definition at line 440 of file nanohttp-ssl.c.

References H_OK, herror_new(), HSSL_ERROR_CLIENT, HSSL_ERROR_CONNECT, HSSL_ERROR_CONTEXT, log_error1, log_error2, log_verbose1, hsocket_t::sock, and hsocket_t::ssl.

Referenced by hsocket_open().

void hssl_enable void   ) 
 

Enabled SSL in the nanoHTTP server. You have to call this function before calling httpd_run.

See also:
httpd_run

Definition at line 261 of file nanohttp-ssl.c.

int hssl_enabled void   ) 
 

Check if SSL is enabled in the nanoHTTP server.

Returns:
1 if enabled, 0 if disabled.

Definition at line 434 of file nanohttp-ssl.c.

References hssl_enabled().

Referenced by hssl_enabled().

void hssl_module_destroy void   ) 
 

Shutdown of the SSL module.

Definition at line 408 of file nanohttp-ssl.c.

herror_t hssl_module_init int  argc,
char **  argv
 

Initialization of the SSL module

Returns:
H_OK on success

Definition at line 390 of file nanohttp-ssl.c.

References log_verbose1.

Referenced by hsocket_module_init().

herror_t hssl_read struct hsocket_t sock,
char *  buf,
size_t  len,
size_t *  received
 

Read from a SSL socket.

See also:
hsocket_read

Definition at line 560 of file nanohttp-ssl.c.

References H_OK, herror_new(), HSOCKET_ERROR_RECEIVE, hsocket_select_recv(), hsocket_t::sock, and hsocket_t::ssl.

Referenced by hsocket_recv().

herror_t hssl_server_ssl struct hsocket_t sock  ) 
 

SSL server socket initialization.

Returns:
H_OK on success.

Definition at line 499 of file nanohttp-ssl.c.

References H_OK, herror_new(), HSSL_ERROR_SERVER, log_error1, log_error2, log_verbose2, log_warn1, hsocket_t::sock, and hsocket_t::ssl.

Referenced by hsocket_accept().

void hssl_set_ca_list const char *  filename  ) 
 

Sets the filename for a certification authority list.

Definition at line 250 of file nanohttp-ssl.c.

void hssl_set_certificate const char *  filename  ) 
 

Sets the SSL certificate to be used.

Definition at line 228 of file nanohttp-ssl.c.

void hssl_set_certpass const char *  password  ) 
 

Sets the password for the SSL certificate.

See also:
hssl_set_certificate

Definition at line 239 of file nanohttp-ssl.c.

void hssl_set_hssl_verify_cert int   func(X509 *cert)  ) 
 

Definition at line 220 of file nanohttp-ssl.c.

References _hssl_verify_cert.

herror_t hssl_write struct hsocket_t sock,
const char *  buf,
size_t  len,
size_t *  sent
 

Write to a SSL socket.

See also:
hsocket_write

Definition at line 586 of file nanohttp-ssl.c.

References H_OK, herror_new(), HSOCKET_ERROR_SEND, hsocket_t::sock, and hsocket_t::ssl.

Referenced by hsocket_send().

int verify_sn X509 *  cert,
int  who,
int  nid,
char *  str
 

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

Definition at line 194 of file nanohttp-ssl.c.

References CERT_SUBJECT.


Variable Documentation

int(* _hssl_verify_cert)(X509 *cert) = _hssl_dummy_verify_cert
 

Definition at line 107 of file nanohttp-ssl.c.

Referenced by hssl_set_hssl_verify_cert().


Generated on Thu Jan 25 23:36:03 2007 for csoap by  doxygen 1.4.6