#include "canl_locl.h"
+static struct canl_mech *mechs[] = {
+ &canl_mech_ssl,
+};
+
static void io_destroy(glb_ctx *cc, io_handler *io);
static int init_io_content(glb_ctx *cc, io_handler *io);
static int try_connect(glb_ctx *glb_cc, io_handler *io_cc, char *addr,
if (!ctx)
return NULL;
- ssl_init();
+ ssl_initialize();
return ctx;
}
typedef enum _CANL_AUTH_MECHANISM
{
x509 = 0,
- kerberos = 1, /* and others may be added*/
+ KRB5 = 1, /* and others may be added*/
+ TLS,
+ GSSAPI,
} CANL_AUTH_MECHANISM;
typedef struct _cert_key_store {
principal_int *princ_int;
} io_handler;
+typedef struct canl_mech {
+ CANL_AUTH_MECHANISM mech;
+ void *context;
+
+ canl_err_code (*initialize)
+ (void);
+
+ canl_err_code (*client_init)
+ (glb_ctx *);
+
+ canl_err_code (*server_init)
+ (glb_ctx *);
+
+ canl_err_code (*connect)
+ (glb_ctx *, io_handler *, struct timeval *, const char *);
+
+ canl_err_code (*accept)
+ (glb_ctx *, io_handler *, struct timeval *);
+
+ canl_err_code (*close)
+ (glb_ctx *, io_handler *);
+
+ canl_err_code (*read)
+ (glb_ctx *, io_handler *, void *, size_t, struct timeval *);
+
+ canl_err_code (*write)
+ (glb_ctx *, io_handler *, void *, size_t, struct timeval *);
+} canl_mech;
+
+extern struct canl_mech canl_mech_ssl;
+
void reset_error (glb_ctx *cc, unsigned long err_code);
int set_error (glb_ctx *cc, unsigned long err_code, CANL_ERROR_ORIGIN err_orig,
const char *err_format, ...);
int ssl_write(glb_ctx *cc, io_handler *io, void *buffer, size_t size,
struct timeval *tout);
int ssl_close(glb_ctx *cc, io_handler *io);
-int ssl_init();
+int ssl_initialize();
#endif