5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1997 - 2001 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 /****h* silccore/SILC Notify Interface
25 * Implementation of the Notify Payload. Notify Payload is used usually
26 * by servers to send different kind of important notify messages to other
27 * servers and to clients.
34 /****s* silccore/SilcNotifyAPI/SilcNotifyPayload
38 * typedef struct SilcNotifyPayloadStruct *SilcNotifyPayload;
42 * This context is the actual Notify Payload and is allocated
43 * by silc_notify_payload_parse and given as argument usually to
44 * all silc_notify_payload_* functions. It is freed by the
45 * silc_notify_payload_free function.
48 typedef struct SilcNotifyPayloadStruct *SilcNotifyPayload;
50 /****d* silccore/SilcNotifyAPI/SilcNotifyType
54 * typedef SilcUInt16 SilcNotifyType;
58 * The notify type definition and all of the notify types.
62 typedef SilcUInt16 SilcNotifyType;
64 /* SILC notify types. Server may send these notify types to client to
65 notify of some action. */
66 #define SILC_NOTIFY_TYPE_NONE 0 /* no specific type */
67 #define SILC_NOTIFY_TYPE_INVITE 1 /* invites/invite list change */
68 #define SILC_NOTIFY_TYPE_JOIN 2 /* "has joined channel" */
69 #define SILC_NOTIFY_TYPE_LEAVE 3 /* "has left channel" */
70 #define SILC_NOTIFY_TYPE_SIGNOFF 4 /* "signoff" */
71 #define SILC_NOTIFY_TYPE_TOPIC_SET 5 /* "topic has been changed" */
72 #define SILC_NOTIFY_TYPE_NICK_CHANGE 6 /* "has changed nickname" */
73 #define SILC_NOTIFY_TYPE_CMODE_CHANGE 7 /* "has changed channel mode" */
74 #define SILC_NOTIFY_TYPE_CUMODE_CHANGE 8 /* "has change mode" */
75 #define SILC_NOTIFY_TYPE_MOTD 9 /* message of the day */
76 #define SILC_NOTIFY_TYPE_CHANNEL_CHANGE 10 /* Channel's ID has changed */
77 #define SILC_NOTIFY_TYPE_SERVER_SIGNOFF 11 /* Server quitting SILC */
78 #define SILC_NOTIFY_TYPE_KICKED 12 /* Kicked from channel */
79 #define SILC_NOTIFY_TYPE_KILLED 13 /* Killed from the network */
80 #define SILC_NOTIFY_TYPE_UMODE_CHANGE 14 /* user mode was changed */
81 #define SILC_NOTIFY_TYPE_BAN 15 /* ban list change */
82 #define SILC_NOTIFY_TYPE_ERROR 16 /* error notify */
83 #define SILC_NOTIFY_TYPE_WATCH 17 /* watch notify */
88 /****f* silccore/SilcNotifyAPI/silc_notify_payload_parse
93 * silc_notify_payload_parse(const unsigned char *payload,
94 * SilcUInt32 payload_len);
98 * Parse notify payload buffer and return data into payload structure.
99 * The `buffer' is the raw payload data.
102 SilcNotifyPayload silc_notify_payload_parse(const unsigned char *payload,
103 SilcUInt32 payload_len);
105 /****f* silccore/SilcNotifyAPI/silc_notify_payload_encode
109 * SilcBuffer silc_notify_payload_encode(SilcNotifyType type,
115 * Encode notify payload with variable argument list. If `argc' is > 0
116 * argument payloads will be associated to the notify payload. Variable
117 * arguments must be {unsigned char *, SilcUInt32 (len)}.
120 SilcBuffer silc_notify_payload_encode(SilcNotifyType type, SilcUInt32 argc,
123 /****f* silccore/SilcNotifyAPI/silc_notify_payload_encode_args
127 * SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
133 * Same as silc_notify_payload_encode but takes arguments from the `args'
134 * encoded Argument Payload buffer.
137 SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
141 /****f* silccore/SilcNotifyAPI/silc_notify_payload_free
145 * void silc_notify_payload_free(SilcNotifyPayload payload);
149 * Frees the Notify Payload and all data in it.
152 void silc_notify_payload_free(SilcNotifyPayload payload);
154 /****f* silccore/SilcNotifyAPI/silc_notify_get_type
158 * SilcNotifyType silc_notify_get_type(SilcNotifyPayload payload);
162 * Return the notify type from the payload.
165 SilcNotifyType silc_notify_get_type(SilcNotifyPayload payload);
167 /****f* silccore/SilcNotifyAPI/silc_notify_get_arg_num
171 * SilcUInt32 silc_notify_get_arg_num(SilcNotifyPayload payload);
175 * Return the number of the arguments associated with the Notify Payload.
178 SilcUInt32 silc_notify_get_arg_num(SilcNotifyPayload payload);
180 /****f* silccore/SilcNotifyAPI/silc_notify_get_args
184 * SilcArgumentPayload silc_notify_get_args(SilcNotifyPayload payload);
188 * Return the Argument Payload containing the arguments from the
189 * Notify Payload. The caller must not free it.
192 SilcArgumentPayload silc_notify_get_args(SilcNotifyPayload payload);