X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=udp.c;h=b0cb46476099aaefcbc26ab3d0d1d1caa7b2a931;hb=fb4af51e107fb96380efeadc252e25da079be6cc;hp=d6521cf7dc1005f8467cc1e1b5d43916c033f982;hpb=8d80bf94fc38a158f3721e6725aa48b3993e157a;p=libradsec.git diff --git a/udp.c b/udp.c index d6521cf..b0cb464 100644 --- a/udp.c +++ b/udp.c @@ -30,11 +30,13 @@ #include "util.h" #include "radsecproxy.h" +static void setprotoopts(struct commonprotoopts *opts); +static char **getlistenerargs(); void *udpserverrd(void *arg); int clientradputudp(struct server *server, unsigned char *rad); void addclientudp(struct client *client); void addserverextraudp(struct clsrvconf *conf); -void udpsetsrcres(char *source); +void udpsetsrcres(); void initextraudp(); static const struct protodefs protodefs = { @@ -47,6 +49,8 @@ static const struct protodefs protodefs = { REQUEST_RETRY_INTERVAL, /* retryintervaldefault */ 60, /* retryintervalmax */ DUPLICATE_INTERVAL, /* duplicateintervaldefault */ + setprotoopts, /* setprotoopts */ + getlistenerargs, /* getlistenerargs */ udpserverrd, /* listener */ NULL, /* connecter */ NULL, /* clientconnreader */ @@ -63,15 +67,24 @@ static struct queue *server_replyq = NULL; static struct addrinfo *srcres = NULL; static uint8_t handle; +static struct commonprotoopts *protoopts = NULL; const struct protodefs *udpinit(uint8_t h) { handle = h; return &protodefs; } -void udpsetsrcres(char *source) { +static void setprotoopts(struct commonprotoopts *opts) { + protoopts = opts; +} + +static char **getlistenerargs() { + return protoopts ? protoopts->listenargs : NULL; +} + +void udpsetsrcres() { if (!srcres) - srcres = resolve_hostport_addrinfo(handle, source); + srcres = resolve_hostport_addrinfo(handle, protoopts ? protoopts->sourcearg : NULL); } void removeudpclientfromreplyq(struct client *c) {