Commit 412e5c62 authored by Brian Wellington's avatar Brian Wellington
Browse files

Add lwres_udp_port, so that test programs can use a different port.

parent 9550eb2d
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
#define LWRES_SOCKADDR_LEN_T unsigned int #define LWRES_SOCKADDR_LEN_T unsigned int
#endif #endif
lwres_uint16_t lwres_udp_port = LWRES_UDP_PORT;
static void * static void *
lwres_malloc(void *, size_t); lwres_malloc(void *, size_t);
...@@ -178,7 +180,7 @@ context_connect(lwres_context_t *ctx) { ...@@ -178,7 +180,7 @@ context_connect(lwres_context_t *ctx) {
memset(&localhost, 0, sizeof(localhost)); memset(&localhost, 0, sizeof(localhost));
localhost.sin_family = AF_INET; localhost.sin_family = AF_INET;
localhost.sin_addr.s_addr = htonl(INADDR_LOOPBACK); localhost.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
localhost.sin_port = htons(LWRES_UDP_PORT); localhost.sin_port = htons(lwres_udp_port);
s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s < 0) if (s < 0)
...@@ -271,7 +273,7 @@ lwres_context_sendrecv(lwres_context_t *ctx, ...@@ -271,7 +273,7 @@ lwres_context_sendrecv(lwres_context_t *ctx,
* or if someone is sending us random stuff. * or if someone is sending us random stuff.
*/ */
if (sin.sin_addr.s_addr != htonl(INADDR_LOOPBACK) if (sin.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
|| sin.sin_port != htons(LWRES_UDP_PORT)) || sin.sin_port != htons(lwres_udp_port))
goto again; goto again;
if (recvd_len != NULL) if (recvd_len != NULL)
......
...@@ -228,6 +228,11 @@ typedef struct { ...@@ -228,6 +228,11 @@ typedef struct {
LWRES_LANG_BEGINDECLS LWRES_LANG_BEGINDECLS
/*
* This is in host byte order.
*/
extern lwres_uint16_t lwres_udp_port;
lwres_result_t lwres_result_t
lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req,
lwres_lwpacket_t *pkt, lwres_buffer_t *b); lwres_lwpacket_t *pkt, lwres_buffer_t *b);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment