adapter.h
Go to the documentation of this file.
/*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef ADAPTER_ADAPTER_H
#define ADAPTER_ADAPTER_H
#include "config.h"
#include <stdio.h>
enum adapter_mode_enum
{
ADAPTER_FILE = 1,
ADAPTER_DNS
};
typedef enum adapter_mode_enum adapter_mode;
typedef struct adapter_struct adapter_type;
#include "adapter/addns.h"
#include "adapter/adfile.h"
#include "status.h"
#include "signer/zone.h"
struct adapter_struct {
adapter_mode type;
time_t config_last_modified;
const char* configstr;
void* config; /* TODO used either as dnsin_t* or dnsout_t* */
unsigned inbound : 1;
unsigned error : 1;
};
extern adapter_type* adapter_create(const char* str, adapter_mode type, unsigned in);
extern ods_status adapter_load_config(adapter_type* adapter);
extern int adapter_compare(adapter_type* a1, adapter_type* a2);
extern ods_status adapter_read(zone_type* zone);
extern ods_status adapter_write(zone_type* zone);
extern void adapter_cleanup(adapter_type* adapter);
#endif /* ADAPTER_ADAPTER_H */
adapter_compare
int adapter_compare(adapter_type *a1, adapter_type *a2)
Definition adapter.c:212
adapter_cleanup
void adapter_cleanup(adapter_type *adapter)
Definition adapter.c:234
adapter_load_config
ods_status adapter_load_config(adapter_type *adapter)
Definition adapter.c:99
adapter_mode
enum adapter_mode_enum adapter_mode
Definition adapter.h:44
adapter_create
adapter_type * adapter_create(const char *str, adapter_mode type, unsigned in)
Definition adapter.c:48
adapter_write
ods_status adapter_write(zone_type *zone)
Definition adapter.c:179
adapter_read
ods_status adapter_read(zone_type *zone)
Definition adapter.c:147
adapter_mode_enum
adapter_mode_enum
Definition adapter.h:40
ADAPTER_DNS
@ ADAPTER_DNS
Definition adapter.h:42
ADAPTER_FILE
@ ADAPTER_FILE
Definition adapter.h:41
addns.h
adfile.h
adapter_struct
Definition adapter.h:57
adapter_struct::config
void * config
Definition adapter.h:61
adapter_struct::type
adapter_mode type
Definition adapter.h:58
adapter_struct::config_last_modified
time_t config_last_modified
Definition adapter.h:59
adapter_struct::error
unsigned error
Definition adapter.h:63
adapter_struct::inbound
unsigned inbound
Definition adapter.h:62
adapter_struct::configstr
const char * configstr
Definition adapter.h:60
zone_struct
Definition zone.h:60
zone.h