#include <freeradius/libradius.h>
#include <event2/util.h>
+#include <confuse.h>
+#if defined(RS_ENABLE_TLS)
+#include <openssl/ssl.h>
+#endif
/* Constants. */
#define RS_HEADER_LEN 4
};
typedef unsigned int rs_cred_type_t;
-struct rs_packet;
+#if defined (__cplusplus)
+extern "C" {
+#endif
struct rs_credentials {
enum rs_cred_type type;
char buf[1024];
};
-struct rs_peer {
+struct rs_peer { /* Config object for a connection. */
struct rs_connection *conn;
+ struct rs_realm *realm;
struct evutil_addrinfo *addr;
- int fd; /* Socket. */
- char is_connecting; /* FIXME: replace with a single state member */
- char is_connected; /* FIXME: replace with a single state member */
char *secret;
- int timeout; /* client only */
- int tries; /* client only */
struct rs_peer *next;
};
-struct rs_realm {
+struct rs_realm { /* Config object for a RADIUS realm. */
char *name;
enum rs_conn_type type;
+ int timeout;
+ int retries;
+ char *cacertfile;
+ char *cacertpath;
+ char *certfile;
+ char *certkeyfile;
struct rs_peer *peers;
struct rs_realm *next;
};
struct rs_alloc_scheme alloc_scheme;
struct rs_error *err;
fr_randctx fr_randctx;
+ cfg_t *cfg;
};
struct rs_connection {
struct rs_context *ctx;
- struct event_base *evb;
- struct bufferevent *bev;
- enum rs_conn_type type;
+ struct rs_realm *realm; /* Owned by ctx. */
+ struct event_base *evb; /* Event base. */
+ struct bufferevent *bev; /* Buffer event. */
+ struct event *tev; /* Timeout event. */
struct rs_credentials transport_credentials;
struct rs_conn_callbacks callbacks;
void *user_data;
struct rs_peer *peers;
struct rs_peer *active_peer;
struct rs_error *err;
+ char is_connecting; /* FIXME: replace with a single state member */
+ char is_connected; /* FIXME: replace with a single state member */
+ int fd; /* Socket. */
+ int tryagain;
int nextid;
int user_dispatch_flag : 1; /* User does the dispatching. */
+#if defined(RS_ENABLE_TLS)
+ SSL_CTX *tls_ctx;
+ SSL *tls_ssl;
+#endif
};
struct rs_packet {
uint8_t hdr[4];
RADIUS_PACKET *rpkt;
struct rs_packet *original;
+ char valid_flag;
+ char written_flag;
};
struct rs_attr {
struct rs_error *err);
+#if defined (__cplusplus)
+}
+#endif
+
/* Convenience macros. */
#define rs_calloc(h, nmemb, size) \
(h->alloc_scheme.calloc ? h->alloc_scheme.calloc : calloc)(nmemb, size)
(h->alloc_scheme.free ? h->alloc_scheme.free : free)(ptr)
#define rs_realloc(h, realloc, ptr, size) \
(h->alloc_scheme.realloc ? h->alloc_scheme.realloc : realloc)(ptr, size)
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#define max(a, b) ((a) > (b) ? (a) : (b))
/* Local Variables: */
/* c-file-style: "stroustrup" */