1 /** @file libradsec-impl.h
2 @brief Libraray internal header file for libradsec. */
4 /* See the file COPYING for licensing information. */
6 #include <freeradius/libradius.h>
7 #include <event2/util.h>
10 #define RS_HEADER_LEN 4
15 RS_CRED_TLS_PSK_RSA, /* RFC 4279. */
17 typedef unsigned int rs_cred_type_t;
21 struct rs_credentials {
22 enum rs_cred_type type;
34 struct rs_alloc_scheme alloc_scheme;
36 fr_randctx fr_randctx;
37 /* TODO: dictionary? */
41 struct rs_connection *conn;
42 struct evutil_addrinfo *addr;
44 char is_connecting; /* FIXME: replace with a single state member */
45 char is_connected; /* FIXME: replace */
47 int timeout; /* client only */
48 int tries; /* client only */
52 struct rs_connection {
53 struct rs_handle *ctx;
54 struct event_base *evb;
55 struct bufferevent *bev;
56 enum rs_conn_type type;
57 struct rs_credentials transport_credentials;
58 struct rs_conn_callbacks callbacks;
59 struct rs_peer *peers;
60 struct rs_peer *active_peer;
65 struct rs_connection *conn;
72 struct rs_packet *pkt;
76 /* Convenience macros. */
77 #define rs_calloc(h, nmemb, size) \
78 (h->alloc_scheme.calloc ? h->alloc_scheme.calloc : calloc)(nmemb, size)
79 #define rs_malloc(h, size) \
80 (h->alloc_scheme.malloc ? h->alloc_scheme.malloc : malloc)(size)
81 #define rs_free(h, ptr) \
82 (h->alloc_scheme.free ? h->alloc_scheme.free : free)(ptr)
83 #define rs_realloc(h, realloc, ptr, size) \
84 (h->alloc_scheme.realloc ? h->alloc_scheme.realloc : realloc)(ptr, size)
86 /* Local Variables: */
87 /* c-file-style: "stroustrup" */