21 #ifndef INCL_SX_PLUGINS_H
22 #define INCL_SX_PLUGINS_H
25 #define SX_SSL_WRAPPER (1<<0)
26 #define SX_SSL_STARTTLS_OFFER (1<<1)
27 #define SX_SSL_STARTTLS_REQUIRE (1<<2)
29 #define SX_SASL_OFFER (1<<3)
31 #define SX_COMPRESS_WRAPPER (1<<4)
32 #define SX_COMPRESS_OFFER (1<<5)
34 #define SX_WEBSOCKET_WRAPPER (1<<6)
37 #define SX_SSL_MAGIC (0x01)
42 #define SX_ERR_SSL (0x010)
43 #define SX_ERR_STARTTLS_FAILURE (0x011)
45 #define SX_ERR_COMPRESS (0x020)
46 #define SX_ERR_COMPRESS_FAILURE (0x021)
49 #define SX_CONN_EXTERNAL_ID_MAX_COUNT 8
59 #include <openssl/md5.h>
60 #include <openssl/ssl.h>
61 #include <openssl/err.h>
62 #include <openssl/x509v3.h>
75 #define SX_SSL_STATE_NONE (0)
76 #define SX_SSL_STATE_WANT_READ (1)
77 #define SX_SSL_STATE_WANT_WRITE (2)
78 #define SX_SSL_STATE_ERROR (3)
81 typedef struct _sx_ssl_conn_st {
95 char *private_key_password;
110 #define sx_sasl_cb_GET_REALM (0x00)
111 #define sx_sasl_cb_GET_PASS (0x01)
112 #define sx_sasl_cb_CHECK_PASS (0x02)
113 #define sx_sasl_cb_CHECK_AUTHZID (0x03)
114 #define sx_sasl_cb_GEN_AUTHZID (0x04)
115 #define sx_sasl_cb_CHECK_MECH (0x05)
118 #define sx_sasl_ret_OK (0)
119 #define sx_sasl_ret_FAIL (1)
142 #define SX_COMPRESS_CHUNK 16384
145 typedef struct _sx_compress_conn_st {
147 z_stream wstrm, rstrm;
152 } *_sx_compress_conn_t;
163 #include <http_parser.h>
174 } _sx_websocket_state_t;
177 typedef struct _sx_websocket_conn_st {
179 _sx_websocket_state_t state;
188 } *_sx_websocket_conn_t;
int sx_ssl_server_addcert(sx_plugin_t p, const char *name, const char *pemfile, const char *cachain, int mode, const char *password, const char *ciphers)
args: name, pemfile, cachain, mode
JABBERD2_API int sx_ack_init(sx_env_t env, sx_plugin_t p, va_list args)
init function
holds the state for a single stream
int(* sx_sasl_callback_t)(int cb, void *arg, void **res, sx_t s, void *cbarg)
the callback function
struct sx_sasl_creds_st * sx_sasl_creds_t
JABBERD2_API int sx_sasl_init(sx_env_t env, sx_plugin_t p, va_list args)
init function
JABBERD2_API int sx_sasl_auth(sx_plugin_t p, sx_t s, const char *appname, const char *mech, const char *user, const char *pass)
trigger for client auth
int sx_websocket_init(sx_env_t env, sx_plugin_t p, va_list args)
args: none
int sx_ssl_init(sx_env_t env, sx_plugin_t p, va_list args)
args: name, pemfile, cachain, mode
int sx_compress_init(sx_env_t env, sx_plugin_t p, va_list args)
args: none
pool - base node for a pool.
#define SX_CONN_EXTERNAL_ID_MAX_COUNT
int sx_ssl_client_starttls(sx_plugin_t p, sx_t s, const char *pemfile, const char *private_key_password)