2dac801278ab9638f91c8df138fd1d1c291e9cba
[silc.git] / apps / silcd / packet_send.h
1 /*
2
3   packet_send.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 1997 - 2002 Pekka Riikonen
8
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.
13   
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.
18
19 */
20
21 #ifndef PACKET_SEND_H
22 #define PACKET_SEND_H
23
24 /* Prototypes */
25
26 int silc_server_packet_send_real(SilcServer server,
27                                  SilcSocketConnection sock,
28                                  bool force_send);
29 void silc_server_packet_send(SilcServer server,
30                              SilcSocketConnection sock, 
31                              SilcPacketType type, 
32                              SilcPacketFlags flags,
33                              unsigned char *data, 
34                              SilcUInt32 data_len,
35                              bool force_send);
36 void silc_server_packet_send_dest(SilcServer server,
37                                   SilcSocketConnection sock, 
38                                   SilcPacketType type, 
39                                   SilcPacketFlags flags,
40                                   void *dst_id,
41                                   SilcIdType dst_id_type,
42                                   unsigned char *data, 
43                                   SilcUInt32 data_len,
44                                   bool force_send);
45 void silc_server_packet_send_srcdest(SilcServer server,
46                                      SilcSocketConnection sock, 
47                                      SilcPacketType type, 
48                                      SilcPacketFlags flags,
49                                      void *src_id,
50                                      SilcIdType src_id_type,
51                                      void *dst_id,
52                                      SilcIdType dst_id_type,
53                                      unsigned char *data, 
54                                      SilcUInt32 data_len,
55                                      bool force_send);
56 void silc_server_packet_broadcast(SilcServer server,
57                                   SilcSocketConnection sock,
58                                   SilcPacketContext *packet);
59 void silc_server_packet_route(SilcServer server,
60                               SilcSocketConnection sock,
61                               SilcPacketContext *packet);
62 void silc_server_packet_send_clients(SilcServer server,
63                                      SilcHashTable clients,
64                                      SilcPacketType type,
65                                      SilcPacketFlags flags,
66                                      bool route,
67                                      unsigned char *data, 
68                                      SilcUInt32 data_len,
69                                      bool force_send);
70 void silc_server_packet_send_to_channel(SilcServer server,
71                                         SilcSocketConnection sender,
72                                         SilcChannelEntry channel,
73                                         SilcPacketType type,
74                                         bool route,
75                                         unsigned char *data,
76                                         SilcUInt32 data_len,
77                                         bool force_send);
78 void silc_server_packet_relay_to_channel(SilcServer server,
79                                          SilcSocketConnection sender_sock,
80                                          SilcChannelEntry channel,
81                                          void *sender_id, 
82                                          SilcIdType sender_type,
83                                          SilcClientEntry sender_entry,
84                                          unsigned char *data,
85                                          SilcUInt32 data_len,
86                                          bool force_send);
87 void silc_server_packet_send_local_channel(SilcServer server,
88                                            SilcChannelEntry channel,
89                                            SilcPacketType type,
90                                            SilcPacketFlags flags,
91                                            unsigned char *data,
92                                            SilcUInt32 data_len,
93                                            bool force_send);
94 void silc_server_send_private_message(SilcServer server,
95                                       SilcSocketConnection dst_sock,
96                                       SilcCipher cipher,
97                                       SilcHmac hmac,
98                                       SilcUInt32 sequence,
99                                       SilcPacketContext *packet);
100 void silc_server_send_motd(SilcServer server,
101                            SilcSocketConnection sock);
102 void silc_server_send_error(SilcServer server,
103                             SilcSocketConnection sock,
104                             const char *fmt, ...);
105 void silc_server_send_notify(SilcServer server,
106                              SilcSocketConnection sock,
107                              bool broadcast,
108                              SilcNotifyType type,
109                              SilcUInt32 argc, ...);
110 void silc_server_send_notify_args(SilcServer server,
111                                   SilcSocketConnection sock,
112                                   bool broadcast,
113                                   SilcNotifyType type,
114                                   SilcUInt32 argc,
115                                   SilcBuffer args);
116 void silc_server_send_notify_channel_change(SilcServer server,
117                                             SilcSocketConnection sock,
118                                             bool broadcast,
119                                             SilcChannelID *old_id,
120                                             SilcChannelID *new_id);
121 void silc_server_send_notify_nick_change(SilcServer server,
122                                          SilcSocketConnection sock,
123                                          bool broadcast,
124                                          SilcClientID *old_id,
125                                          SilcClientID *new_id,
126                                          const char *nickname);
127 void silc_server_send_notify_join(SilcServer server,
128                                   SilcSocketConnection sock,
129                                   bool broadcast,
130                                   SilcChannelEntry channel,
131                                   SilcClientID *client_id);
132 void silc_server_send_notify_leave(SilcServer server,
133                                    SilcSocketConnection sock,
134                                    bool broadcast,
135                                    SilcChannelEntry channel,
136                                    SilcClientID *client_id);
137 void silc_server_send_notify_cmode(SilcServer server,
138                                    SilcSocketConnection sock,
139                                    bool broadcast,
140                                    SilcChannelEntry channel,
141                                    SilcUInt32 mode_mask,
142                                    void *id, SilcIdType id_type,
143                                    const char *cipher, const char *hmac,
144                                    const char *passphrase,
145                                    SilcPublicKey founder_key);
146 void silc_server_send_notify_cumode(SilcServer server,
147                                     SilcSocketConnection sock,
148                                     bool broadcast,
149                                     SilcChannelEntry channel,
150                                     SilcUInt32 mode_mask,
151                                     void *id, SilcIdType id_type,
152                                     SilcClientID *target,
153                                     SilcPublicKey founder_key);
154 void silc_server_send_notify_signoff(SilcServer server,
155                                      SilcSocketConnection sock,
156                                      bool broadcast,
157                                      SilcClientID *client_id,
158                                      const char *message);
159 void silc_server_send_notify_topic_set(SilcServer server,
160                                        SilcSocketConnection sock,
161                                        bool broadcast,
162                                        SilcChannelEntry channel,
163                                        void *id, SilcIdType id_type,
164                                        char *topic);
165 void silc_server_send_notify_kicked(SilcServer server,
166                                     SilcSocketConnection sock,
167                                     bool broadcast,
168                                     SilcChannelEntry channel,
169                                     SilcClientID *client_id,
170                                     SilcClientID *kicker,
171                                     char *comment);
172 void silc_server_send_notify_killed(SilcServer server,
173                                     SilcSocketConnection sock,
174                                     bool broadcast,
175                                     SilcClientID *client_id,
176                                     const char *comment,
177                                     void *killer, SilcIdType killer_type);
178 void silc_server_send_notify_umode(SilcServer server,
179                                    SilcSocketConnection sock,
180                                    bool broadcast,
181                                    SilcClientID *client_id,
182                                    SilcUInt32 mode_mask);
183 void silc_server_send_notify_ban(SilcServer server,
184                                  SilcSocketConnection sock,
185                                  bool broadcast,
186                                  SilcChannelEntry channel,
187                                  unsigned char *action,
188                                  SilcBuffer list);
189 void silc_server_send_notify_invite(SilcServer server,
190                                     SilcSocketConnection sock,
191                                     bool broadcast,
192                                     SilcChannelEntry channel,
193                                     SilcClientID *client_id,
194                                     unsigned char *action,
195                                     SilcBuffer list);
196 void silc_server_send_notify_watch(SilcServer server,
197                                    SilcSocketConnection sock,
198                                    SilcClientEntry watcher,
199                                    SilcClientEntry client,
200                                    const char *nickname,
201                                    SilcNotifyType type);
202 void silc_server_send_notify_dest(SilcServer server,
203                                   SilcSocketConnection sock,
204                                   bool broadcast,
205                                   void *dest_id,
206                                   SilcIdType dest_id_type,
207                                   SilcNotifyType type,
208                                   SilcUInt32 argc, ...);
209 void silc_server_send_notify_to_channel(SilcServer server,
210                                         SilcSocketConnection sender,
211                                         SilcChannelEntry channel,
212                                         bool route_notify,
213                                         SilcNotifyType type,
214                                         SilcUInt32 argc, ...);
215 void silc_server_send_notify_on_channels(SilcServer server,
216                                          SilcClientEntry sender,
217                                          SilcClientEntry client,
218                                          SilcNotifyType type,
219                                          SilcUInt32 argc, ...);
220 void silc_server_send_new_id(SilcServer server,
221                              SilcSocketConnection sock,
222                              bool broadcast,
223                              void *id, SilcIdType id_type, 
224                              SilcUInt32 id_len);
225 void silc_server_send_new_channel(SilcServer server,
226                                   SilcSocketConnection sock,
227                                   bool broadcast,
228                                   char *channel_name,
229                                   void *channel_id, 
230                                   SilcUInt32 channel_id_len,
231                                   SilcUInt32 mode);
232 void silc_server_send_channel_key(SilcServer server,
233                                   SilcSocketConnection sender,
234                                   SilcChannelEntry channel,
235                                   unsigned char route);
236 void silc_server_send_command(SilcServer server, 
237                               SilcSocketConnection sock,
238                               SilcCommand command, 
239                               SilcUInt16 ident,
240                               SilcUInt32 argc, ...);
241 void silc_server_send_command_reply(SilcServer server, 
242                                     SilcSocketConnection sock,
243                                     SilcCommand command, 
244                                     SilcStatus status,
245                                     SilcStatus error,
246                                     SilcUInt16 ident,
247                                     SilcUInt32 argc, ...);
248 void silc_server_send_dest_command_reply(SilcServer server, 
249                                          SilcSocketConnection sock,
250                                          void *dst_id,
251                                          SilcIdType dst_id_type,
252                                          SilcCommand command, 
253                                          SilcStatus status,
254                                          SilcStatus error,
255                                          SilcUInt16 ident,
256                                          SilcUInt32 argc, ...);
257 void silc_server_send_heartbeat(SilcServer server,
258                                 SilcSocketConnection sock);
259 void silc_server_relay_packet(SilcServer server,
260                               SilcSocketConnection dst_sock,
261                               SilcCipher cipher,
262                               SilcHmac hmac,
263                               SilcUInt32 sequence,
264                               SilcPacketContext *packet,
265                               bool force_send);
266 void silc_server_send_connection_auth_request(SilcServer server,
267                                               SilcSocketConnection sock,
268                                               SilcUInt16 conn_type,
269                                               SilcAuthMethod auth_meth);
270 void silc_server_packet_queue_purge(SilcServer server,
271                                     SilcSocketConnection sock);
272 void silc_server_send_opers(SilcServer server,
273                             SilcPacketType type,
274                             SilcPacketFlags flags,
275                             bool route, bool local,
276                             unsigned char *data, 
277                             SilcUInt32 data_len,
278                             bool force_send);
279 void silc_server_send_opers_notify(SilcServer server,
280                                    bool route,
281                                    bool local,
282                                    SilcNotifyType type,
283                                    SilcUInt32 argc, ...);
284
285 #endif