5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 1997 - 2000 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
21 #ifndef SERVER_INTERNAL_H
22 #define SERVER_INTERNAL_H
24 /* Server statistics structure. This holds various statistics about
29 } SilcServerStatistics;
35 typedef struct SilcServerObjectStruct {
43 SilcServerList *id_entry;
45 /* SILC server task queues */
46 SilcTaskQueue io_queue;
47 SilcTaskQueue timeout_queue;
48 SilcTaskQueue generic_queue;
51 SilcIDList local_list;
52 SilcIDList global_list;
54 /* Table of connected sockets */
55 SilcSocketConnection *sockets;
59 SilcCipher receive_key;
60 SilcCipher none_cipher;
62 /* Server public key */
64 SilcPublicKey public_key;
65 SilcPrivateKey private_key;
67 /* Hash objects for general hashing */
71 /* HMAC objects for MAC's. */
75 /* Configuration object */
76 SilcConfigServer config;
81 /* Server statistics */
82 SilcServerStatistics stats;
85 /* SIM (SILC Module) table */
87 unsigned int sim_count;
93 /* Registers generic task for file descriptor for reading from network and
94 writing to network. As being generic task the actual task is allocated
95 only once and after that the same task applies to all registered fd's. */
96 #define SILC_REGISTER_CONNECTION_FOR_IO(fd) \
98 SilcTask tmptask = silc_task_register(server->generic_queue, (fd), \
99 silc_server_packet_process, \
102 SILC_TASK_PRI_NORMAL); \
103 silc_task_set_iotype(tmptask, SILC_TASK_WRITE); \
106 #define SILC_SET_CONNECTION_FOR_INPUT(fd) \
108 silc_schedule_set_listen_fd((fd), (1L << SILC_TASK_READ)); \
111 #define SILC_SET_CONNECTION_FOR_OUTPUT(fd) \
113 silc_schedule_set_listen_fd((fd), ((1L << SILC_TASK_READ) | \
114 (1L << SILC_TASK_WRITE))); \