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/SilcPrivateAPI
25 * Implementation of the SILC Private Message Payload that is used to
26 * deliver private messages.
33 /****s* silccore/SilcPrivateAPI/SilcPrivateMessagePayload
37 * typedef struct SilcPrivateMessagePayloadStruct
38 * *SilcPrivateMessagePayload;
43 * This context is the actual Private Message Payload and is allocated
44 * by silc_private_message_payload_parse and given as argument usually
45 * to all silc_private_message_* functions. It is freed by the
46 * silc_private_message_payload_free function.
49 typedef struct SilcPrivateMessagePayloadStruct *SilcPrivateMessagePayload;
53 /****f* silccore/SilcPrivateAPI/silc_private_message_payload_parse
57 * SilcPrivateMessagePayload
58 * silc_private_message_payload_parse(unsigned char *payload,
59 * SilcUInt32 payload_len,
64 * Parses private message payload returning new private mesage payload
65 * structure. This also decrypts the message if the `cipher' is provided.
68 SilcPrivateMessagePayload
69 silc_private_message_payload_parse(unsigned char *payload,
70 SilcUInt32 payload_len,
73 /****f* silccore/SilcPrivateAPI/silc_private_message_payload_encode
77 * SilcBuffer silc_private_message_payload_encode(SilcUInt16 flags,
78 * SilcUInt16 data_len,
79 * const unsigned char *data,
84 * Encodes private message payload into a buffer and returns it. If
85 * the cipher is provided the packet is also encrypted here. It is provided
86 * if the private message private keys are used.
89 SilcBuffer silc_private_message_payload_encode(SilcUInt16 flags,
91 const unsigned char *data,
94 /****f* silccore/SilcPrivateAPI/silc_private_message_payload_free
99 * silc_private_message_payload_free(SilcPrivateMessagePayload payload);
103 * Frees Private Message Payload
106 void silc_private_message_payload_free(SilcPrivateMessagePayload payload);
108 /****f* silccore/SilcPrivateAPI/silc_private_message_get_flags
113 * silc_private_message_get_flags(SilcPrivateMessagePayload payload);
117 * Returns flags from the payload. Message flags may indicate some
118 * status of the message. Private message flags are equivalent to the
119 * channel message flags.
123 silc_private_message_get_flags(SilcPrivateMessagePayload payload);
125 /****f* silccore/SilcPrivateAPI/silc_private_message_get_message
130 * silc_private_message_get_nickname(SilcPrivateMessagePayload payload,
131 * SilcUInt32 *nickname_len);
135 * Returns the actual private message. The caller must not free it.
139 silc_private_message_get_message(SilcPrivateMessagePayload payload,
140 SilcUInt32 *message_len);