96 lines
1.7 KiB
C
96 lines
1.7 KiB
C
|
#ifndef __RR_H__
|
||
|
#define __RR_H__
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#include <time.h>
|
||
|
|
||
|
#include <sys/types.h>
|
||
|
#include <sys/socket.h>
|
||
|
#include <netinet/in.h>
|
||
|
|
||
|
typedef struct {
|
||
|
struct in_addr address;
|
||
|
} DNSRR_A;
|
||
|
|
||
|
typedef struct {
|
||
|
struct in6_addr address;
|
||
|
} DNSRR_AAAA;
|
||
|
|
||
|
typedef struct {
|
||
|
unsigned char name[512];
|
||
|
} DNSRR_NS;
|
||
|
|
||
|
typedef struct {
|
||
|
unsigned char name[512];
|
||
|
} DNSRR_CNAME;
|
||
|
|
||
|
typedef struct {
|
||
|
uint16_t preference;
|
||
|
unsigned char name[512];
|
||
|
} DNSRR_MX;
|
||
|
|
||
|
typedef struct {
|
||
|
unsigned char txt[512];
|
||
|
} DNSRR_TXT;
|
||
|
|
||
|
typedef struct {
|
||
|
unsigned char mname[512];
|
||
|
unsigned char rname[512];
|
||
|
uint32_t serial, refresh, retry, expire, minimum;
|
||
|
} DNSRR_SOA;
|
||
|
|
||
|
typedef struct {
|
||
|
unsigned char name[512];
|
||
|
} DNSRR_PTR;
|
||
|
|
||
|
typedef struct {
|
||
|
char algorithm[512];
|
||
|
time_t time_signed;
|
||
|
uint16_t fudge;
|
||
|
int mac_size;
|
||
|
unsigned char mac[512];
|
||
|
uint16_t original_id;
|
||
|
|
||
|
int error;
|
||
|
int other_length;
|
||
|
unsigned char other_data[512];
|
||
|
|
||
|
char *key;
|
||
|
} DNSRR_TSIG;
|
||
|
|
||
|
typedef struct {
|
||
|
char name[512];
|
||
|
|
||
|
uint16_t type;
|
||
|
|
||
|
int klass;
|
||
|
|
||
|
uint32_t ttl;
|
||
|
/*int rd_length;
|
||
|
void *rdata;*/
|
||
|
|
||
|
union {
|
||
|
DNSRR_A a;
|
||
|
DNSRR_AAAA aaaa;
|
||
|
DNSRR_TSIG tsig;
|
||
|
DNSRR_NS ns;
|
||
|
DNSRR_CNAME cname;
|
||
|
DNSRR_MX mx;
|
||
|
DNSRR_TXT txt;
|
||
|
DNSRR_SOA soa;
|
||
|
DNSRR_PTR ptr;
|
||
|
};
|
||
|
} DNSRR;
|
||
|
|
||
|
DNSRR *dns2_rr_create_a (const char *name, int klass, int ttl, struct in_addr address);
|
||
|
DNSRR *dns2_rr_create_aaaa (const char *name, int klass, int ttl, struct in6_addr address);
|
||
|
DNSRR *dns2_rr_create_ns (const char *name, int klass, int ttl, const char *nsname);
|
||
|
DNSRR *dns2_rr_create_tsig (const char *name, const char *signature, const char *algorithm);
|
||
|
DNSRR *dns2_rr_dup (const DNSRR *rr);
|
||
|
void dns2_rr_free (DNSRR *rr);
|
||
|
|
||
|
#endif /* __RR_H__ */
|