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 - 2004 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; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19
20 #ifndef PACKET_SEND_H
21 #define PACKET_SEND_H
22
23 /* Prototypes */
24
25 int silc_server_packet_send_real(SilcServer server,
26                                  SilcSocketConnection sock,
27                                  bool force_send);
28 void silc_server_packet_send(SilcServer server,
29                              SilcSocketConnection sock,
30                              SilcPacketType type,
31                              SilcPacketFlags flags,
32                              unsigned char *data,
33                              SilcUInt32 data_len,
34                              bool force_send);
35 void silc_server_packet_send_dest(SilcServer server,
36                                   SilcSocketConnection sock,
37                                   SilcPacketType type,
38                                   SilcPacketFlags flags,
39                                   void *dst_id,
40                                   SilcIdType dst_id_type,
41                                   unsigned char *data,
42                                   SilcUInt32 data_len,
43                                   bool force_send);
44 void silc_server_packet_send_srcdest(SilcServer server,
45                                      SilcSocketConnection sock,
46                                      SilcPacketType type,
47                                      SilcPacketFlags flags,
48                                      void *src_id,
49                                      SilcIdType src_id_type,
50                                      void *dst_id,
51                                      SilcIdType dst_id_type,
52                                      unsigned char *data,
53                                      SilcUInt32 data_len,
54                                      bool force_send);
55 void silc_server_packet_broadcast(SilcServer server,
56                                   SilcSocketConnection sock,
57                                   SilcPacketContext *packet);
58 void silc_server_packet_route(SilcServer server,
59                               SilcSocketConnection sock,
60                               SilcPacketContext *packet);
61 void silc_server_packet_send_clients(SilcServer server,
62                                      SilcHashTable clients,
63                                      SilcPacketType type,
64                                      SilcPacketFlags flags,
65                                      bool route,
66                                      unsigned char *data,
67                                      SilcUInt32 data_len,
68                                      bool force_send);
69 void silc_server_packet_send_to_channel(SilcServer server,
70                                         SilcSocketConnection sender,
71                                         SilcChannelEntry channel,
72                                         SilcPacketType type,
73                                         bool route,
74                                         bool send_to_clients,
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                                    SilcBuffer channel_pubkeys);
147 void silc_server_send_notify_cumode(SilcServer server,
148                                     SilcSocketConnection sock,
149                                     bool broadcast,
150                                     SilcChannelEntry channel,
151                                     SilcUInt32 mode_mask,
152                                     void *id, SilcIdType id_type,
153                                     SilcClientID *target,
154                                     SilcPublicKey founder_key);
155 void silc_server_send_notify_signoff(SilcServer server,
156                                      SilcSocketConnection sock,
157                                      bool broadcast,
158                                      SilcClientID *client_id,
159                                      const char *message);
160 void silc_server_send_notify_topic_set(SilcServer server,
161                                        SilcSocketConnection sock,
162                                        bool broadcast,
163                                        SilcChannelEntry channel,
164                                        void *id, SilcIdType id_type,
165                                        char *topic);
166 void silc_server_send_notify_kicked(SilcServer server,
167                                     SilcSocketConnection sock,
168                                     bool broadcast,
169                                     SilcChannelEntry channel,
170                                     SilcClientID *client_id,
171                                     SilcClientID *kicker,
172                                     char *comment);
173 void silc_server_send_notify_killed(SilcServer server,
174                                     SilcSocketConnection sock,
175                                     bool broadcast,
176                                     SilcClientID *client_id,
177                                     const char *comment,
178                                     void *killer, SilcIdType killer_type);
179 void silc_server_send_notify_umode(SilcServer server,
180                                    SilcSocketConnection sock,
181                                    bool broadcast,
182                                    SilcClientID *client_id,
183                                    SilcUInt32 mode_mask);
184 void silc_server_send_notify_ban(SilcServer server,
185                                  SilcSocketConnection sock,
186                                  bool broadcast,
187                                  SilcChannelEntry channel,
188                                  unsigned char *action,
189                                  SilcBuffer list);
190 void silc_server_send_notify_invite(SilcServer server,
191                                     SilcSocketConnection sock,
192                                     bool broadcast,
193                                     SilcChannelEntry channel,
194                                     SilcClientID *client_id,
195                                     unsigned char *action,
196                                     SilcBuffer list);
197 void silc_server_send_notify_watch(SilcServer server,
198                                    SilcSocketConnection sock,
199                                    SilcClientEntry watcher,
200                                    SilcClientEntry client,
201                                    const char *nickname,
202                                    SilcNotifyType type,
203                                    SilcPublicKey public_key);
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 /* PACKET_SEND_H */