Commit 0468b440 authored by Michael Graff's avatar Michael Graff

use isc/magic.h

parent 5d9d8d11
......@@ -72,17 +72,11 @@
* checked data, caller passes a good dns_name_t for the zone, etc)
*/
/*
* TODO:
*
* - Should the public type be a handle to a reference counted type?
*
*/
/***
*** IMPORTS
***/
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/lang.h>
......@@ -94,30 +88,54 @@
ISC_LANG_BEGINDECLS
/***
*** Magic number checks
***/
#define DNS_ADBHANDLE_MAGIC 0x61646248 /* adbH. */
#define DNS_ADBHANDLE_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBHANDLE_MAGIC)
#define DNS_ADBADDRINFO_MAGIC 0x61644149 /* adAI. */
#define DNS_ADBADDRINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBADDRINFO_MAGIC)
/***
*** TYPES
***/
/* The ADB */
/*
* Forward declarations
*/
typedef struct dns_adb dns_adb_t;
typedef struct dns_adbentry dns_adbentry_t;
typedef struct dns_adbaddrinfo dns_adbaddrinfo_t;
typedef struct dns_adbhandle dns_adbhandle_t;
/*
/* dns_adbhandle_t
*
* The handle into our internal state of what is going on, where, when...
* This is returned to the user as a handle, so requests can be canceled,
* etc.
*/
typedef struct dns_adbhandle dns_adbhandle_t;
/*
* Purely internal type.
*/
typedef struct dns_adbentry dns_adbentry_t;
struct dns_adbhandle {
/* Public */
unsigned int magic; /* RO: magic */
ISC_LIST(dns_adbaddrinfo_t) list; /* RO: list of addrs */
dns_adb_t *adb; /* RO: parent adb */
/* Private */
isc_mutex_t lock; /* locks all below */
isc_task_t *task; /* task to send ev */
isc_taskaction_t *taskaction;
void *arg;
isc_event_t event;
ISC_LINK(dns_adbhandle_t) link; /* private */
};
/* dns_adbaddr_t
*
* The answers to queries come back as a list of these.
*/
typedef struct dns_adbaddrinfo dns_adbaddrinfo_t;
struct dns_adbaddrinfo {
unsigned int magic; /* private */
......
......@@ -22,6 +22,7 @@
*** Imports
***/
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/buffer.h>
#include <isc/bufferlist.h>
......@@ -103,7 +104,7 @@ ISC_LANG_BEGINDECLS
#define DNS_MESSAGE_HEADERLEN 12 /* 6 isc_uint16_t's */
#define DNS_MESSAGE_MAGIC 0x4d534740U /* MSG@ */
#define DNS_MESSAGE_VALID(msg) (((msg)->magic) == DNS_MESSAGE_MAGIC)
#define DNS_MESSAGE_VALID(msg) ISC_MAGIC_VALID(msg, DNS_MESSAGE_MAGIC)
/*
* Ordering here matters. DNS_SECTION_ANY must be the lowest and negative,
......
Markdown is supported
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