From 6ed79c5de77b3f6be5c297cb5432d123ff1ff177 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sat, 5 Jul 2008 15:56:13 +0000 Subject: - miny sa nezobrazuju na radare - tux moze chodit strielat a zmenit zbran sucastne - master server sa pouziga ten na "ms.tuxanci.org" - AI sa nastavuje v GUI ako v TFG git-svn-id: http://opensvn.csie.org/tuxanci_ng@93 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/net_unix/Makefile | 5 ++++- src/net_unix/dns.c | 19 +++++++++++++++++++ src/net_unix/dns.h | 8 ++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/net_unix/dns.c create mode 100644 src/net_unix/dns.h (limited to 'src/net_unix') diff --git a/src/net_unix/Makefile b/src/net_unix/Makefile index 648ca88..d13af8e 100644 --- a/src/net_unix/Makefile +++ b/src/net_unix/Makefile @@ -1,6 +1,9 @@ -all: udp.o +all: udp.o dns.o + +dns.o: dns.c dns.h + $(CC) $(CFLAGS) -o dns.o -c dns.c udp.o: udp.c udp.h $(CC) $(CFLAGS) -o udp.o -c udp.c diff --git a/src/net_unix/dns.c b/src/net_unix/dns.c new file mode 100644 index 0000000..f4036a2 --- /dev/null +++ b/src/net_unix/dns.c @@ -0,0 +1,19 @@ + +#include +#include + +#include "base/main.h" + +char* getIPFormDNS(char *domain) +{ + struct hostent *host; + + host = gethostbyname(domain); + + if( host == NULL || host->h_addr_list[0] == NULL ) + { + return NULL; + } + + return strdup( inet_ntoa( * ( (struct in_addr *) host->h_addr_list[0] ) ) ); +} diff --git a/src/net_unix/dns.h b/src/net_unix/dns.h new file mode 100644 index 0000000..ae92c35 --- /dev/null +++ b/src/net_unix/dns.h @@ -0,0 +1,8 @@ + +#ifndef DNS_H + +#define DNS_H + +extern char* getIPFormDNS(char *domain); + +#endif -- cgit v1.2.3