From 7ef1fda097c5c96e201d50db2892d1c2354eb6d4 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 28 Sep 2010 23:20:17 +0200 Subject: WIP --- lib/err.c | 10 ++++++++++ lib/libradsec.h | 9 +++++---- lib/packet.c | 6 ++++-- lib/radsec.c | 26 +++++++++++++++++--------- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/lib/err.c b/lib/err.c index 9fcad0b..8ee76a6 100644 --- a/lib/err.c +++ b/lib/err.c @@ -72,6 +72,16 @@ rs_ctx_err_push (struct rs_handle *ctx, int code, const char *fmt, ...) return code; } +int +rs_ctx_err_push_fl (struct rs_handle *ctx, int code, const char *file, int line, const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + _ctx_err_vpush_fl (ctx, code, file, line, fmt, args); + va_end (args); + return code; +} + static int _conn_err_vpush_fl (struct rs_connection *conn, int code, const char *file, int line, const char *fmt, va_list args) { diff --git a/lib/libradsec.h b/lib/libradsec.h index f956f45..a2560c7 100644 --- a/lib/libradsec.h +++ b/lib/libradsec.h @@ -50,7 +50,7 @@ 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, struct rs_conn_callbacks *cb); int rs_conn_select_server(struct rs_connection *conn, const char *name); -int rs_conn_get_current_server(const struct rs_connection *conn, const char *name, size_t buflen); +int rs_conn_get_current_server(struct rs_connection *conn, const char *name, size_t buflen); void rs_server_set_timeout(struct rs_peer *server, int timeout); void rs_server_set_tries(struct rs_peer *server, int tries); @@ -71,10 +71,11 @@ int rs_packet_send(struct rs_connection *conn, const struct rs_packet *pkt, void int rs_packet_recv(struct rs_connection *conn, struct rs_packet **pkt); -int rs_ctx_err_push (struct rs_handle *ctx, int code, const char *fmt, ...); -int rs_conn_err_push (struct rs_connection *conn, int code, const char *fmt, ...); -int rs_conn_err_push_fl(struct rs_connection *conn, int code, const char *file, int line, const char *fmt, ...); +int rs_ctx_err_push(struct rs_handle *ctx, int code, const char *fmt, ...); +int rs_ctx_err_push_fl(struct rs_handle *ctx, int code, const char *file, int line, const char *fmt, ...); struct rs_error *rs_ctx_err_pop (struct rs_handle *ctx); +int rs_conn_err_push(struct rs_connection *conn, int code, const char *fmt, ...); +int rs_conn_err_push_fl(struct rs_connection *conn, int code, const char *file, int line, const char *fmt, ...); struct rs_error *rs_conn_err_pop (struct rs_connection *conn); void rs_err_free (struct rs_error *err); char *rs_err_msg (struct rs_error *err, int dofree_flag); diff --git a/lib/packet.c b/lib/packet.c index 68adf2b..74ca391 100644 --- a/lib/packet.c +++ b/lib/packet.c @@ -76,12 +76,14 @@ rs_packet_send (struct rs_connection *conn, const struct rs_packet *pkt, rs_dump_packet (pkt); #endif - return RSE_NOSYS; + return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } int rs_packet_receive(struct rs_connection *conn, struct rs_packet **pkt) { - return RSE_NOSYS; + return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } void diff --git a/lib/radsec.c b/lib/radsec.c index e0c881a..309c305 100644 --- a/lib/radsec.c +++ b/lib/radsec.c @@ -65,12 +65,14 @@ void rs_context_destroy(struct rs_handle *ctx) int rs_context_set_alloc_scheme(struct rs_handle *ctx, struct rs_alloc_scheme *scheme) { - return RSE_NOSYS; + return rs_ctx_err_push_fl (ctx, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } int rs_context_config_read(struct rs_handle *ctx, const char *config_file) { - return RSE_NOSYS; + return rs_ctx_err_push_fl (ctx, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } int rs_conn_create(struct rs_handle *ctx, struct rs_connection **conn) @@ -141,32 +143,38 @@ int rs_server_set_secret(struct rs_peer *server, const char *secret) int rs_conn_add_listener(struct rs_connection *conn, rs_conn_type_t type, const char *host, int port) { - return RSE_NOSYS; + return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } int rs_conn_destroy(struct rs_connection *conn) { - return RSE_NOSYS; + return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } int rs_conn_set_eventbase(struct rs_connection *conn, struct event_base *eb) { - return RSE_NOSYS; + return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } int rs_conn_set_callbacks(struct rs_connection *conn, struct rs_conn_callbacks *cb) { - return RSE_NOSYS; + return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } int rs_conn_set_server(struct rs_connection *conn, const char *name) { - return RSE_NOSYS; + return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } -int rs_conn_get_server(const struct rs_connection *conn, const char *name, size_t buflen) +int rs_conn_get_current_server(struct rs_connection *conn, const char *name, size_t buflen) { - return RSE_NOSYS; + return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__, + "%s: NYI", __func__); } int rs_conn_open(struct rs_connection *conn) -- cgit v1.1