strongswan/Source/charon/daemon.h

147 lines
2.9 KiB
C
Raw Normal View History

2005-11-11 11:20:45 +00:00
/**
* @file daemon.h
*
2005-12-06 12:54:34 +00:00
* @brief Interface of daemon_t.
2005-11-11 11:20:45 +00:00
*
*/
/*
* 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-29 10:25:07 +00:00
#include <threads/sender.h>
#include <threads/receiver.h>
#include <threads/scheduler.h>
2006-02-09 16:25:02 +00:00
#include <threads/kernel_interface.h>
2005-12-06 12:54:34 +00:00
#include <threads/thread_pool.h>
#include <network/socket.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 <queues/event_queue.h>
#include <utils/logger_manager.h>
#include <config/configuration.h>
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* Name of the daemon.
2005-11-29 10:25:07 +00:00
*/
2005-11-16 12:06:34 +00:00
#define DAEMON_NAME "charon"
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* @brief Number of threads in the thread pool.
2005-11-29 10:25:07 +00:00
*
* 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
/**
2005-12-06 12:54:34 +00:00
* UDP Port on which the daemon will listen for incoming traffic.
2005-11-29 10:25:07 +00:00
*/
2006-02-13 13:42:01 +00:00
#define IKEV2_UDP_PORT 500
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* @brief Default loglevel for every logger context.
*
* This is the maximum allowed level for ever context, the definiton
2005-11-29 10:25:07 +00:00
* of the context may be less verbose.
*/
#define DEFAULT_LOGLEVEL CONTROL | ERROR | AUDIT
2005-11-29 10:25:07 +00:00
2005-12-06 12:54:34 +00:00
2005-11-29 10:25:07 +00:00
typedef struct daemon_t daemon_t;
/**
2005-12-06 12:54:34 +00:00
* @brief Main class of daemon, contains some globals.
2005-11-29 10:25:07 +00:00
*/
struct daemon_t {
/**
2005-12-06 12:54:34 +00:00
* A socket_t instance.
2005-11-29 10:25:07 +00:00
*/
socket_t *socket;
2005-12-06 12:54:34 +00:00
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* A send_queue_t instance.
2005-11-29 10:25:07 +00:00
*/
send_queue_t *send_queue;
2005-12-06 12:54:34 +00:00
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* A job_queue_t instance.
2005-11-29 10:25:07 +00:00
*/
job_queue_t *job_queue;
2005-12-06 12:54:34 +00:00
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* A event_queue_t instance.
2005-11-29 10:25:07 +00:00
*/
event_queue_t *event_queue;
2005-12-06 12:54:34 +00:00
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* A logger_manager_t instance.
2005-11-29 10:25:07 +00:00
*/
logger_manager_t *logger_manager;
2005-12-06 12:54:34 +00:00
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* A ike_sa_manager_t instance.
2005-11-29 10:25:07 +00:00
*/
ike_sa_manager_t *ike_sa_manager;
2005-12-06 12:54:34 +00:00
2005-11-29 10:25:07 +00:00
/**
* A configuration_t instance.
2005-11-29 10:25:07 +00:00
*/
configuration_t *configuration;
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* The Sender-Thread.
2005-11-29 10:25:07 +00:00
*/
sender_t *sender;
/**
2005-12-06 12:54:34 +00:00
* The Receiver-Thread.
2005-11-29 10:25:07 +00:00
*/
receiver_t *receiver;
/**
2005-12-06 12:54:34 +00:00
* The Scheduler-Thread.
2005-11-29 10:25:07 +00:00
*/
scheduler_t *scheduler;
/**
2005-12-06 12:54:34 +00:00
* The Thread pool managing the worker threads.
2005-11-29 10:25:07 +00:00
*/
thread_pool_t *thread_pool;
2006-02-09 16:25:02 +00:00
/**
* Kernel Interface to communicate with kernel
*/
kernel_interface_t *kernel_interface;
2005-11-29 10:25:07 +00:00
/**
2005-12-06 12:54:34 +00:00
* @brief Shut down the daemon.
2005-11-29 10:25:07 +00:00
*
2005-11-29 11:27:25 +00:00
* @param this the daemon to kill
2006-02-09 16:25:02 +00:00
* @param reason describtion why it will be killed
2005-11-29 10:25:07 +00:00
*/
2005-11-29 11:27:25 +00:00
void (*kill) (daemon_t *this, char *reason);
2005-11-29 10:25:07 +00:00
};
/**
2006-02-09 16:25:02 +00:00
* The one and only instance of the daemon.
2005-11-29 10:25:07 +00:00
*/
extern daemon_t *charon;
2005-11-11 11:20:45 +00:00
#endif /*DAEMON_H_*/