summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2010-10-05 22:06:01 +0200
committerLinus Nordberg <linus@nordu.net>2010-10-05 22:06:01 +0200
commitbf4047ef3d533e819240c2a00ff9bd65e0beba2e (patch)
treedbc496b3efb6ea84a334567ad02f2abf99dd18cf /lib
parentcf66600857caeee4cfa3eed208dc3f5cc774945c (diff)
Rename struct rs_handle --> rs_context.
Diffstat (limited to 'lib')
-rw-r--r--lib/conf.c4
-rw-r--r--lib/err.c16
-rw-r--r--lib/examples/client-blocking.c2
-rw-r--r--lib/include/radsec/radsec-impl.h23
-rw-r--r--lib/include/radsec/radsec.h22
-rw-r--r--lib/radsec.c28
6 files changed, 55 insertions, 40 deletions
diff --git a/lib/conf.c b/lib/conf.c
index bae6735..31ae6da 100644
--- a/lib/conf.c
+++ b/lib/conf.c
@@ -18,7 +18,7 @@
#endif
int
-rs_context_read_config(struct rs_handle *ctx, const char *config_file)
+rs_context_read_config(struct rs_context *ctx, const char *config_file)
{
#warning "Missing some error handling in rs_context_config_read()"
cfg_opt_t server_opts[] =
@@ -94,7 +94,7 @@ rs_context_read_config(struct rs_handle *ctx, const char *config_file)
}
struct rs_realm
-*rs_conf_find_realm(struct rs_handle *ctx, const char *name)
+*rs_conf_find_realm(struct rs_context *ctx, const char *name)
{
struct rs_realm *r;
diff --git a/lib/err.c b/lib/err.c
index 71a8380..116c995 100644
--- a/lib/err.c
+++ b/lib/err.c
@@ -79,7 +79,8 @@ _rs_err_create (unsigned int code, const char *file, int line, const char *fmt,
}
static int
-_ctx_err_vpush_fl (struct rs_handle *ctx, int code, const char *file, int line, const char *fmt, va_list args)
+_ctx_err_vpush_fl (struct rs_context *ctx, int code, const char *file,
+ int line, const char *fmt, va_list args)
{
struct rs_error *err = _err_vcreate (code, file, line, fmt, args);
@@ -89,7 +90,7 @@ _ctx_err_vpush_fl (struct rs_handle *ctx, int code, const char *file, int line,
}
int
-rs_err_ctx_push (struct rs_handle *ctx, int code, const char *fmt, ...)
+rs_err_ctx_push (struct rs_context *ctx, int code, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
@@ -99,7 +100,8 @@ rs_err_ctx_push (struct rs_handle *ctx, int code, const char *fmt, ...)
}
int
-rs_err_ctx_push_fl (struct rs_handle *ctx, int code, const char *file, int line, const char *fmt, ...)
+rs_err_ctx_push_fl (struct rs_context *ctx, int code, const char *file,
+ int line, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
@@ -116,7 +118,8 @@ _rs_err_conn_push_err (struct rs_connection *conn, struct rs_error *err)
}
static int
-_conn_err_vpush_fl (struct rs_connection *conn, int code, const char *file, int line, const char *fmt, va_list args)
+_conn_err_vpush_fl (struct rs_connection *conn, int code, const char *file,
+ int line, const char *fmt, va_list args)
{
struct rs_error *err = _err_vcreate (code, file, line, fmt, args);
@@ -136,7 +139,8 @@ rs_err_conn_push (struct rs_connection *conn, int code, const char *fmt, ...)
}
int
-rs_err_conn_push_fl (struct rs_connection *conn, int code, const char *file, int line, const char *fmt, ...)
+rs_err_conn_push_fl (struct rs_connection *conn, int code, const char *file,
+ int line, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
@@ -146,7 +150,7 @@ rs_err_conn_push_fl (struct rs_connection *conn, int code, const char *file, int
}
struct rs_error *
-rs_err_ctx_pop (struct rs_handle *ctx)
+rs_err_ctx_pop (struct rs_context *ctx)
{
struct rs_error *err;
diff --git a/lib/examples/client-blocking.c b/lib/examples/client-blocking.c
index 8cd9968..bb9e653 100644
--- a/lib/examples/client-blocking.c
+++ b/lib/examples/client-blocking.c
@@ -18,7 +18,7 @@
struct rs_error *
blocking_client (const char *av1, const char *av2)
{
- struct rs_handle *h;
+ struct rs_context *h;
struct rs_connection *conn;
struct rs_packet *req, *resp;
RADIUS_PACKET *fr_pkt;
diff --git a/lib/include/radsec/radsec-impl.h b/lib/include/radsec/radsec-impl.h
index 9421fd6..b46bc47 100644
--- a/lib/include/radsec/radsec-impl.h
+++ b/lib/include/radsec/radsec-impl.h
@@ -33,9 +33,9 @@ struct rs_error {
struct rs_peer {
struct rs_connection *conn;
struct evutil_addrinfo *addr;
- int fd; /* Socket. */
- char is_connecting; /* FIXME: replace with a single state member */
- char is_connected; /* FIXME: replace with a single state member */
+ int fd; /* Socket. */
+ char is_connecting; /* FIXME: replace with a single state member */
+ char is_connected; /* FIXME: replace with a single state member */
char *secret;
int timeout; /* client only */
int tries; /* client only */
@@ -49,7 +49,7 @@ struct rs_realm {
struct rs_realm *next;
};
-struct rs_handle {
+struct rs_context {
struct rs_realm *realms;
struct rs_alloc_scheme alloc_scheme;
struct rs_error *err;
@@ -57,7 +57,7 @@ struct rs_handle {
};
struct rs_connection {
- struct rs_handle *ctx;
+ struct rs_context *ctx;
struct event_base *evb;
struct bufferevent *bev;
enum rs_conn_type type;
@@ -81,10 +81,15 @@ struct rs_attr {
};
/* Nonpublic functions. */
-struct rs_error *_rs_resolv (struct evutil_addrinfo **addr, rs_conn_type_t type, const char *hostname, const char *service);
-struct rs_peer *_rs_peer_create (struct rs_handle *ctx, struct rs_peer **rootp);
-struct rs_error *_rs_err_create (unsigned int code, const char *file, int line, const char *fmt, ...);
-int _rs_err_conn_push_err (struct rs_connection *conn, struct rs_error *err);
+struct rs_error *_rs_resolv(struct evutil_addrinfo **addr,
+ rs_conn_type_t type, const char *hostname,
+ const char *service);
+struct rs_peer *_rs_peer_create(struct rs_context *ctx,
+ struct rs_peer **rootp);
+struct rs_error *_rs_err_create(unsigned int code, const char *file,
+ int line, const char *fmt, ...);
+int _rs_err_conn_push_err(struct rs_connection *conn,
+ struct rs_error *err);
/* Convenience macros. */
diff --git a/lib/include/radsec/radsec.h b/lib/include/radsec/radsec.h
index 9610d0d..389e411 100644
--- a/lib/include/radsec/radsec.h
+++ b/lib/include/radsec/radsec.h
@@ -31,7 +31,7 @@ typedef unsigned int rs_conn_type_t;
/* Data types. */
-struct rs_handle; /* radsec-impl.h */
+struct rs_context; /* radsec-impl.h */
struct rs_connection; /* radsec-impl.h */
struct rs_packet; /* radsec-impl.h */
struct rs_conn; /* radsec-impl.h */
@@ -72,14 +72,15 @@ struct rs_conn_callbacks {
/* Function prototypes. */
/* Context. */
-int rs_context_create(struct rs_handle **ctx, const char *dict);
-void rs_context_destroy(struct rs_handle *ctx);
-int rs_context_set_alloc_scheme(struct rs_handle *ctx,
+int rs_context_create(struct rs_context **ctx, const char *dict);
+void rs_context_destroy(struct rs_context *ctx);
+int rs_context_set_alloc_scheme(struct rs_context *ctx,
struct rs_alloc_scheme *scheme);
-int rs_context_read_config(struct rs_handle *ctx, const char *config_file);
+int rs_context_read_config(struct rs_context *ctx,
+ const char *config_file);
/* Connection. */
-int rs_conn_create(struct rs_handle *ctx, struct rs_connection **conn,
+int rs_conn_create(struct rs_context *ctx, struct rs_connection **conn,
const char *config);
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,
@@ -121,14 +122,15 @@ int rs_attr_create(struct rs_connection *conn, struct rs_attr **attr,
void rs_attr_destroy(struct rs_attr *attr);
/* Config. */
-struct rs_realm *rs_conf_find_realm(struct rs_handle *ctx,
+struct rs_realm *rs_conf_find_realm(struct rs_context *ctx,
const char *name);
/* Error. */
-int rs_err_ctx_push(struct rs_handle *ctx, int code, const char *fmt, ...);
-int rs_err_ctx_push_fl(struct rs_handle *ctx, int code, const char *file,
+int rs_err_ctx_push(struct rs_context *ctx, int code, const char *fmt,
+ ...);
+int rs_err_ctx_push_fl(struct rs_context *ctx, int code, const char *file,
int line, const char *fmt, ...);
-struct rs_error *rs_err_ctx_pop(struct rs_handle *ctx);
+struct rs_error *rs_err_ctx_pop(struct rs_context *ctx);
int rs_err_conn_push(struct rs_connection *conn, int code, const char *fmt,
...);
int rs_err_conn_push_fl(struct rs_connection *conn, int code,
diff --git a/lib/radsec.c b/lib/radsec.c
index 96182a6..4e3c6ba 100644
--- a/lib/radsec.c
+++ b/lib/radsec.c
@@ -13,13 +13,13 @@
#include <radsec/radsec-impl.h>
int
-rs_context_create(struct rs_handle **ctx, const char *dict)
+rs_context_create(struct rs_context **ctx, const char *dict)
{
- struct rs_handle *h;
+ struct rs_context *h;
if (ctx)
*ctx = NULL;
- h = (struct rs_handle *) malloc (sizeof(struct rs_handle));
+ h = (struct rs_context *) malloc (sizeof(struct rs_context));
if (h)
{
char *buf1 = NULL, *buf2 = NULL;
@@ -52,7 +52,7 @@ rs_context_create(struct rs_handle **ctx, const char *dict)
fr_debug_flag = 1;
#endif
- memset (h, 0, sizeof(struct rs_handle));
+ memset (h, 0, sizeof(struct rs_context));
fr_randinit (&h->fr_randctx, 0);
fr_rand_seed (NULL, 0);
@@ -62,19 +62,20 @@ rs_context_create(struct rs_handle **ctx, const char *dict)
return h ? RSE_OK : RSE_NOMEM;
}
-void rs_context_destroy(struct rs_handle *ctx)
+void rs_context_destroy(struct rs_context *ctx)
{
free (ctx);
}
-int rs_context_set_alloc_scheme(struct rs_handle *ctx, struct rs_alloc_scheme *scheme)
+int rs_context_set_alloc_scheme(struct rs_context *ctx,
+ struct rs_alloc_scheme *scheme)
{
return rs_err_ctx_push_fl (ctx, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
int
-rs_conn_create(struct rs_handle *ctx, struct rs_connection **conn,
+rs_conn_create(struct rs_context *ctx, struct rs_connection **conn,
const char *config)
{
struct rs_connection *c;
@@ -147,7 +148,7 @@ _rs_resolv (struct evutil_addrinfo **addr, rs_conn_type_t type,
}
struct rs_peer *
-_rs_peer_create (struct rs_handle *ctx, struct rs_peer **rootp)
+_rs_peer_create (struct rs_context *ctx, struct rs_peer **rootp)
{
struct rs_peer *p;
@@ -245,21 +246,24 @@ rs_conn_destroy (struct rs_connection *conn)
event_base_free (conn->evb);
}
-int rs_conn_set_eventbase(struct rs_connection *conn, struct event_base *eb)
+int
+rs_conn_set_eventbase(struct rs_connection *conn, struct event_base *eb)
{
return rs_err_conn_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
-int rs_conn_set_callbacks(struct rs_connection *conn, struct rs_conn_callbacks *cb)
+int
+rs_conn_set_callbacks(struct rs_connection *conn, struct rs_conn_callbacks *cb)
{
return rs_err_conn_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
-int rs_conn_get_current_server(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 rs_err_conn_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
-