ekg2  GIT master
Struktury danych | Definicje | Definicje typów | Wyliczenia | Funkcje | Zmienne
Dokumentacja pliku srv.c
#include "ekg2.h"
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <unistd.h>
#include <resolv.h>
#include "srv.h"
Wykres zależności załączania dla srv.c:

Struktury danych

union  unaligned_32
 
union  unaligned_16
 
struct  _gim_host
 

Definicje

#define T_SRV   33 /* rfc 2782 */
 
#define cli_readint16(buff)   (((const union unaligned_16 *)(buff))->una_u16)
 
#define cli_readint32(buff)   (((const union unaligned_32 *)(buff))->una_u32)
 
#define MAXDNAME   NS_MAXDNAME
 
#define RESOLVER_MAXLEN   INET6_ADDRSTRLEN
 
#define RET(x)   do { xfree(srvhost); return x; } while (0)
 

Definicje typów

typedef enum _gim_sects gim_sects
 

Wyliczenia

enum  _gim_sects {
  SQUERY =ns_s_qd, SANSWER =ns_s_an, SAUTH =ns_s_ns, SEXTRA =ns_s_ar,
  SMAX =ns_s_max
}
 

Funkcje

union unaligned_32 __attribute__ ((packed))
 
int gim_host_cmp (const gim_host *data1, const gim_host *data2)
 
char * ekg_inet_ntostr (int family, void *buf)
 
int extract_rr (unsigned char *start, unsigned char *end, unsigned char **ptr, ns_rr *rr)
 
int extract_rr_srv (unsigned char *start, unsigned char *end, unsigned char **ptr, gim_host *srv)
 
int skip_rr_ns (unsigned char *start, unsigned char *end, unsigned char **ptr)
 
int srv_resolver (gim_host **hostlist, const char *hostname, const int proto_port, const int port, const int proto)
 
static int basic_resolver_item (gim_host *srv)
 
int resolve_missing_entries (gim_host **hostlist)
 
int basic_resolver (gim_host **hostlist, const char *hostname, int port)
 
void write_out_and_destroy_list (int fd, gim_host *hostlist)
 

Zmienne

guint32 una_u32
 
gint32 una_s32
 
guint16 una_u16
 
gint16 una_s16
 
struct _gim_host __attribute__
 
const int DNS_NS_MAXDNAME = NS_MAXDNAME
 

Dokumentacja definicji

◆ cli_readint16

#define cli_readint16 (   buff)    (((const union unaligned_16 *)(buff))->una_u16)

◆ cli_readint32

#define cli_readint32 (   buff)    (((const union unaligned_32 *)(buff))->una_u32)

◆ MAXDNAME

#define MAXDNAME   NS_MAXDNAME

◆ RESOLVER_MAXLEN

#define RESOLVER_MAXLEN   INET6_ADDRSTRLEN

◆ RET

#define RET (   x)    do { xfree(srvhost); return x; } while (0)

◆ T_SRV

#define T_SRV   33 /* rfc 2782 */

Dokumentacja definicji typów

◆ gim_sects

typedef enum _gim_sects gim_sects

Dokumentacja typów wyliczanych

◆ _gim_sects

enum _gim_sects
Wartości wyliczeń
SQUERY 
SANSWER 
SAUTH 
SEXTRA 
SMAX 

Dokumentacja funkcji

◆ __attribute__()

union unaligned_32 __attribute__ ( (packed)  )

◆ basic_resolver()

int basic_resolver ( gim_host **  hostlist,
const char *  hostname,
int  port 
)

this is exactly irc_resolver2, but instead of array it appends entries to hostlist

◆ basic_resolver_item()

static int basic_resolver_item ( gim_host srv)
static

this is mostly copy of basic_resolver below it's for internal use only, for resolving missing items on the list

◆ ekg_inet_ntostr()

char* ekg_inet_ntostr ( int  family,
void *  buf 
)

ekg_inet_ntostr - convert sockaddr_in to string representing ip address

since srv_resolver uses this function and we can't place srv_resolver in net.c (due to conflict in resolv.h) for a while this function must sit here.

◆ extract_rr()

int extract_rr ( unsigned char *  start,
unsigned char *  end,
unsigned char **  ptr,
ns_rr *  rr 
)

extract_rr()

parses RR header from dns reply. RR format according to rfc 1035.

Parametry
start- beginning of a buffer with dns response
end- end of buffer - beginning of RR, ptr will be adjusted approprietly - structure where result will be placed
Zwraca
0 - on success, non zero otherwise

IF RETURNED STATUS IS NON-ZERO, content of 'rr' struct is undefined

◆ extract_rr_srv()

int extract_rr_srv ( unsigned char *  start,
unsigned char *  end,
unsigned char **  ptr,
gim_host srv 
)

◆ gim_host_cmp()

int gim_host_cmp ( const gim_host data1,
const gim_host data2 
)

◆ resolve_missing_entries()

int resolve_missing_entries ( gim_host **  hostlist)

◆ skip_rr_ns()

int skip_rr_ns ( unsigned char *  start,
unsigned char *  end,
unsigned char **  ptr 
)

◆ srv_resolver()

int srv_resolver ( gim_host **  hostlist,
const char *  hostname,
const int  proto_port,
const int  port,
const int  proto 
)

◆ write_out_and_destroy_list()

void write_out_and_destroy_list ( int  fd,
gim_host hostlist 
)

Dokumentacja zmiennych

◆ __attribute__

◆ DNS_NS_MAXDNAME

const int DNS_NS_MAXDNAME = NS_MAXDNAME

◆ una_s16

gint16 una_s16

◆ una_s32

gint32 una_s32

◆ una_u16

guint16 una_u16

◆ una_u32

guint32 una_u32