mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-27 03:55:09 +00:00
Added set peer
This commit is contained in:
parent
5ff6d2228c
commit
66bc89019a
15
dns.c
15
dns.c
@ -21,6 +21,7 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <netdb.h>
|
||||
#include <time.h>
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
@ -31,6 +32,8 @@
|
||||
|
||||
#include "dns.h"
|
||||
|
||||
struct sockaddr_in peer;
|
||||
|
||||
int
|
||||
open_dns()
|
||||
{
|
||||
@ -68,3 +71,15 @@ close_dns(int fd)
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
void
|
||||
dns_set_peer(const char *host)
|
||||
{
|
||||
struct hostent *h;
|
||||
|
||||
h = gethostbyname(host);
|
||||
bzero(&peer, sizeof(peer));
|
||||
peer.sin_family = AF_INET;
|
||||
peer.sin_port = htons(53);
|
||||
peer.sin_addr = *((struct in_addr *) h->h_addr);
|
||||
}
|
||||
|
4
dns.h
4
dns.h
@ -19,7 +19,11 @@
|
||||
#ifndef _DNS_H_
|
||||
#define _DNS_H_
|
||||
|
||||
extern struct sockaddr_in peer;
|
||||
|
||||
int open_dns();
|
||||
void close_dns(int);
|
||||
|
||||
void dns_set_peer(const char *);
|
||||
|
||||
#endif /* _DNS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user