fd69c586427d5d5a2ee133bdc52fea05e938f849
[radsecproxy.git] / lib / libradsec.h
1 /** @file libradsec.h
2     @brief Header file for libradsec.  */
3
4 /* FIXME: License blurb goes here.  */
5
6 #include <stdint.h>
7 #include "../list.h"            /* FIXME: ../ is not very nice */
8
9 #define RS_HEADER_LEN 4
10
11
12 /* Data types.  */
13
14 enum rs_conn_type {
15     RS_CONN_TYPE_NONE = 0,
16     RS_CONN_TYPE_UDP,
17     RS_CONN_TYPE_TCP,
18     RS_CONN_TYPE_TLS,
19     RS_CONN_TYPE_DTLS,
20 };
21
22 enum rs_cred_type {
23     RS_CRED_NONE = 0,
24     RS_CRED_TLS_PSK_RSA,        /* RFC 4279.  */
25 };
26
27 struct rs_credentials {
28     enum rs_cred_type type;
29     char *identity;
30     char *secret;
31 };
32
33 typedef void * (*rs_calloc)(size_t nmemb, size_t size);
34 typedef void * (*rs_malloc)(size_t size);
35 typedef void (*rs_free)(void *ptr);
36 typedef void * (*rs_realloc)(void *ptr, size_t size);
37 struct rs_alloc_scheme {
38     rs_calloc calloc;
39     rs_malloc malloc;
40     rs_free free;
41     rs_realloc realloc;
42 };
43
44 struct rs_config {
45     enum rs_conn_type conn_type;
46     struct rs_credentials transport_credentials;
47     struct rs_alloc_scheme alloc_scheme;
48 };
49
50 struct rs_attribute {
51     uint8_t type;
52     uint8_t lenght;
53     uint8_t *value;
54 };
55
56 struct rs_packet {
57     uint8_t code;
58     uint8_t id;
59     uint8_t auth[16];
60     struct list *attrs;
61 };
62
63 /* Local Variables: */
64 /* c-file-style: "stroustrup" */
65 /* End: */