2005-11-11 11:20:45 +00:00
|
|
|
/**
|
|
|
|
* @file daemon.h
|
|
|
|
*
|
|
|
|
* @brief Main of IKEv2-Daemon
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2005 Jan Hutter, Martin Willi
|
|
|
|
* Hochschule fuer Technik Rapperswil
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DAEMON_H_
|
|
|
|
#define DAEMON_H_
|
|
|
|
|
2005-11-16 12:06:34 +00:00
|
|
|
|
2005-11-29 10:25:07 +00:00
|
|
|
|
|
|
|
#include <threads/sender.h>
|
|
|
|
#include <threads/receiver.h>
|
|
|
|
#include <threads/scheduler.h>
|
|
|
|
#include <threads/thread_pool.h>
|
2005-12-04 01:30:35 +00:00
|
|
|
#include <threads/prime_pool.h>
|
2005-11-29 10:25:07 +00:00
|
|
|
#include <sa/ike_sa_manager.h>
|
|
|
|
#include <queues/send_queue.h>
|
|
|
|
#include <queues/job_queue.h>
|
|
|
|
#include <network/socket.h>
|
|
|
|
#include <queues/event_queue.h>
|
|
|
|
#include <utils/logger_manager.h>
|
|
|
|
#include <config/configuration_manager.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Name of the daemon
|
|
|
|
*/
|
2005-11-16 12:06:34 +00:00
|
|
|
#define DAEMON_NAME "charon"
|
|
|
|
|
2005-11-29 10:25:07 +00:00
|
|
|
/**
|
|
|
|
* Number of threads in the thread pool
|
|
|
|
*
|
|
|
|
* There are several other threads, this defines
|
|
|
|
* only the number of threads in thread_pool_t.
|
|
|
|
*/
|
2005-11-29 11:27:25 +00:00
|
|
|
#define NUMBER_OF_WORKING_THREADS 4
|
2005-11-16 12:06:34 +00:00
|
|
|
|
2005-11-29 10:25:07 +00:00
|
|
|
/**
|
|
|
|
* Port on which the daemon will
|
2005-12-02 14:07:36 +00:00
|
|
|
* listen for incoming traffic.
|
2005-11-29 10:25:07 +00:00
|
|
|
*/
|
2005-12-05 12:21:38 +00:00
|
|
|
#define IKEV2_UDP_PORT 500
|
2005-11-17 08:44:28 +00:00
|
|
|
|
2005-12-02 14:07:36 +00:00
|
|
|
/**
|
|
|
|
* First retransmit timeout in milliseconds.
|
|
|
|
*/
|
|
|
|
#define RETRANSMIT_TIMEOUT 3000
|
|
|
|
|
2005-12-06 12:27:09 +00:00
|
|
|
/**
|
|
|
|
* Timeout in milliseconds after that a half open IKE_SA gets deleted.
|
|
|
|
*/
|
|
|
|
#define HALF_OPEN_IKE_SA_TIMEOUT 30000
|
|
|
|
|
2005-12-02 14:07:36 +00:00
|
|
|
/**
|
|
|
|
* Max retransmit count. 0 for infinite.
|
|
|
|
*/
|
|
|
|
#define MAX_RETRANSMIT_COUNT 0
|
|
|
|
|
2005-11-29 10:25:07 +00:00
|
|
|
/**
|
|
|
|
* Default loglevel to use. This is the
|
|
|
|
* maximum allowed level for ever context, the definiton
|
|
|
|
* of the context may be less verbose.
|
|
|
|
*/
|
2005-12-05 12:21:38 +00:00
|
|
|
#define DEFAULT_LOGLEVEL CONTROL | ERROR
|
2005-11-29 10:25:07 +00:00
|
|
|
|
|
|
|
typedef struct daemon_t daemon_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Main class of daemon, contains some globals
|
|
|
|
*/
|
|
|
|
struct daemon_t {
|
|
|
|
/**
|
|
|
|
* socket_t instance
|
|
|
|
*/
|
|
|
|
socket_t *socket;
|
|
|
|
/**
|
|
|
|
* send_queue_t instance
|
|
|
|
*/
|
|
|
|
send_queue_t *send_queue;
|
|
|
|
/**
|
|
|
|
* job_queue_t instance
|
|
|
|
*/
|
|
|
|
job_queue_t *job_queue;
|
|
|
|
/**
|
|
|
|
* event_queue_t instance
|
|
|
|
*/
|
|
|
|
event_queue_t *event_queue;
|
|
|
|
/**
|
|
|
|
* logger_manager_t instance
|
|
|
|
*/
|
|
|
|
logger_manager_t *logger_manager;
|
|
|
|
/**
|
|
|
|
* ike_sa_manager_t instance
|
|
|
|
*/
|
|
|
|
ike_sa_manager_t *ike_sa_manager;
|
|
|
|
/**
|
|
|
|
* configuration_manager_t instance
|
|
|
|
*/
|
|
|
|
configuration_manager_t *configuration_manager;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sender-Thread
|
|
|
|
*/
|
|
|
|
sender_t *sender;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Receiver-Thread
|
|
|
|
*/
|
|
|
|
receiver_t *receiver;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Scheduler-Thread
|
|
|
|
*/
|
|
|
|
scheduler_t *scheduler;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Thread pool holding the worker threads
|
|
|
|
*/
|
|
|
|
thread_pool_t *thread_pool;
|
|
|
|
|
2005-12-04 01:30:35 +00:00
|
|
|
/**
|
|
|
|
* Low-priority thread which generates primes
|
|
|
|
*/
|
|
|
|
prime_pool_t *prime_pool;
|
|
|
|
|
2005-11-29 10:25:07 +00:00
|
|
|
/**
|
|
|
|
* @brief shut down the daemon
|
|
|
|
*
|
2005-11-29 11:27:25 +00:00
|
|
|
* @param this the daemon to kill
|
2005-11-29 10:25:07 +00:00
|
|
|
* @param reason describition why it will be killed
|
|
|
|
*/
|
2005-11-29 11:27:25 +00:00
|
|
|
void (*kill) (daemon_t *this, char *reason);
|
2005-11-29 10:25:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* one and only instance of the daemon
|
|
|
|
*/
|
|
|
|
extern daemon_t *charon;
|
2005-11-11 11:20:45 +00:00
|
|
|
|
|
|
|
#endif /*DAEMON_H_*/
|