summaryrefslogtreecommitdiff
path: root/lib/include
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-02-19 18:55:51 +0100
committerLinus Nordberg <linus@nordu.net>2011-02-19 18:55:51 +0100
commite0749025f259754aa031d997457a308686136909 (patch)
treea0c9c98e09c6089c780f06053e9abbaec4a24438 /lib/include
parent020e7688d91f2db00d1b573c8496119ede15e773 (diff)
Improve protocol robustness and invoke user callbacks.
All aborts are removed, as well as all asserts which aren't programming errors. When an invalid packet is received, the connection is closed, as per draft-ietf-radext-tcp-transport-08 (2.6.4). Use new rs_debug() macro rather than fprintf() for debug printouts. Coding style overhaul.
Diffstat (limited to 'lib/include')
-rw-r--r--lib/include/radsec/radsec.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/include/radsec/radsec.h b/lib/include/radsec/radsec.h
index a1f7afa..d609118 100644
--- a/lib/include/radsec/radsec.h
+++ b/lib/include/radsec/radsec.h
@@ -15,11 +15,12 @@ enum rs_err_code {
RSE_BADADDR = 7,
RSE_NOPEER = 8,
RSE_EVENT = 9, /* libevent error. */
- RSE_CONNERR = 10,
+ RSE_SOCKERR = 10,
RSE_CONFIG = 11,
RSE_BADAUTH = 12,
RSE_INTERNAL = 13,
- RSE_SSLERR = 14, /* OpenSSL error. */
+ RSE_SSLERR = 14, /* OpenSSL error. */
+ RSE_INVALID_PKT = 15,
RSE_SOME_ERROR = 21, /* Unspecified error. Shouldn't happen. */
};
@@ -62,8 +63,8 @@ struct rs_alloc_scheme {
typedef void (*rs_conn_connected_cb) (void *user_data /* FIXME: peer? */ );
typedef void (*rs_conn_disconnected_cb) (void *user_data
/* FIXME: reason? */ );
-typedef void (*rs_conn_packet_received_cb) (const struct rs_packet *
- packet, void *user_data);
+typedef void (*rs_conn_packet_received_cb) (struct rs_packet *packet,
+ void *user_data);
typedef void (*rs_conn_packet_sent_cb) (void *user_data);
struct rs_conn_callbacks {
/** Callback invoked when the connection has been established. */
@@ -92,13 +93,14 @@ int rs_conn_create(struct rs_context *ctx, struct rs_connection **conn,
void rs_conn_set_type(struct rs_connection *conn, rs_conn_type_t type);
int rs_conn_add_listener(struct rs_connection *conn, rs_conn_type_t type,
const char *hostname, int port);
-void rs_conn_destroy(struct rs_connection *conn);
+int rs_conn_disconnect (struct rs_connection *conn);
+int rs_conn_destroy(struct rs_connection *conn);
int rs_conn_set_eventbase(struct rs_connection *conn,
struct event_base *eb);
-int rs_conn_set_callbacks(struct rs_connection *conn,
+void rs_conn_set_callbacks(struct rs_connection *conn,
struct rs_conn_callbacks *cb);
-struct rs_conn_callbacks *rs_conn_get_callbacks(struct rs_connection
- *conn);
+void rs_conn_del_callbacks(struct rs_connection *conn);
+struct rs_conn_callbacks *rs_conn_get_callbacks(struct rs_connection *conn);
int rs_conn_select_server(struct rs_connection *conn, const char *name);
int rs_conn_get_current_server(struct rs_connection *conn,
const char *name, size_t buflen);