listener.h
Go to the documentation of this file.
/*
* Copyright (c) 2011 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 WIRE_LISTENER_H
#define WIRE_LISTENER_H
#include "config.h"
#include "status.h"
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <unistd.h>
#define DNS_PORT_STRING "53"
#define INBUF_SIZE 4096 /* max size for incoming queries */
#define MAX_INTERFACES 32
union acl_addr_storage {
struct in_addr addr;
struct in6_addr addr6;
};
typedef struct interface_struct interface_type;
struct interface_struct {
char* port;
char* address;
int family;
union acl_addr_storage addr;
};
typedef struct listener_struct listener_type;
struct listener_struct {
interface_type* interfaces;
size_t count;
};
listener_type* listener_create(void);
interface_type* listener_push(listener_type* list, char* address, int family,
const char* port);
void interface_cleanup(interface_type* i);
void listener_cleanup(listener_type* listener);
#endif /* WIRE_LISTENER_H */
listener_push
interface_type * listener_push(listener_type *list, char *address, int family, const char *port)
Definition: listener.c:60
listener_cleanup
void listener_cleanup(listener_type *listener)
Definition: listener.c:126
interface_struct::family
int family
Definition: listener.h:72
acl_addr_storage
Definition: listener.h:59
listener_struct::count
size_t count
Definition: listener.h:83
interface_struct
Definition: listener.h:69
listener_create
listener_type * listener_create(void)
Definition: listener.c:45
interface_struct::address
char * address
Definition: listener.h:71
interface_struct::port
char * port
Definition: listener.h:70
listener_struct::interfaces
interface_type * interfaces
Definition: listener.h:82
acl_addr_storage::addr
struct in_addr addr
Definition: listener.h:60
listener_struct
Definition: listener.h:81
acl_addr_storage::addr6
struct in6_addr addr6
Definition: listener.h:61
interface_cleanup
void interface_cleanup(interface_type *i)
Definition: listener.c:111