updates.
[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                                      SilcClientEntry *clients,
64                                      SilcUInt32 clients_count,
65                                      SilcPacketType type, 
66                                      SilcPacketFlags flags,
67                                      bool route,
68                                      unsigned char *data, 
69                                      SilcUInt32 data_len,
70                                      bool force_send);
71 void silc_server_packet_send_to_channel(SilcServer server,
72                                         SilcSocketConnection sender,
73                                         SilcChannelEntry channel,
74                                         SilcPacketType type,
75                                         bool route,
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                                    char *cipher, char *hmac,
145                                    char *passphrase);
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 void silc_server_send_notify_signoff(SilcServer server,
154                                      SilcSocketConnection sock,
155                                      bool broadcast,
156                                      SilcClientID *client_id,
157                                      const char *message);
158 void silc_server_send_notify_topic_set(SilcServer server,
159                                        SilcSocketConnection sock,
160                                        bool broadcast,
161                                        SilcChannelEntry channel,
162                                        void *id, SilcIdType id_type,
163                                        char *topic);
164 void silc_server_send_notify_kicked(SilcServer server,
165                                     SilcSocketConnection sock,
166                                     bool broadcast,
167                                     SilcChannelEntry channel,
168                                     SilcClientID *client_id,
169                                     SilcClientID *kicker,
170                                     char *comment);
171 void silc_server_send_notify_killed(SilcServer server,
172                                     SilcSocketConnection sock,
173                                     bool broadcast,
174                                     SilcClientID *client_id,
175                                     const char *comment,
176                                     void *killer, SilcIdType killer_type);
177 void silc_server_send_notify_umode(SilcServer server,
178                                    SilcSocketConnection sock,
179                                    bool broadcast,
180                                    SilcClientID *client_id,
181                                    SilcUInt32 mode_mask);
182 void silc_server_send_notify_ban(SilcServer server,
183                                  SilcSocketConnection sock,
184                                  bool broadcast,
185                                  SilcChannelEntry channel,
186                                  char *add, char *del);
187 void silc_server_send_notify_invite(SilcServer server,
188                                     SilcSocketConnection sock,
189                                     bool broadcast,
190                                     SilcChannelEntry channel,
191                                     SilcClientID *client_id,
192                                     char *add, char *del);
193 void silc_server_send_notify_dest(SilcServer server,
194                                   SilcSocketConnection sock,
195                                   bool broadcast,
196                                   void *dest_id,
197                                   SilcIdType dest_id_type,
198                                   SilcNotifyType type,
199                                   SilcUInt32 argc, ...);
200 void silc_server_send_notify_to_channel(SilcServer server,
201                                         SilcSocketConnection sender,
202                                         SilcChannelEntry channel,
203                                         bool route_notify,
204                                         SilcNotifyType type,
205                                         SilcUInt32 argc, ...);
206 void silc_server_send_notify_on_channels(SilcServer server,
207                                          SilcClientEntry sender,
208                                          SilcClientEntry client,
209                                          SilcNotifyType type,
210                                          SilcUInt32 argc, ...);
211 void silc_server_send_new_id(SilcServer server,
212                              SilcSocketConnection sock,
213                              bool broadcast,
214                              void *id, SilcIdType id_type, 
215                              SilcUInt32 id_len);
216 void silc_server_send_new_channel(SilcServer server,
217                                   SilcSocketConnection sock,
218                                   bool broadcast,
219                                   char *channel_name,
220                                   void *channel_id, 
221                                   SilcUInt32 channel_id_len,
222                                   SilcUInt32 mode);
223 void silc_server_send_channel_key(SilcServer server,
224                                   SilcSocketConnection sender,
225                                   SilcChannelEntry channel,
226                                   unsigned char route);
227 void silc_server_send_command(SilcServer server, 
228                               SilcSocketConnection sock,
229                               SilcCommand command, 
230                               SilcUInt16 ident,
231                               SilcUInt32 argc, ...);
232 void silc_server_send_command_reply(SilcServer server, 
233                                     SilcSocketConnection sock,
234                                     SilcCommand command, 
235                                     SilcCommandStatus status,
236                                     SilcCommandStatus error,
237                                     SilcUInt16 ident,
238                                     SilcUInt32 argc, ...);
239 void silc_server_send_dest_command_reply(SilcServer server, 
240                                          SilcSocketConnection sock,
241                                          void *dst_id,
242                                          SilcIdType dst_id_type,
243                                          SilcCommand command, 
244                                          SilcCommandStatus status,
245                                          SilcCommandStatus error,
246                                          SilcUInt16 ident,
247                                          SilcUInt32 argc, ...);
248 void silc_server_send_heartbeat(SilcServer server,
249                                 SilcSocketConnection sock);
250 void silc_server_relay_packet(SilcServer server,
251                               SilcSocketConnection dst_sock,
252                               SilcCipher cipher,
253                               SilcHmac hmac,
254                               SilcUInt32 sequence,
255                               SilcPacketContext *packet,
256                               bool force_send);
257 void silc_server_send_connection_auth_request(SilcServer server,
258                                               SilcSocketConnection sock,
259                                               SilcUInt16 conn_type,
260                                               SilcAuthMethod auth_meth);
261 void silc_server_packet_queue_purge(SilcServer server,
262                                     SilcSocketConnection sock);
263
264 #endif