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)
36 #define SX_SSL_MAGIC (0x01)
41 #define SX_ERR_SSL (0x010)
42 #define SX_ERR_STARTTLS_FAILURE (0x011)
44 #define SX_ERR_COMPRESS (0x020)
45 #define SX_ERR_COMPRESS_FAILURE (0x021)
48 #define SX_CONN_EXTERNAL_ID_MAX_COUNT 8
58 #include <openssl/md5.h>
59 #include <openssl/ssl.h>
60 #include <openssl/err.h>
61 #include <openssl/x509v3.h>
74 #define SX_SSL_STATE_NONE (0)
75 #define SX_SSL_STATE_WANT_READ (1)
76 #define SX_SSL_STATE_WANT_WRITE (2)
77 #define SX_SSL_STATE_ERROR (3)
80 typedef struct _sx_ssl_conn_st {
94 char *private_key_password;
109 #define sx_sasl_cb_GET_REALM (0x00)
110 #define sx_sasl_cb_GET_PASS (0x01)
111 #define sx_sasl_cb_CHECK_PASS (0x02)
112 #define sx_sasl_cb_CHECK_AUTHZID (0x03)
113 #define sx_sasl_cb_GEN_AUTHZID (0x04)
114 #define sx_sasl_cb_CHECK_MECH (0x05)
117 #define sx_sasl_ret_OK (0)
118 #define sx_sasl_ret_FAIL (1)
141 #define SX_COMPRESS_CHUNK 16384
144 typedef struct _sx_compress_conn_st {
146 z_stream wstrm, rstrm;
151 } *_sx_compress_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)
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_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
#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)