- retransmitting of requests implemented
[strongswan.git] / Source / charon / daemon.h
1 /**
2 * @file daemon.h
3 *
4 * @brief Main of IKEv2-Daemon
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef DAEMON_H_
24 #define DAEMON_H_
25
26
27
28 #include <threads/sender.h>
29 #include <threads/receiver.h>
30 #include <threads/scheduler.h>
31 #include <threads/thread_pool.h>
32 #include <sa/ike_sa_manager.h>
33 #include <queues/send_queue.h>
34 #include <queues/job_queue.h>
35 #include <network/socket.h>
36 #include <queues/event_queue.h>
37 #include <utils/logger_manager.h>
38 #include <config/configuration_manager.h>
39
40 /**
41 * Name of the daemon
42 */
43 #define DAEMON_NAME "charon"
44
45 /**
46 * Number of threads in the thread pool
47 *
48 * There are several other threads, this defines
49 * only the number of threads in thread_pool_t.
50 */
51 #define NUMBER_OF_WORKING_THREADS 4
52
53 /**
54 * Port on which the daemon will
55 * listen for incoming traffic.
56 */
57 #define IKEV2_UDP_PORT 4500
58
59 /**
60 * First retransmit timeout in milliseconds.
61 */
62 #define RETRANSMIT_TIMEOUT 3000
63
64 /**
65 * Max retransmit count. 0 for infinite.
66 */
67 #define MAX_RETRANSMIT_COUNT 0
68
69 /**
70 * Default loglevel to use. This is the
71 * maximum allowed level for ever context, the definiton
72 * of the context may be less verbose.
73 */
74 #define DEFAULT_LOGLEVEL FULL
75
76 typedef struct daemon_t daemon_t;
77
78 /**
79 * @brief Main class of daemon, contains some globals
80 */
81 struct daemon_t {
82 /**
83 * socket_t instance
84 */
85 socket_t *socket;
86 /**
87 * send_queue_t instance
88 */
89 send_queue_t *send_queue;
90 /**
91 * job_queue_t instance
92 */
93 job_queue_t *job_queue;
94 /**
95 * event_queue_t instance
96 */
97 event_queue_t *event_queue;
98 /**
99 * logger_manager_t instance
100 */
101 logger_manager_t *logger_manager;
102 /**
103 * ike_sa_manager_t instance
104 */
105 ike_sa_manager_t *ike_sa_manager;
106 /**
107 * configuration_manager_t instance
108 */
109 configuration_manager_t *configuration_manager;
110
111 /**
112 * Sender-Thread
113 */
114 sender_t *sender;
115
116 /**
117 * Receiver-Thread
118 */
119 receiver_t *receiver;
120
121 /**
122 * Scheduler-Thread
123 */
124 scheduler_t *scheduler;
125
126 /**
127 * Thread pool holding the worker threads
128 */
129 thread_pool_t *thread_pool;
130
131 /**
132 * @brief shut down the daemon
133 *
134 * @param this the daemon to kill
135 * @param reason describition why it will be killed
136 */
137 void (*kill) (daemon_t *this, char *reason);
138 };
139
140 /**
141 * one and only instance of the daemon
142 */
143 extern daemon_t *charon;
144
145 #endif /*DAEMON_H_*/