ze-filter  (ze-filter-0.8.0-develop-180218)
Tools : Network functions

Classes

struct  client_T
 
struct  DNS_HOST_T
 
struct  DNS_HOSTARR_T
 
struct  DNS_QUERY_T
 
struct  MX_RECORD_T
 
struct  SRV_RECORDT_T
 
struct  resource_record
 
struct  DNS_REPLY_T
 
struct  ipv6_T
 

Macros

#define CLIENT_SPEC_LEN   512
 
#define CLIENT_INITIALIZER
 
#define MAX_HOST   128
 
#define NETINET6   1
 
#define T_TXT   16
 
#define T_AFSDB   18
 
#define T_SRV   33
 
#define T_NAPTR   35
 
#define DNS_NO_ERR   0
 
#define DNS_ERR_TMPFAIL   -1
 
#define DNS_ERR_NOTFOUND   -2
 
#define DNS_ERR_SRV   -3
 
#define DNS_LOC_ERR   -4
 
#define IPV6_PREFIX_MAX   64
 
#define IPV6_PREFIX_MIN   32
 
#define IPV6_PREFIX_STEP   4
 
#define ZE_SOCK_READ   1
 
#define ZE_SOCK_WRITE   0
 
#define ZE_SOCK_ERROR   -1
 
#define ZE_SOCK_READY   0
 
#define ZE_SOCK_TIMEOUT   1
 

Typedefs

typedef struct DNS_HOST_T DNS_HOST_T
 
typedef struct DNS_HOSTARR_T DNS_HOSTARR_T
 
typedef struct resource_record RR_RECORD_T
 
typedef int HEADER
 

Functions

int client_connect (client_T *client, char *spec, int to)
 
bool client_disconnect (client_T *client, bool incerr)
 
bool client_send (client_T *client, char *buf, size_t size)
 
bool client_recv (client_T *client, char *buf, size_t size)
 
bool client_readln (client_T *client, char *buf, size_t size)
 
int connect_timed (int, struct sockaddr *, socklen_t, int)
 
void dns_free_hostarr (DNS_HOSTARR_T *mx)
 
int dns_get_a (char *domain, DNS_HOSTARR_T *a)
 
int dns_get_aaaa (char *domain, DNS_HOSTARR_T *a)
 
int dns_get_mx (char *domain, DNS_HOSTARR_T *mx)
 
void print_dns_reply (DNS_REPLY_T *r, int level)
 
void dns_free_data (DNS_REPLY_T *)
 
int dns_string_to_type (const char *)
 
const char * dns_type_to_string (int)
 
int dns_lookup (const char *domain, const char *type_name, time_t retrans, int retry, DNS_REPLY_T *)
 
bool ipv6_check_net (ipv6_T *net, ipv6_T *addr)
 
bool ipv6_str2rec (ipv6_T *ipv6, char *sin)
 
void ipv6_rec2str (char *sout, ipv6_T *ipv6, size_t sz)
 
void ipv6_expand (char *sout, char *sin, size_t size)
 
void ipv6_set_prefix (ipv6_T *addr, int prefix)
 
void ipv6_subnet (ipv6_T *net, ipv6_T *addr)
 
void ipv6_prefix_str (ipv6_T *addr, char *buf, size_t size, int n)
 
char * jinet_ntop (int, void *, char *, size_t)
 
int jinet_pton (int, char *, void *)
 
bool jsock_ntop (struct sockaddr *, socklen_t, char *, size_t)
 
int ip_strcmp (char *, char *)
 
bool get_hostname (char *, size_t)
 
bool get_hostbyaddr (char *ip, char *name, int len)
 
bool get_hostbyname (char *name, char *ip, int len)
 
char * inet_n2p (int, void *, char *, size_t)
 
int inet_p2n (int, char *, void *)
 
bool get_hostbysock (struct sockaddr *sock, socklen_t slen, char *addr, size_t alen, char *name, size_t nlen)
 
int Ip_strcmp (char *, char *)
 
int jfd_ready (int, bool, long)
 
bool sd_printf (int sd, char *format,...)
 
int sd_readln (int fd, char *buf, size_t size)
 

Variables

bool dns_lock
 

Detailed Description

Network functions

Macro Definition Documentation

◆ CLIENT_INITIALIZER

#define CLIENT_INITIALIZER
Value:
{PTHREAD_MUTEX_INITIALIZER, \
FALSE, SIGNATURE, 0, (time_t ) 0, -1, 0, 0, 0, 0}
#define SIGNATURE
Definition: ze-libjc.h:75

Definition at line 53 of file ze-client.h.

◆ CLIENT_SPEC_LEN

#define CLIENT_SPEC_LEN   512

Definition at line 32 of file ze-client.h.

◆ DNS_ERR_NOTFOUND

#define DNS_ERR_NOTFOUND   -2

Definition at line 142 of file ze-dns.h.

◆ DNS_ERR_SRV

#define DNS_ERR_SRV   -3

Definition at line 143 of file ze-dns.h.

◆ DNS_ERR_TMPFAIL

#define DNS_ERR_TMPFAIL   -1

Definition at line 141 of file ze-dns.h.

◆ DNS_LOC_ERR

#define DNS_LOC_ERR   -4

Definition at line 144 of file ze-dns.h.

◆ DNS_NO_ERR

#define DNS_NO_ERR   0

Definition at line 140 of file ze-dns.h.

◆ IPV6_PREFIX_MAX

#define IPV6_PREFIX_MAX   64

Definition at line 54 of file ze-ipv6.h.

◆ IPV6_PREFIX_MIN

#define IPV6_PREFIX_MIN   32

Definition at line 55 of file ze-ipv6.h.

◆ IPV6_PREFIX_STEP

#define IPV6_PREFIX_STEP   4

Definition at line 56 of file ze-ipv6.h.

◆ MAX_HOST

#define MAX_HOST   128

Definition at line 33 of file ze-dns-parse.h.

◆ NETINET6

#define NETINET6   1

Definition at line 55 of file ze-dns.h.

◆ T_AFSDB

#define T_AFSDB   18

Definition at line 61 of file ze-dns.h.

◆ T_NAPTR

#define T_NAPTR   35

Definition at line 67 of file ze-dns.h.

◆ T_SRV

#define T_SRV   33

Definition at line 64 of file ze-dns.h.

◆ T_TXT

#define T_TXT   16

Definition at line 58 of file ze-dns.h.

◆ ZE_SOCK_ERROR

#define ZE_SOCK_ERROR   -1

Definition at line 60 of file ze-inet.h.

◆ ZE_SOCK_READ

#define ZE_SOCK_READ   1

Definition at line 57 of file ze-inet.h.

◆ ZE_SOCK_READY

#define ZE_SOCK_READY   0

Definition at line 61 of file ze-inet.h.

◆ ZE_SOCK_TIMEOUT

#define ZE_SOCK_TIMEOUT   1

Definition at line 62 of file ze-inet.h.

◆ ZE_SOCK_WRITE

#define ZE_SOCK_WRITE   0

Definition at line 58 of file ze-inet.h.

Typedef Documentation

◆ DNS_HOST_T

typedef struct DNS_HOST_T DNS_HOST_T

◆ DNS_HOSTARR_T

typedef struct DNS_HOSTARR_T DNS_HOSTARR_T

◆ HEADER

typedef int HEADER

Definition at line 118 of file ze-dns.h.

◆ RR_RECORD_T

typedef struct resource_record RR_RECORD_T

Definition at line 92 of file ze-dns.h.

Function Documentation

◆ client_connect()

int client_connect ( client_T client,
char *  spec,
int  to 
)

Definition at line 126 of file ze-client.c.

◆ client_disconnect()

bool client_disconnect ( client_T client,
bool  incerr 
)

Definition at line 231 of file ze-client.c.

◆ client_readln()

bool client_readln ( client_T client,
char *  buf,
size_t  size 
)

Definition at line 447 of file ze-client.c.

◆ client_recv()

bool client_recv ( client_T client,
char *  buf,
size_t  size 
)

Definition at line 355 of file ze-client.c.

◆ client_send()

bool client_send ( client_T client,
char *  buf,
size_t  size 
)

Definition at line 263 of file ze-client.c.

◆ connect_timed()

int connect_timed ( int  ,
struct sockaddr *  ,
socklen_t  ,
int   
)

Definition at line 639 of file ze-client.c.

◆ dns_free_data()

void dns_free_data ( DNS_REPLY_T )

Definition at line 190 of file ze-dns.c.

◆ dns_free_hostarr()

void dns_free_hostarr ( DNS_HOSTARR_T mx)

Definition at line 89 of file ze-dns-parse.c.

◆ dns_get_a()

int dns_get_a ( char *  domain,
DNS_HOSTARR_T a 
)

Definition at line 153 of file ze-dns-parse.c.

◆ dns_get_aaaa()

int dns_get_aaaa ( char *  domain,
DNS_HOSTARR_T a 
)

Definition at line 226 of file ze-dns-parse.c.

◆ dns_get_mx()

int dns_get_mx ( char *  domain,
DNS_HOSTARR_T mx 
)

Definition at line 357 of file ze-dns-parse.c.

◆ dns_lookup()

int dns_lookup ( const char *  domain,
const char *  type_name,
time_t  retrans,
int  retry,
DNS_REPLY_T  
)

◆ dns_string_to_type()

int dns_string_to_type ( const char *  )

◆ dns_type_to_string()

const char* dns_type_to_string ( int  )

Definition at line 164 of file ze-dns.c.

◆ get_hostbyaddr()

bool get_hostbyaddr ( char *  ip,
char *  name,
int  len 
)

Definition at line 323 of file ze-inet.c.

◆ get_hostbyname()

bool get_hostbyname ( char *  name,
char *  ip,
int  len 
)

Definition at line 336 of file ze-inet.c.

◆ get_hostbysock()

bool get_hostbysock ( struct sockaddr *  sock,
socklen_t  slen,
char *  addr,
size_t  alen,
char *  name,
size_t  nlen 
)

Definition at line 421 of file ze-inet.c.

◆ get_hostname()

bool get_hostname ( char *  ,
size_t   
)

Definition at line 181 of file ze-inet.c.

◆ inet_n2p()

char* inet_n2p ( int  ,
void *  ,
char *  ,
size_t   
)

Definition at line 349 of file ze-inet.c.

◆ inet_p2n()

int inet_p2n ( int  ,
char *  ,
void *   
)

◆ ip_strcmp()

int ip_strcmp ( char *  ,
char *   
)

Definition at line 141 of file ze-inet.c.

◆ Ip_strcmp()

int Ip_strcmp ( char *  ,
char *   
)

Definition at line 480 of file ze-inet.c.

◆ ipv6_check_net()

bool ipv6_check_net ( ipv6_T net,
ipv6_T addr 
)

Definition at line 41 of file ze-ipv6.c.

◆ ipv6_expand()

void ipv6_expand ( char *  sout,
char *  sin,
size_t  size 
)

Definition at line 68 of file ze-ipv6.c.

◆ ipv6_prefix_str()

void ipv6_prefix_str ( ipv6_T addr,
char *  buf,
size_t  size,
int  n 
)

Definition at line 290 of file ze-ipv6.c.

◆ ipv6_rec2str()

void ipv6_rec2str ( char *  sout,
ipv6_T ipv6,
size_t  sz 
)

Definition at line 210 of file ze-ipv6.c.

◆ ipv6_set_prefix()

void ipv6_set_prefix ( ipv6_T addr,
int  prefix 
)

Definition at line 242 of file ze-ipv6.c.

◆ ipv6_str2rec()

bool ipv6_str2rec ( ipv6_T ipv6,
char *  sin 
)

Definition at line 96 of file ze-ipv6.c.

◆ ipv6_subnet()

void ipv6_subnet ( ipv6_T net,
ipv6_T addr 
)

Definition at line 270 of file ze-ipv6.c.

◆ jfd_ready()

int jfd_ready ( int  ,
bool  ,
long   
)

Definition at line 529 of file ze-inet.c.

◆ jinet_ntop()

char* jinet_ntop ( int  ,
void *  ,
char *  ,
size_t   
)

Definition at line 34 of file ze-inet.c.

◆ jinet_pton()

int jinet_pton ( int  ,
char *  ,
void *   
)

◆ jsock_ntop()

bool jsock_ntop ( struct sockaddr *  ,
socklen_t  ,
char *  ,
size_t   
)

Definition at line 106 of file ze-inet.c.

◆ print_dns_reply()

void print_dns_reply ( DNS_REPLY_T r,
int  level 
)

Definition at line 393 of file ze-dns-parse.c.

◆ sd_printf()

bool sd_printf ( int  sd,
char *  format,
  ... 
)

Definition at line 629 of file ze-inet.c.

◆ sd_readln()

int sd_readln ( int  fd,
char *  buf,
size_t  size 
)

Definition at line 674 of file ze-inet.c.

Variable Documentation

◆ dns_lock

bool dns_lock