Skip to content
Snippets Groups Projects
Commit 4f38c498 authored by Lubos Slovak's avatar Lubos Slovak
Browse files

Basic DNS structures outlined.

refs #5
parent 5f16b4fb
Branches
Tags
No related merge requests found
......@@ -54,3 +54,11 @@ src/server/tcp-handler.h
src/server/udp-handler.c
src/server/udp-handler-epoll.c
src/server/tcp-handler.c
src/dnslib/dname.h
src/dnslib/dname.c
src/dnslib/rrset.h
src/dnslib/rrset.c
src/dnslib/rdata.h
src/dnslib/rdata.c
src/dnslib/node.h
src/dnslib/node.c
#ifndef _CUTEDNS_DNAME_H
#define _CUTEDNS_DNAME_H
#include <stdint.h>
#include "common.h"
#include "node.h"
struct dnslib_dname {
uint8_t *dname;
uint length; // is this needed? every dname should end with \0 or pointer
dnslib_node_t *node; // NULL if not in zone
};
typedef struct dname dnslib_dname_t;
#endif /* _CUTEDNS_DNAME_H */
#ifndef _CUTEDNS_NODE_H
#define _CUTEDNS_NODE_H
#include "dname.h"
#include "skip-list.h"
struct dnslib_node {
dnslib_dname_t *owner;
struct dnslib_node *parent;
skip_list *rrsets;
};
typedef struct dnslib_node dnslib_node_t;
#endif /* _CUTEDNS_NODE_H */
#ifndef _CUTEDNS_RDATA_H
#define _CUTEDNS_RDATA_H
#include <stdint.h>
#include "dname.h"
#include "common.h"
union dnslib_rdata_item {
uint8_t *raw_data; // will this be convenient enough? what about parsing?
dnslib_dname_t *dname;
};
typedef union dnslib_rdata_item dnslib_rdata_item_t;
/*----------------------------------------------------------------------------*/
struct dnslib_rdata {
dnslib_rdata_item_t *items;
uint *item_lengths;
uint item_count;
};
typedef struct dnslib_rdata dnslib_rdata_t;
#endif /* _CUTEDNS_RDATA_H */
#ifndef _CUTEDNS_RRSET_H
#define _CUTEDNS_RRSET_H
#include <stdint.h>
#include "dname.h"
#include "rdata.h"
#include "common.h"
struct dnslib_rrset {
dnslib_dname_t *owner;
uint16_t type;
uint16_t rclass;
uint32_t ttl;
dnslib_rdata_t *rdata;
uint rdata_count;
// signatures
dnslib_rrset *rrsigs;
uint rrsig_first;
uint rrsig_count;
};
typedef struct dnslib_rrset dnslib_rrset_t;
#endif /* _CUTEDNS_RRSET_H */
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment