diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-07-05 15:56:13 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-07-05 15:56:13 +0000 |
| commit | 6ed79c5de77b3f6be5c297cb5432d123ff1ff177 (patch) | |
| tree | a21336754348eb80263aa72768a474c500c8a607 /src/net_unix | |
| parent | 17b80069913989598a27fc31b952407f895f5b51 (diff) | |
- 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
Diffstat (limited to 'src/net_unix')
| -rw-r--r-- | src/net_unix/Makefile | 5 | ||||
| -rw-r--r-- | src/net_unix/dns.c | 19 | ||||
| -rw-r--r-- | src/net_unix/dns.h | 8 |
3 files changed, 31 insertions, 1 deletions
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 <netdb.h> +#include <string.h> + +#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 |