5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1997 - 2002 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 #ifndef SILCCHANNEL_I_H
21 #define SILCCHANNEL_I_H
24 #error "Do not include internal header file directly"
27 /******************************************************************************
31 ******************************************************************************/
33 /* Channel Message Payload structure. Contents of this structure is parsed
35 struct SilcChannelPayloadStruct {
36 unsigned char *channel_name;
37 unsigned char *channel_id;
44 /******************************************************************************
46 Channel Message Payload
48 ******************************************************************************/
50 /* Calculates padding length for message payload */
51 #define SILC_CHANNEL_MESSAGE_PAD(__payloadlen) (16 - ((__payloadlen) % 16))
53 /* Header length plus maximum padding length */
54 #define SILC_CHANNEL_MESSAGE_HLEN 6 + 16
56 /* Returns the data length that fits to the packet. If data length is too
57 big it will be truncated to fit to the payload. */
58 #define SILC_CHANNEL_MESSAGE_DATALEN(data_len, header_len) \
59 ((data_len + SILC_CHANNEL_MESSAGE_HLEN + header_len) > \
60 SILC_PACKET_MAX_LEN ? \
61 data_len - ((data_len + SILC_CHANNEL_MESSAGE_HLEN + header_len) - \
62 SILC_PACKET_MAX_LEN) : data_len)
64 /* Channel Message Payload structure. Contents of this structure is parsed
66 struct SilcChannelMessagePayloadStruct {
71 SilcMessageFlags flags;
78 /******************************************************************************
82 ******************************************************************************/
84 /* Channel Key Payload structrue. Channel keys are parsed from SILC
85 packets into this structure. */
86 struct SilcChannelKeyPayloadStruct {
88 unsigned char *cipher;
91 SilcUInt16 cipher_len;
95 #endif /* SILCCHANNEL_I_H */