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 SILCPRIVATE_I_H
21 #define SILCPRIVATE_I_H
24 #error "Do not include internal header file directly"
27 /******************************************************************************
29 Private Message Payload
31 ******************************************************************************/
33 /* Calculates padding length for message payload */
34 #define SILC_PRIVATE_MESSAGE_PAD(__payloadlen) (16 - ((__payloadlen) % 16))
36 /* Header length plus maximum padding length */
37 #define SILC_PRIVATE_MESSAGE_HLEN 4 + 16
39 /* Returns the data length that fits to the packet. If data length is too
40 big it will be truncated to fit to the payload. */
41 #define SILC_PRIVATE_MESSAGE_DATALEN(data_len) \
42 ((data_len + SILC_PRIVATE_MESSAGE_HLEN) > SILC_PACKET_MAX_LEN ? \
43 data_len - ((data_len + SILC_PRIVATE_MESSAGE_HLEN) - \
44 SILC_PACKET_MAX_LEN) : data_len)
46 /* Private Message Payload structure. Contents of this structure is parsed
48 struct SilcPrivateMessagePayloadStruct {
50 SilcUInt16 message_len;
51 unsigned char *message;
56 #endif /* SILCPRIVATE_I_H */