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_connection *conn;
35 struct evutil_addrinfo *addr;
37 char is_connecting; /* FIXME: replace with a single state member */
38 char is_connected; /* FIXME: replace with a single state member */
40 int timeout; /* client only */
41 int tries; /* client only */
47 enum rs_conn_type type;
48 struct rs_peer *peers;
49 struct rs_realm *next;
53 struct rs_realm *realms;
54 struct rs_alloc_scheme alloc_scheme;
56 fr_randctx fr_randctx;
59 struct rs_connection {
60 struct rs_context *ctx;
61 struct event_base *evb;
62 struct bufferevent *bev;
63 enum rs_conn_type type;
64 struct rs_credentials transport_credentials;
65 struct rs_conn_callbacks callbacks;
67 struct rs_peer *peers;
68 struct rs_peer *active_peer;
71 int user_dispatch_flag : 1; /* User does the dispatching. */
75 struct rs_connection *conn;
79 struct rs_packet *original;
83 struct rs_packet *pkt;
87 /* Nonpublic functions. */
88 struct rs_error *_rs_resolv(struct evutil_addrinfo **addr,
89 rs_conn_type_t type, const char *hostname,
91 struct rs_peer *_rs_peer_create(struct rs_context *ctx,
92 struct rs_peer **rootp);
93 struct rs_error *_rs_err_create(unsigned int code, const char *file,
94 int line, const char *fmt, ...);
95 int _rs_err_conn_push_err(struct rs_connection *conn,
96 struct rs_error *err);
99 /* Convenience macros. */
100 #define rs_calloc(h, nmemb, size) \
101 (h->alloc_scheme.calloc ? h->alloc_scheme.calloc : calloc)(nmemb, size)
102 #define rs_malloc(h, size) \
103 (h->alloc_scheme.malloc ? h->alloc_scheme.malloc : malloc)(size)
104 #define rs_free(h, ptr) \
105 (h->alloc_scheme.free ? h->alloc_scheme.free : free)(ptr)
106 #define rs_realloc(h, realloc, ptr, size) \
107 (h->alloc_scheme.realloc ? h->alloc_scheme.realloc : realloc)(ptr, size)
109 /* Local Variables: */
110 /* c-file-style: "stroustrup" */