summaryrefslogtreecommitdiff
path: root/lib/conn.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-03-09 10:14:20 +0100
committerLinus Nordberg <linus@nordu.net>2011-03-09 10:14:20 +0100
commitfac0219dad91c574417f78ec674aa0dd10949e15 (patch)
treea30579377b88888eaacbc7489afe9f42a5f695a2 /lib/conn.c
parent7385db38d82b26736ba56bc7aec4c79acc420824 (diff)
Rename and move around a few helper functions.
Diffstat (limited to 'lib/conn.c')
-rw-r--r--lib/conn.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/lib/conn.c b/lib/conn.c
index 0786de2..85cd7d5 100644
--- a/lib/conn.c
+++ b/lib/conn.c
@@ -7,11 +7,11 @@
#include <string.h>
#include <assert.h>
-#include <debug.h>
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <radsec/radsec.h>
#include <radsec/radsec-impl.h>
+#include "debug.h"
#include "conn.h"
#include "event.h"
#include "packet.h"
@@ -90,45 +90,6 @@ rs_conn_set_type (struct rs_connection *conn, rs_conn_type_t type)
conn->realm->type = type;
}
-
-struct rs_error * /* FIXME: Return int as all the others? */
-_rs_resolv (struct evutil_addrinfo **addr, rs_conn_type_t type,
- const char *hostname, const char *service)
-{
- int err;
- struct evutil_addrinfo hints, *res = NULL;
-
- memset (&hints, 0, sizeof(struct evutil_addrinfo));
- hints.ai_family = AF_INET; /* IPv4 only. TODO: Set AF_UNSPEC. */
- hints.ai_flags = AI_ADDRCONFIG;
- switch (type)
- {
- case RS_CONN_TYPE_NONE:
- return _rs_err_create (RSE_INVALID_CONN, __FILE__, __LINE__, NULL, NULL);
- case RS_CONN_TYPE_TCP:
- /* Fall through. */
- case RS_CONN_TYPE_TLS:
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = IPPROTO_TCP;
- break;
- case RS_CONN_TYPE_UDP:
- /* Fall through. */
- case RS_CONN_TYPE_DTLS:
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_protocol = IPPROTO_UDP;
- break;
- default:
- return _rs_err_create (RSE_INVALID_CONN, __FILE__, __LINE__, NULL, NULL);
- }
- err = evutil_getaddrinfo (hostname, service, &hints, &res);
- if (err)
- return _rs_err_create (RSE_BADADDR, __FILE__, __LINE__,
- "%s:%s: bad host name or service name (%s)",
- hostname, service, evutil_gai_strerror(err));
- *addr = res; /* Simply use first result. */
- return NULL;
-}
-
int
rs_conn_add_listener (struct rs_connection *conn, rs_conn_type_t type,
const char *hostname, int port)