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;
};
extern listener_type* listener_create(void);
extern interface_type* listener_push(listener_type* list, char* address, int family,
const char* port);
extern void interface_cleanup(interface_type* i);
extern void listener_cleanup(listener_type* listener);
#endif /* WIRE_LISTENER_H */
listener_cleanup
void listener_cleanup(listener_type *listener)
Definition listener.c:126
interface_cleanup
void interface_cleanup(interface_type *i)
Definition listener.c:111
listener_type
struct listener_struct listener_type
Definition listener.h:80
listener_create
listener_type * listener_create(void)
Definition listener.c:45
listener_push
interface_type * listener_push(listener_type *list, char *address, int family, const char *port)
Definition listener.c:60
interface_type
struct interface_struct interface_type
Definition listener.h:68
interface_struct
Definition listener.h:69
interface_struct::addr
union acl_addr_storage addr
Definition listener.h:73
interface_struct::family
int family
Definition listener.h:72
interface_struct::address
char * address
Definition listener.h:71
interface_struct::port
char * port
Definition listener.h:70
listener_struct
Definition listener.h:81
listener_struct::count
size_t count
Definition listener.h:83
listener_struct::interfaces
interface_type * interfaces
Definition listener.h:82
acl_addr_storage
Definition listener.h:59
acl_addr_storage::addr
struct in_addr addr
Definition listener.h:60
acl_addr_storage::addr6
struct in6_addr addr6
Definition listener.h:61