ekg2
GIT master
|
#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"
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 |
#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 */ |
typedef enum _gim_sects gim_sects |
enum _gim_sects |
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 |
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 | ||
) |
parses RR header from dns reply. RR format according to rfc 1035.
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 |
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 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 | ||
) |
const int DNS_NS_MAXDNAME = NS_MAXDNAME |
gint16 una_s16 |
gint32 una_s32 |
guint16 una_u16 |
guint32 una_u32 |