/*
 * We need a registy of name server addresses.  For each, we retain an RTT
 * and a list of name server names which have used this address.
 */
tree_t	*by_nsaddr;
struct by_nsaddr {
	u_int32_t	rtt;		/* measured. */
	char		**names;	/* NULL terminated array; strdup'd. */
};

/*
 * "struct server" is a name server, which can have many addresses.  There
 * is no central registry of servers, since each creator can have a different
 * idea of what the addresses are.
 */
struct server {
	char		*name;		/* made with strdup. */
	struct sockaddr_in *addrs;	/* counted array. */
	int		n_addrs;	/* array size. */
};

/*
 * "struct zone" is a zone cut.
 */
tree_t	*by_class;	/* zone[class]. */
struct zone {
	enum {master, slave, cache, boot}
			type;

	/* Servers learned from boot cache, a parent zone, or !auth answer. */
	struct server	*servers_notauth;

	/* Servers learned from authoritative answer or local zone. */
	struct server	*servers_auth;

	/* Root node of zone. */
	struct node	*root;
};

struct node {
	char		*label;		/* made with strdup. */
	tree_t		*subs;		/* subdomains (node[label]). */
	/* really this is "data" since for the zone cut tree we have no sets.*/
	tree_t		*rrsets;	/* rr sets (rrset[type]). */
};

struct rrset {
	rrtype		type;
	u_int32_t	ttl;
	u_char		data[1];	/* struct size constrains this. */
};
