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;
33 SilcSocketConnection sock;
35 /* Remote host name and port */
39 /* Current connection retry info */
40 unsigned int retry_count;
41 unsigned int retry_timeout;
43 /* Back pointer to server */
45 } *SilcServerConnection;
51 struct SilcServerStruct {
58 unsigned char *id_string;
59 unsigned int id_string_len;
62 /* Server's own ID entry. */
63 SilcServerEntry id_entry;
65 /* Back pointer to the primary router of this server. */
66 SilcServerEntry router;
68 /* SILC server task queues */
69 SilcTaskQueue io_queue;
70 SilcTaskQueue timeout_queue;
71 SilcTaskQueue generic_queue;
74 SilcIDList local_list;
75 SilcIDList global_list;
77 /* Table of connected sockets */
78 SilcSocketConnection *sockets;
82 SilcCipher receive_key;
83 SilcCipher none_cipher;
85 /* Server public key */
87 SilcPublicKey public_key;
88 SilcPrivateKey private_key;
90 /* Hash objects for general hashing */
94 /* HMAC objects for MAC's. */
98 /* Configuration object */
99 SilcConfigServer config;
104 /* Server statistics */
105 SilcServerStatistics stats;
107 /* Pending command queue */
108 SilcDList pending_commands;
110 /* Default parameteres for server */
111 SilcServerParams params;
114 /* SIM (SILC Module) list */
121 /* Registers generic task for file descriptor for reading from network and
122 writing to network. As being generic task the actual task is allocated
123 only once and after that the same task applies to all registered fd's. */
124 #define SILC_REGISTER_CONNECTION_FOR_IO(fd) \
126 SilcTask tmptask = silc_task_register(server->generic_queue, (fd), \
127 silc_server_packet_process, \
130 SILC_TASK_PRI_NORMAL); \
131 silc_task_set_iotype(tmptask, SILC_TASK_WRITE); \
134 #define SILC_SET_CONNECTION_FOR_INPUT(fd) \
136 silc_schedule_set_listen_fd((fd), (1L << SILC_TASK_READ)); \
139 #define SILC_SET_CONNECTION_FOR_OUTPUT(fd) \
141 silc_schedule_set_listen_fd((fd), ((1L << SILC_TASK_READ) | \
142 (1L << SILC_TASK_WRITE))); \