Merged silc_1_0_branch to trunk.
[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 - 2003 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                                         bool send_to_clients,
76                                         unsigned char *data,
77                                         SilcUInt32 data_len,
78                                         bool force_send);
79 void silc_server_packet_relay_to_channel(SilcServer server,
80                                          SilcSocketConnection sender_sock,
81                                          SilcChannelEntry channel,
82                                          void *sender_id,
83                                          SilcIdType sender_type,
84                                          SilcClientEntry sender_entry,
85                                          unsigned char *data,
86                                          SilcUInt32 data_len,
87                                          bool force_send);
88 void silc_server_packet_send_local_channel(SilcServer server,
89                                            SilcChannelEntry channel,
90                                            SilcPacketType type,
91                                            SilcPacketFlags flags,
92                                            unsigned char *data,
93                                            SilcUInt32 data_len,
94                                            bool force_send);
95 void silc_server_send_private_message(SilcServer server,
96                                       SilcSocketConnection dst_sock,
97                                       SilcCipher cipher,
98                                       SilcHmac hmac,
99                                       SilcUInt32 sequence,
100                                       SilcPacketContext *packet);
101 void silc_server_send_motd(SilcServer server,
102                            SilcSocketConnection sock);
103 void silc_server_send_error(SilcServer server,
104                             SilcSocketConnection sock,
105                             const char *fmt, ...);
106 void silc_server_send_notify(SilcServer server,
107                              SilcSocketConnection sock,
108                              bool broadcast,
109                              SilcNotifyType type,
110                              SilcUInt32 argc, ...);
111 void silc_server_send_notify_args(SilcServer server,
112                                   SilcSocketConnection sock,
113                                   bool broadcast,
114                                   SilcNotifyType type,
115                                   SilcUInt32 argc,
116                                   SilcBuffer args);
117 void silc_server_send_notify_channel_change(SilcServer server,
118                                             SilcSocketConnection sock,
119                                             bool broadcast,
120                                             SilcChannelID *old_id,
121                                             SilcChannelID *new_id);
122 void silc_server_send_notify_nick_change(SilcServer server,
123                                          SilcSocketConnection sock,
124                                          bool broadcast,
125                                          SilcClientID *old_id,
126                                          SilcClientID *new_id,
127                                          const char *nickname);
128 void silc_server_send_notify_join(SilcServer server,
129                                   SilcSocketConnection sock,
130                                   bool broadcast,
131                                   SilcChannelEntry channel,
132                                   SilcClientID *client_id);
133 void silc_server_send_notify_leave(SilcServer server,
134                                    SilcSocketConnection sock,
135                                    bool broadcast,
136                                    SilcChannelEntry channel,
137                                    SilcClientID *client_id);
138 void silc_server_send_notify_cmode(SilcServer server,
139                                    SilcSocketConnection sock,
140                                    bool broadcast,
141                                    SilcChannelEntry channel,
142                                    SilcUInt32 mode_mask,
143                                    void *id, SilcIdType id_type,
144                                    const char *cipher, const char *hmac,
145                                    const char *passphrase,
146                                    SilcPublicKey founder_key,
147                                    SilcBuffer channel_pubkeys);
148 void silc_server_send_notify_cumode(SilcServer server,
149                                     SilcSocketConnection sock,
150                                     bool broadcast,
151                                     SilcChannelEntry channel,
152                                     SilcUInt32 mode_mask,
153                                     void *id, SilcIdType id_type,
154                                     SilcClientID *target,
155                                     SilcPublicKey founder_key);
156 void silc_server_send_notify_signoff(SilcServer server,
157                                      SilcSocketConnection sock,
158                                      bool broadcast,
159                                      SilcClientID *client_id,
160                                      const char *message);
161 void silc_server_send_notify_topic_set(SilcServer server,
162                                        SilcSocketConnection sock,
163                                        bool broadcast,
164                                        SilcChannelEntry channel,
165                                        void *id, SilcIdType id_type,
166                                        char *topic);
167 void silc_server_send_notify_kicked(SilcServer server,
168                                     SilcSocketConnection sock,
169                                     bool broadcast,
170                                     SilcChannelEntry channel,
171                                     SilcClientID *client_id,
172                                     SilcClientID *kicker,
173                                     char *comment);
174 void silc_server_send_notify_killed(SilcServer server,
175                                     SilcSocketConnection sock,
176                                     bool broadcast,
177                                     SilcClientID *client_id,
178                                     const char *comment,
179                                     void *killer, SilcIdType killer_type);
180 void silc_server_send_notify_umode(SilcServer server,
181                                    SilcSocketConnection sock,
182                                    bool broadcast,
183                                    SilcClientID *client_id,
184                                    SilcUInt32 mode_mask);
185 void silc_server_send_notify_ban(SilcServer server,
186                                  SilcSocketConnection sock,
187                                  bool broadcast,
188                                  SilcChannelEntry channel,
189                                  unsigned char *action,
190                                  SilcBuffer list);
191 void silc_server_send_notify_invite(SilcServer server,
192                                     SilcSocketConnection sock,
193                                     bool broadcast,
194                                     SilcChannelEntry channel,
195                                     SilcClientID *client_id,
196                                     unsigned char *action,
197                                     SilcBuffer list);
198 void silc_server_send_notify_watch(SilcServer server,
199                                    SilcSocketConnection sock,
200                                    SilcClientEntry watcher,
201                                    SilcClientEntry client,
202                                    const char *nickname,
203                                    SilcNotifyType type);
204 void silc_server_send_notify_dest(SilcServer server,
205                                   SilcSocketConnection sock,
206                                   bool broadcast,
207                                   void *dest_id,
208                                   SilcIdType dest_id_type,
209                                   SilcNotifyType type,
210                                   SilcUInt32 argc, ...);
211 void silc_server_send_notify_to_channel(SilcServer server,
212                                         SilcSocketConnection sender,
213                                         SilcChannelEntry channel,
214                                         bool route_notify,
215                                         bool send_to_clients,
216                                         SilcNotifyType type,
217                                         SilcUInt32 argc, ...);
218 void silc_server_send_notify_on_channels(SilcServer server,
219                                          SilcClientEntry sender,
220                                          SilcClientEntry client,
221                                          SilcNotifyType type,
222                                          SilcUInt32 argc, ...);
223 void silc_server_send_new_id(SilcServer server,
224                              SilcSocketConnection sock,
225                              bool broadcast,
226                              void *id, SilcIdType id_type,
227                              SilcUInt32 id_len);
228 void silc_server_send_new_channel(SilcServer server,
229                                   SilcSocketConnection sock,
230                                   bool broadcast,
231                                   char *channel_name,
232                                   void *channel_id,
233                                   SilcUInt32 channel_id_len,
234                                   SilcUInt32 mode);
235 void silc_server_send_channel_key(SilcServer server,
236                                   SilcSocketConnection sender,
237                                   SilcChannelEntry channel,
238                                   unsigned char route);
239 void silc_server_send_command(SilcServer server,
240                               SilcSocketConnection sock,
241                               SilcCommand command,
242                               SilcUInt16 ident,
243                               SilcUInt32 argc, ...);
244 void silc_server_send_command_reply(SilcServer server,
245                                     SilcSocketConnection sock,
246                                     SilcCommand command,
247                                     SilcStatus status,
248                                     SilcStatus error,
249                                     SilcUInt16 ident,
250                                     SilcUInt32 argc, ...);
251 void silc_server_send_dest_command_reply(SilcServer server,
252                                          SilcSocketConnection sock,
253                                          void *dst_id,
254                                          SilcIdType dst_id_type,
255                                          SilcCommand command,
256                                          SilcStatus status,
257                                          SilcStatus error,
258                                          SilcUInt16 ident,
259                                          SilcUInt32 argc, ...);
260 void silc_server_send_heartbeat(SilcServer server,
261                                 SilcSocketConnection sock);
262 void silc_server_relay_packet(SilcServer server,
263                               SilcSocketConnection dst_sock,
264                               SilcCipher cipher,
265                               SilcHmac hmac,
266                               SilcUInt32 sequence,
267                               SilcPacketContext *packet,
268                               bool force_send);
269 void silc_server_send_connection_auth_request(SilcServer server,
270                                               SilcSocketConnection sock,
271                                               SilcUInt16 conn_type,
272                                               SilcAuthMethod auth_meth);
273 void silc_server_packet_queue_purge(SilcServer server,
274                                     SilcSocketConnection sock);
275 void silc_server_send_opers(SilcServer server,
276                             SilcPacketType type,
277                             SilcPacketFlags flags,
278                             bool route, bool local,
279                             unsigned char *data,
280                             SilcUInt32 data_len,
281                             bool force_send);
282 void silc_server_send_opers_notify(SilcServer server,
283                                    bool route,
284                                    bool local,
285                                    SilcNotifyType type,
286                                    SilcUInt32 argc, ...);
287
288 #endif