2 @brief Header file for libradsec. */
3 /* See the file COPYING for licensing information. */
13 RSE_CONN_TYPE_MISMATCH = 5,
23 RS_CONN_TYPE_NONE = 0,
29 typedef unsigned int rs_conn_type_t;
33 struct rs_handle; /* radsec-impl.h */
34 struct rs_alloc_scheme; /* radsec-impl.h */
35 struct rs_connection; /* radsec-impl.h */
36 struct rs_conn_callbacks; /* radsec-impl.h */
37 struct rs_packet; /* radsec-impl.h */
38 struct rs_conn; /* radsec-impl.h */
39 struct rs_attr; /* radsec-impl.h */
40 struct rs_error; /* radsec-impl.h */
41 struct rs_peer; /* radsec-impl.h */
42 struct event_base; /* <event.h> */
44 /* Function prototypes. */
45 int rs_context_create(struct rs_handle **ctx, const char *dict);
46 void rs_context_destroy(struct rs_handle *ctx);
47 int rs_context_set_alloc_scheme(struct rs_handle *ctx, struct rs_alloc_scheme *scheme);
48 int rs_context_config_read(struct rs_handle *ctx, const char *config_file);
50 int rs_conn_create(struct rs_handle *ctx, struct rs_connection **conn);
51 int rs_conn_add_server(struct rs_connection *conn, struct rs_peer **server, rs_conn_type_t type, const char *hostname, int port);
52 int rs_conn_add_listener(struct rs_connection *conn, rs_conn_type_t type, const char *hostname, int port);
53 void rs_conn_destroy(struct rs_connection *conn);
54 int rs_conn_set_eventbase(struct rs_connection *conn, struct event_base *eb);
55 int rs_conn_set_callbacks(struct rs_connection *conn, struct rs_conn_callbacks *cb);
56 int rs_conn_select_server(struct rs_connection *conn, const char *name);
57 int rs_conn_get_current_server(struct rs_connection *conn, const char *name, size_t buflen);
59 void rs_server_set_timeout(struct rs_peer *server, int timeout);
60 void rs_server_set_tries(struct rs_peer *server, int tries);
61 int rs_server_set_secret(struct rs_peer *server, const char *secret);
63 int rs_packet_create_acc_request(struct rs_connection *conn, struct rs_packet **pkt, const char *user_name, const char *user_pw);
64 //int rs_packet_create_acc_accept(cstruct rs_connection *conn, struct rs_packet **pkt);
65 //int rs_packet_create_acc_reject(struct rs_connection *conn, struct rs_packet **pkt);
66 //int rs_packet_create_acc_challenge(struct rs_connection *conn, struct rs_packet **pkt);
67 void rs_packet_destroy(struct rs_packet *pkt);
68 void rs_packet_add_attr(struct rs_packet *pkt, struct rs_attr *attr);
69 //int rs_packet_add_new_attr(struct rs_packet *pkt, const char *attr_name, const char *attr_val);
71 int rs_attr_create(struct rs_connection *conn, struct rs_attr **attr, const char *type, const char *val);
72 void rs_attr_destroy(struct rs_attr *attr);
74 int rs_packet_send(struct rs_connection *conn, struct rs_packet *pkt, void *data);
75 int rs_packet_recv(struct rs_connection *conn, struct rs_packet **pkt);
77 int rs_ctx_err_push(struct rs_handle *ctx, int code, const char *fmt, ...);
78 int rs_ctx_err_push_fl(struct rs_handle *ctx, int code, const char *file, int line, const char *fmt, ...);
79 struct rs_error *rs_ctx_err_pop (struct rs_handle *ctx);
80 int rs_conn_err_push(struct rs_connection *conn, int code, const char *fmt, ...);
81 int rs_conn_err_push_fl(struct rs_connection *conn, int code, const char *file, int line, const char *fmt, ...);
82 struct rs_error *rs_conn_err_pop (struct rs_connection *conn);
83 void rs_err_free(struct rs_error *err);
84 char *rs_err_msg(struct rs_error *err, int dofree_flag);
85 int rs_err_code(struct rs_error *err, int dofree_flag);
87 /* Local Variables: */
88 /* c-file-style: "stroustrup" */