OpenVAS Libraries  6.0+beta5
Functions
hg_utils.c File Reference
#include <arpa/inet.h>
#include <ctype.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hosts_gatherer.h"

Functions

int hg_resolv (char *hostname, struct in6_addr *in6addr, int family)
 Resolve an hostname. More...
 
int hg_get_name_from_ip (struct in6_addr *ip, char *hostname, int sz)
 
int hg_valid_ip_addr (char *hostname)
 
char * hg_name_to_domain (char *hostname)
 
void hg_host_cleanup (struct hg_host *hosts)
 
void hg_hosts_cleanup (struct hg_host *hosts)
 Frees all hosts that are linked in hosts, using hg_host_cleanup. More...
 

Function Documentation

int hg_get_name_from_ip ( struct in6_addr *  ip,
char *  hostname,
int  sz 
)
Parameters
[out]hostnamePointer to buffer that will contain hostname if successful.
[in]szSize of hostname buffer hostname.
Returns
Always returns 0.
void hg_host_cleanup ( struct hg_host hosts)
void hg_hosts_cleanup ( struct hg_host hosts)

Frees all hosts that are linked in hosts, using hg_host_cleanup.

Parameters
hostshost list to free.
char* hg_name_to_domain ( char *  hostname)

input : hostname (ie : www.if.arf.com) returns: if.arf.com

If the input is arf.com returns : NULL

int hg_resolv ( char *  hostname,
struct in6_addr *  in6addr,
int  family 
)

Resolve an hostname.

Todo:
getaddrinfo: host might resolve to more than one ip. In this case (ai->ai_next != NULL). This should somehow be respected, probably needs changes to interface.
int hg_valid_ip_addr ( char *  hostname)
Returns
0 if adress info for hostname could be found, 1 otherwise.