ekg2  GIT master
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje Grupay Strony
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

#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)
#define T_SRV   33 /* rfc 2782 */

Dokumentacja definicji typów

typedef enum _gim_sects gim_sects

Dokumentacja typów wyliczanych

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

Dokumentacja funkcji

union unaligned_32 __attribute__ ( (packed)  )
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

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

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.

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

int extract_rr_srv ( unsigned char *  start,
unsigned char *  end,
unsigned char **  ptr,
gim_host srv 
)
int gim_host_cmp ( const gim_host data1,
const gim_host data2 
)
int resolve_missing_entries ( gim_host **  hostlist)
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 
)
void write_out_and_destroy_list ( int  fd,
gim_host hostlist 
)

Dokumentacja zmiennych

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