5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1997 - 2006 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; version 2 of the License.
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.
20 /****h* silccore/SILC Notify Interface
24 * Implementation of the Notify Payload. Notify Payload is used usually
25 * by servers to send different kind of important notify messages to other
26 * servers and to clients.
33 /****s* silccore/SilcNotifyAPI/SilcNotifyPayload
37 * typedef struct SilcNotifyPayloadStruct *SilcNotifyPayload;
41 * This context is the actual Notify Payload and is allocated
42 * by silc_notify_payload_parse and given as argument usually to
43 * all silc_notify_payload_* functions. It is freed by the
44 * silc_notify_payload_free function.
47 typedef struct SilcNotifyPayloadStruct *SilcNotifyPayload;
49 /****d* silccore/SilcNotifyAPI/SilcNotifyType
53 * typedef SilcUInt16 SilcNotifyType;
57 * The notify type definition and all of the notify types.
61 typedef SilcUInt16 SilcNotifyType;
63 /* SILC notify types. Server may send these notify types to client to
64 notify of some action. */
65 #define SILC_NOTIFY_TYPE_NONE 0 /* no specific type */
66 #define SILC_NOTIFY_TYPE_INVITE 1 /* invites/invite list change */
67 #define SILC_NOTIFY_TYPE_JOIN 2 /* "has joined channel" */
68 #define SILC_NOTIFY_TYPE_LEAVE 3 /* "has left channel" */
69 #define SILC_NOTIFY_TYPE_SIGNOFF 4 /* "signoff" */
70 #define SILC_NOTIFY_TYPE_TOPIC_SET 5 /* "topic has been changed" */
71 #define SILC_NOTIFY_TYPE_NICK_CHANGE 6 /* "has changed nickname" */
72 #define SILC_NOTIFY_TYPE_CMODE_CHANGE 7 /* "has changed channel mode" */
73 #define SILC_NOTIFY_TYPE_CUMODE_CHANGE 8 /* "has change mode" */
74 #define SILC_NOTIFY_TYPE_MOTD 9 /* message of the day */
75 #define SILC_NOTIFY_TYPE_CHANNEL_CHANGE 10 /* Channel's ID has changed */
76 #define SILC_NOTIFY_TYPE_SERVER_SIGNOFF 11 /* Server quitting SILC */
77 #define SILC_NOTIFY_TYPE_KICKED 12 /* Kicked from channel */
78 #define SILC_NOTIFY_TYPE_KILLED 13 /* Killed from the network */
79 #define SILC_NOTIFY_TYPE_UMODE_CHANGE 14 /* user mode was changed */
80 #define SILC_NOTIFY_TYPE_BAN 15 /* ban list change */
81 #define SILC_NOTIFY_TYPE_ERROR 16 /* error notify */
82 #define SILC_NOTIFY_TYPE_WATCH 17 /* watch notify */
87 /****f* silccore/SilcNotifyAPI/silc_notify_payload_parse
92 * silc_notify_payload_parse(const unsigned char *payload,
93 * SilcUInt32 payload_len);
97 * Parse notify payload buffer and return data into payload structure.
98 * The `buffer' is the raw payload data.
101 SilcNotifyPayload silc_notify_payload_parse(const unsigned char *payload,
102 SilcUInt32 payload_len);
104 /****f* silccore/SilcNotifyAPI/silc_notify_payload_encode
108 * SilcBuffer silc_notify_payload_encode(SilcNotifyType type,
114 * Encode notify payload with variable argument list. If `argc' is > 0
115 * argument payloads will be associated to the notify payload. Variable
116 * arguments must be {unsigned char *, SilcUInt32 (len)}.
119 SilcBuffer silc_notify_payload_encode(SilcNotifyType type, SilcUInt32 argc,
122 /****f* silccore/SilcNotifyAPI/silc_notify_payload_encode_args
126 * SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
132 * Same as silc_notify_payload_encode but takes arguments from the `args'
133 * encoded Argument Payload buffer.
136 SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
140 /****f* silccore/SilcNotifyAPI/silc_notify_payload_free
144 * void silc_notify_payload_free(SilcNotifyPayload payload);
148 * Frees the Notify Payload and all data in it.
151 void silc_notify_payload_free(SilcNotifyPayload payload);
153 /****f* silccore/SilcNotifyAPI/silc_notify_get_type
157 * SilcNotifyType silc_notify_get_type(SilcNotifyPayload payload);
161 * Return the notify type from the payload.
164 SilcNotifyType silc_notify_get_type(SilcNotifyPayload payload);
166 /****f* silccore/SilcNotifyAPI/silc_notify_get_arg_num
170 * SilcUInt32 silc_notify_get_arg_num(SilcNotifyPayload payload);
174 * Return the number of the arguments associated with the Notify Payload.
177 SilcUInt32 silc_notify_get_arg_num(SilcNotifyPayload payload);
179 /****f* silccore/SilcNotifyAPI/silc_notify_get_args
183 * SilcArgumentPayload silc_notify_get_args(SilcNotifyPayload payload);
187 * Return the Argument Payload containing the arguments from the
188 * Notify Payload. The caller must not free it.
191 SilcArgumentPayload silc_notify_get_args(SilcNotifyPayload payload);