summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/README6
-rw-r--r--lib/attr.c4
-rw-r--r--lib/err.c12
-rw-r--r--lib/examples/client-blocking.c18
-rw-r--r--lib/include/radsec/radsec.h12
-rw-r--r--lib/packet.c22
-rw-r--r--lib/radsec.c26
-rw-r--r--lib/request.c2
8 files changed, 51 insertions, 51 deletions
diff --git a/lib/README b/lib/README
index c4d0609..e221bf1 100644
--- a/lib/README
+++ b/lib/README
@@ -3,9 +3,9 @@ This is a non-working RADIUS library doing UDP, TCP, TLS and DTLS.
It depends on libradius from FreeRADIUS freeradius-server and
libevent2.
-The parts of it thathas been tested has been so on Linux (Ubuntu
-10.04) with libfreeradius2 (2.1.8+dfsg-1ubuntu1) and
-libevent-2.0.7-rc-dev.
+Those parts of the library which has been tested has been so on Linux
+(Ubuntu 10.04) with libfreeradius2 (2.1.8+dfsg-1ubuntu1) and
+libevent-2.0.7-rc-dev (http://monkey.org/~provos/).
The file HACKING contains more detailed info on the state of the
various parts of the library.
diff --git a/lib/attr.c b/lib/attr.c
index 579bf69..49735d9 100644
--- a/lib/attr.c
+++ b/lib/attr.c
@@ -13,14 +13,14 @@ rs_attr_create(struct rs_connection *conn, struct rs_attr **attr, const char *ty
*attr = NULL;
a = (struct rs_attr *) malloc (sizeof(struct rs_attr));
if (!a)
- return rs_conn_err_push_fl (conn, RSE_NOMEM, __FILE__, __LINE__, NULL);
+ return rs_err_conn_push_fl (conn, RSE_NOMEM, __FILE__, __LINE__, NULL);
memset (a, 0, sizeof(struct rs_attr));
vp = pairmake (type, val, T_OP_EQ);
if (!vp)
{
rs_attr_destroy (a);
- return rs_conn_err_push_fl (conn, RSE_FR, __FILE__, __LINE__,
+ return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__,
"pairmake: %s", fr_strerror());
}
diff --git a/lib/err.c b/lib/err.c
index 695de72..00de47f 100644
--- a/lib/err.c
+++ b/lib/err.c
@@ -75,7 +75,7 @@ _ctx_err_vpush_fl (struct rs_handle *ctx, int code, const char *file, int line,
}
int
-rs_ctx_err_push (struct rs_handle *ctx, int code, const char *fmt, ...)
+rs_err_ctx_push (struct rs_handle *ctx, int code, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
@@ -85,7 +85,7 @@ 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, ...)
+rs_err_ctx_push_fl (struct rs_handle *ctx, int code, const char *file, int line, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
@@ -105,7 +105,7 @@ _conn_err_vpush_fl (struct rs_connection *conn, int code, const char *file, int
}
int
-rs_conn_err_push (struct rs_connection *conn, int code, const char *fmt, ...)
+rs_err_conn_push (struct rs_connection *conn, int code, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
@@ -115,7 +115,7 @@ 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, ...)
+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);
@@ -125,7 +125,7 @@ rs_conn_err_push_fl (struct rs_connection *conn, int code, const char *file, int
}
struct rs_error *
-rs_ctx_err_pop (struct rs_handle *ctx)
+rs_err_ctx_pop (struct rs_handle *ctx)
{
struct rs_error *err;
@@ -137,7 +137,7 @@ rs_ctx_err_pop (struct rs_handle *ctx)
}
struct rs_error *
-rs_conn_err_pop (struct rs_connection *conn)
+rs_err_conn_pop (struct rs_connection *conn)
{
struct rs_error *err;
diff --git a/lib/examples/client-blocking.c b/lib/examples/client-blocking.c
index 1e6ec25..9a211c8 100644
--- a/lib/examples/client-blocking.c
+++ b/lib/examples/client-blocking.c
@@ -16,7 +16,7 @@
#define USER_PW "hemligt"
struct rs_error *
-rsx_client (const char *srvname, int srvport)
+blocking_client (const char *srvname, int srvport)
{
struct rs_handle *h;
struct rs_connection *conn;
@@ -29,30 +29,30 @@ rsx_client (const char *srvname, int srvport)
return NULL;
if (rs_conn_create (h, &conn))
- return rs_conn_err_pop (conn);
+ return rs_err_conn_pop (conn);
if (rs_conn_add_server (conn, &server, RS_CONN_TYPE_UDP, srvname, srvport))
- return rs_conn_err_pop (conn);
+ return rs_err_conn_pop (conn);
rs_server_set_timeout (server, 1);
rs_server_set_tries (server, 3);
rs_server_set_secret (server, SECRET);
if (rs_packet_create_acc_request (conn, &req, USER_NAME, USER_PW))
- return rs_conn_err_pop (conn);
+ return rs_err_conn_pop (conn);
#if !defined(USE_REQUEST_OBJECT)
if (rs_packet_send (req, NULL))
- return rs_conn_err_pop (conn);
+ return rs_err_conn_pop (conn);
req = NULL;
if (rs_conn_receive_packet (conn, &resp))
- return rs_conn_err_pop (conn);
+ return rs_err_conn_pop (conn);
#else
{
struct rs_request *request;
if (rs_request_new (conn, &request))
- return rs_conn_err_pop (conn);
+ return rs_err_conn_pop (conn);
if (rs_req_send (request, req, &resp))
- return rs_conn_err_pop (conn);
+ return rs_err_conn_pop (conn);
rs_request_destroy (request);
}
#endif /* !defined(USE_REQUEST_OBJECT) */
@@ -76,7 +76,7 @@ main (int argc, char *argv[])
host = strsep (argv + 1, ":");
port = atoi (argv[1]);
- err = rsx_client (host, port);
+ err = blocking_client (host, port);
if (err)
{
fprintf (stderr, "%s\n", rs_err_msg (err, 0));
diff --git a/lib/include/radsec/radsec.h b/lib/include/radsec/radsec.h
index 158ca2a..dea4109 100644
--- a/lib/include/radsec/radsec.h
+++ b/lib/include/radsec/radsec.h
@@ -107,12 +107,12 @@ int rs_attr_create(struct rs_connection *conn, struct rs_attr **attr, const char
void rs_attr_destroy(struct rs_attr *attr);
/* Error. */
-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);
+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 line, const char *fmt, ...);
+struct rs_error *rs_err_ctx_pop (struct rs_handle *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, const char *file, int line, const char *fmt, ...);
+struct rs_error *rs_err_conn_pop (struct rs_connection *conn);
void rs_err_free(struct rs_error *err);
char *rs_err_msg(struct rs_error *err, int dofree_flag);
int rs_err_code(struct rs_error *err, int dofree_flag);
diff --git a/lib/packet.c b/lib/packet.c
index f39e4d6..1f40766 100644
--- a/lib/packet.c
+++ b/lib/packet.c
@@ -23,14 +23,14 @@ _packet_create (struct rs_connection *conn, struct rs_packet **pkt_out)
rpkt = rad_alloc (1);
if (!rpkt)
- return rs_conn_err_push (conn, RSE_NOMEM, __func__);
+ return rs_err_conn_push (conn, RSE_NOMEM, __func__);
rpkt->id = -1;
p = (struct rs_packet *) malloc (sizeof (struct rs_packet));
if (!p)
{
rad_free (&rpkt);
- return rs_conn_err_push (conn, RSE_NOMEM, __func__);
+ return rs_err_conn_push (conn, RSE_NOMEM, __func__);
}
memset (p, 0, sizeof (struct rs_packet));
p->conn = conn;
@@ -63,7 +63,7 @@ _do_send (struct rs_packet *pkt)
err = bufferevent_write (pkt->conn->bev, pkt->rpkt->data,
pkt->rpkt->data_len);
if (err < 0)
- rs_conn_err_push_fl (pkt->conn, RSE_EVENT, __FILE__, __LINE__,
+ rs_err_conn_push_fl (pkt->conn, RSE_EVENT, __FILE__, __LINE__,
"bufferevent_write: %s", evutil_gai_strerror(err));
}
@@ -91,7 +91,7 @@ _event_cb (struct bufferevent *bev, short events, void *ctx)
/* Packet will be freed in write callback. */
}
else if (events & BEV_EVENT_ERROR)
- rs_conn_err_push_fl (pkt->conn, RSE_CONNERR, __FILE__, __LINE__, NULL);
+ rs_err_conn_push_fl (pkt->conn, RSE_CONNERR, __FILE__, __LINE__, NULL);
}
static void
@@ -129,7 +129,7 @@ _read_cb (struct bufferevent *bev, void *ctx)
pkt->rpkt->data = rs_malloc (pkt->conn->ctx, pkt->rpkt->data_len);
if (!pkt->rpkt->data)
{
- rs_conn_err_push_fl (pkt->conn, RSE_NOMEM, __FILE__, __LINE__,
+ rs_err_conn_push_fl (pkt->conn, RSE_NOMEM, __FILE__, __LINE__,
NULL);
abort (); /* FIXME: Read and discard packet. */
}
@@ -210,7 +210,7 @@ _init_evb (struct rs_connection *conn)
#endif
conn->evb = event_base_new ();
if (!conn->evb)
- return rs_conn_err_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
+ return rs_err_conn_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
"event_base_new");
}
return RSE_OK;
@@ -226,12 +226,12 @@ _init_socket (struct rs_connection *conn, struct rs_peer *p)
p->fd = socket (p->addr->ai_family, p->addr->ai_socktype,
p->addr->ai_protocol);
if (p->fd < 0)
- return rs_conn_err_push_fl (conn, RSE_SOME_ERROR, __FILE__, __LINE__,
+ return rs_err_conn_push_fl (conn, RSE_SOME_ERROR, __FILE__, __LINE__,
strerror (errno));
if (evutil_make_socket_nonblocking (p->fd) < 0)
{
evutil_closesocket (p->fd);
- return rs_conn_err_push_fl (conn, RSE_SOME_ERROR, __FILE__, __LINE__,
+ return rs_err_conn_push_fl (conn, RSE_SOME_ERROR, __FILE__, __LINE__,
strerror (errno));
}
return RSE_OK;
@@ -252,7 +252,7 @@ _init_bev (struct rs_connection *conn, struct rs_peer *peer)
{
conn->bev = bufferevent_socket_new (conn->evb, peer->fd, 0);
if (!conn->bev)
- return rs_conn_err_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
+ return rs_err_conn_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
"bufferevent_socket_new");
}
return RSE_OK;
@@ -266,7 +266,7 @@ _do_connect (struct rs_peer *p)
err = bufferevent_socket_connect (p->conn->bev, p->addr->ai_addr,
p->addr->ai_addrlen);
if (err < 0)
- rs_conn_err_push_fl (p->conn, RSE_EVENT, __FILE__, __LINE__,
+ rs_err_conn_push_fl (p->conn, RSE_EVENT, __FILE__, __LINE__,
"bufferevent_socket_connect: %s",
evutil_gai_strerror(err));
else
@@ -283,7 +283,7 @@ _conn_open(struct rs_connection *conn, struct rs_packet *pkt)
p = _pick_peer (conn);
if (!p)
- return rs_conn_err_push_fl (conn, RSE_NOPEER, __FILE__, __LINE__, NULL);
+ return rs_err_conn_push_fl (conn, RSE_NOPEER, __FILE__, __LINE__, NULL);
if (_init_socket (conn, p))
return -1;
diff --git a/lib/radsec.c b/lib/radsec.c
index 3a2f5f7..35e159d 100644
--- a/lib/radsec.c
+++ b/lib/radsec.c
@@ -69,13 +69,13 @@ void rs_context_destroy(struct rs_handle *ctx)
int rs_context_set_alloc_scheme(struct rs_handle *ctx, struct rs_alloc_scheme *scheme)
{
- return rs_ctx_err_push_fl (ctx, RSE_NOSYS, __FILE__, __LINE__,
+ return rs_err_ctx_push_fl (ctx, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
int rs_context_config_read(struct rs_handle *ctx, const char *config_file)
{
- return rs_ctx_err_push_fl (ctx, RSE_NOSYS, __FILE__, __LINE__,
+ return rs_err_ctx_push_fl (ctx, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
@@ -91,7 +91,7 @@ int rs_conn_create(struct rs_handle *ctx, struct rs_connection **conn)
}
if (conn)
*conn = c;
- return c ? RSE_OK : rs_ctx_err_push (ctx, RSE_NOMEM, NULL);
+ return c ? RSE_OK : rs_err_ctx_push (ctx, RSE_NOMEM, NULL);
}
struct addrinfo *
@@ -108,7 +108,7 @@ _resolv (struct rs_connection *conn, const char *hostname, int port)
switch (conn->type)
{
case RS_CONN_TYPE_NONE:
- rs_conn_err_push_fl (conn, RSE_INVALID_CONN, __FILE__, __LINE__, NULL);
+ rs_err_conn_push_fl (conn, RSE_INVALID_CONN, __FILE__, __LINE__, NULL);
return NULL;
case RS_CONN_TYPE_TCP:
/* Fall through. */
@@ -125,7 +125,7 @@ _resolv (struct rs_connection *conn, const char *hostname, int port)
}
err = evutil_getaddrinfo (hostname, portstr, &hints, &res);
if (err)
- rs_conn_err_push_fl (conn, RSE_BADADDR, __FILE__, __LINE__,
+ rs_err_conn_push_fl (conn, RSE_BADADDR, __FILE__, __LINE__,
"%s:%d: bad host name or port (%s)",
hostname, port, evutil_gai_strerror(err));
return res; /* Simply use first result. */
@@ -157,7 +157,7 @@ _peer_new (struct rs_connection *conn, const char *hostname, int port)
else
{
evutil_freeaddrinfo (addr);
- rs_conn_err_push_fl (conn, RSE_NOMEM, __FILE__, __LINE__, NULL);
+ rs_err_conn_push_fl (conn, RSE_NOMEM, __FILE__, __LINE__, NULL);
}
return p;
}
@@ -171,7 +171,7 @@ rs_conn_add_server(struct rs_connection *conn, struct rs_peer **server,
if (conn->type == RS_CONN_TYPE_NONE)
conn->type = type;
else if (conn->type != type)
- return rs_conn_err_push (conn, RSE_CONN_TYPE_MISMATCH, NULL);
+ return rs_err_conn_push (conn, RSE_CONN_TYPE_MISMATCH, NULL);
srv = _peer_new (conn, hostname, port);
if (srv)
@@ -198,14 +198,14 @@ int rs_server_set_secret(struct rs_peer *server, const char *secret)
free (server->secret);
server->secret = (char *) malloc (strlen(secret) + 1);
if (!server->secret)
- return rs_conn_err_push (server->conn, RSE_NOMEM, NULL);
+ return rs_err_conn_push (server->conn, RSE_NOMEM, NULL);
strcpy (server->secret, secret);
return RSE_OK;
}
int rs_conn_add_listener(struct rs_connection *conn, rs_conn_type_t type, const char *hostname, int port)
{
- return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
+ return rs_err_conn_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
@@ -230,25 +230,25 @@ rs_conn_destroy(struct rs_connection *conn)
int rs_conn_set_eventbase(struct rs_connection *conn, struct event_base *eb)
{
- return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
+ 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)
{
- return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
+ return rs_err_conn_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
int rs_conn_set_server(struct rs_connection *conn, const char *name)
{
- return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
+ 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)
{
- return rs_conn_err_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
+ return rs_err_conn_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
}
diff --git a/lib/request.c b/lib/request.c
index da38015..3d4b096 100644
--- a/lib/request.c
+++ b/lib/request.c
@@ -12,7 +12,7 @@ rs_req_create (struct rs_connection *conn, struct rs_request **req_out)
{
struct rs_request *req = rs_malloc (conn->ctx, sizeof(*req));
if (!req)
- return rs_conn_err_push_fl (conn, RSE_NOMEM, __FILE__, __LINE__, NULL);
+ return rs_err_conn_push_fl (conn, RSE_NOMEM, __FILE__, __LINE__, NULL);
memset (req, 0, sizeof(*req));
req->conn = conn;
*req_out = req;