summaryrefslogtreecommitdiff
path: root/dtls.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-12-19 13:35:39 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-12-19 13:35:39 +0000
commitfb4af51e107fb96380efeadc252e25da079be6cc (patch)
treed5da03248565fa66eab981fc4d595c7fb2f81920 /dtls.c
parent8d80bf94fc38a158f3721e6725aa48b3993e157a (diff)
cleaning up code
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@443 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'dtls.c')
-rw-r--r--dtls.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/dtls.c b/dtls.c
index 3303c4d..6ada359 100644
--- a/dtls.c
+++ b/dtls.c
@@ -32,12 +32,14 @@
#include "util.h"
#include "radsecproxy.h"
+static void setprotoopts(struct commonprotoopts *opts);
+static char **getlistenerargs();
void *udpdtlsserverrd(void *arg);
int dtlsconnect(struct server *server, struct timeval *when, int timeout, char *text);
void *dtlsclientrd(void *arg);
int clientradputdtls(struct server *server, unsigned char *rad);
void addserverextradtls(struct clsrvconf *conf);
-void dtlssetsrcres(char *source);
+void dtlssetsrcres();
void initextradtls();
static const struct protodefs protodefs = {
@@ -50,6 +52,8 @@ static const struct protodefs protodefs = {
REQUEST_RETRY_INTERVAL, /* retryintervaldefault */
60, /* retryintervalmax */
DUPLICATE_INTERVAL, /* duplicateintervaldefault */
+ setprotoopts, /* setprotoopts */
+ getlistenerargs, /* getlistenerargs */
udpdtlsserverrd, /* listener */
dtlsconnect, /* connecter */
dtlsclientrd, /* clientconnreader */
@@ -64,12 +68,21 @@ static int client4_sock = -1;
static int client6_sock = -1;
static struct addrinfo *srcres = NULL;
static uint8_t handle;
+static struct commonprotoopts *protoopts = NULL;
const struct protodefs *dtlsinit(uint8_t h) {
handle = h;
return &protodefs;
}
+static void setprotoopts(struct commonprotoopts *opts) {
+ protoopts = opts;
+}
+
+static char **getlistenerargs() {
+ return protoopts ? protoopts->listenargs : NULL;
+}
+
struct sessioncacheentry {
pthread_mutex_t mutex;
struct queue *rbios;
@@ -82,9 +95,10 @@ struct dtlsservernewparams {
struct sockaddr_storage addr;
};
-void dtlssetsrcres(char *source) {
+void dtlssetsrcres() {
if (!srcres)
- srcres = resolve_hostport_addrinfo(handle, source);
+ srcres = resolve_hostport_addrinfo(handle, protoopts ? protoopts->sourcearg : NULL);
+
}
int udp2bio(int s, struct queue *q, int cnt) {