[moodns-cvs] CVS: moodns/src mooquery.c,1.6,1.7 socket.c,1.8,1.9 socket.h,1.6,1.7
Status: Alpha
Brought to you by:
mawolf
From: Omar K. <spy...@us...> - 2002-02-14 06:41:26
|
Update of /cvsroot/moodns/moodns/src In directory usw-pr-cvs1:/tmp/cvs-serv15023 Modified Files: mooquery.c socket.c socket.h Log Message: Made socket_sender non-brain-taxing. Index: mooquery.c =================================================================== RCS file: /cvsroot/moodns/moodns/src/mooquery.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mooquery.c 14 Feb 2002 03:46:16 -0000 1.6 --- mooquery.c 14 Feb 2002 06:41:23 -0000 1.7 *************** *** 68,72 **** char *server = "127.0.0.1"; - u32 server_real; char *name = NULL; --- 68,71 ---- *************** *** 77,81 **** char *port = "53"; - u32 port_real; char *timeout = "60"; --- 76,79 ---- *************** *** 182,186 **** assert(b->len == p->size_in_bytes); ! s = socket_sender(port_real, SOCKET_UDP, server_real); len1 = socket_send(s, b); --- 180,184 ---- assert(b->len == p->size_in_bytes); ! s = socket_sender(server, atol(port), SOCKET_UDP); len1 = socket_send(s, b); *************** *** 198,212 **** to_real() { - server_real = inet_addr(server); - if (server_real == INADDR_NONE) { - puts("bogus server name"); - exit(3); - } - name_real = name; type_real = recordtype(type); - - port_real = (u16) htons((unsigned short) strtoul(port, NULL, 10)); timeout_real = strtoul(timeout, NULL, 10); --- 196,202 ---- Index: socket.c =================================================================== RCS file: /cvsroot/moodns/moodns/src/socket.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** socket.c 14 Feb 2002 06:33:27 -0000 1.8 --- socket.c 14 Feb 2002 06:41:23 -0000 1.9 *************** *** 107,113 **** socket_t * ! socket_sender(int port, int transport, unsigned int remote) { socket_t *s = (socket_t *) xcalloc(1, sizeof(socket_t)); if (!s) --- 107,115 ---- socket_t * ! socket_sender(char *host, int port, int transport) { socket_t *s = (socket_t *) xcalloc(1, sizeof(socket_t)); + u32 remote = (u32) inet_addr(host); + u16 p = (u16) htons((unsigned short) port); if (!s) *************** *** 131,135 **** s->remote.sin_family = AF_INET; ! s->remote.sin_port = port; s->remote.sin_addr.s_addr = remote; --- 133,137 ---- s->remote.sin_family = AF_INET; ! s->remote.sin_port = p; s->remote.sin_addr.s_addr = remote; Index: socket.h =================================================================== RCS file: /cvsroot/moodns/moodns/src/socket.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** socket.h 14 Feb 2002 06:33:27 -0000 1.6 --- socket.h 14 Feb 2002 06:41:23 -0000 1.7 *************** *** 41,45 **** socket_t *socket_listener(int port, int transport); ! socket_t *socket_sender(int port, int transport, unsigned int remote); socket_t *socket_accept(socket_t *s); --- 41,45 ---- socket_t *socket_listener(int port, int transport); ! socket_t *socket_sender(char *host, int port, int transport); socket_t *socket_accept(socket_t *s); |