5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
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.
24 #include "silcdlist.h"
26 /* Forward declaration for Channel Payload parsed from packet. The
27 actual structure is defined in source file and is private data. */
28 typedef struct SilcChannelPayloadStruct *SilcChannelPayload;
30 /* Forward declaration for Channel Message Payload parsed from packet. The
31 actual structure is defined in source file and is private data. */
32 typedef struct SilcChannelMessagePayloadStruct *SilcChannelMessagePayload;
34 /* Forward declaration for Channel Key Payload parsed from packet. The
35 actual structure is defined in source file and is private data. */
36 typedef struct SilcChannelKeyPayloadStruct *SilcChannelKeyPayload;
38 /* The Message flag type */
39 typedef unsigned short SilcMessageFlags;
41 /* The message flags (shared by both channel and private messages) */
42 #define SILC_MESSAGE_FLAG_NONE 0x0000
43 #define SILC_MESSAGE_FLAG_AUTOREPLY 0x0001
44 #define SILC_MESSAGE_FLAG_NOREPLY 0x0002
45 #define SILC_MESSAGE_FLAG_ACTION 0x0004
46 #define SILC_MESSAGE_FLAG_NOTICE 0x0008
47 #define SILC_MESSAGE_FLAG_REQUEST 0x0010
48 #define SILC_MESSAGE_FLAG_RESERVED 0x0020 /* to 0x0200 */
49 #define SILC_MESSAGE_FLAG_PRIVATE 0x0400 /* to 0x8000 */
52 SilcChannelPayload silc_channel_payload_parse(SilcBuffer buffer);
53 SilcDList silc_channel_payload_parse_list(SilcBuffer buffer);
54 SilcBuffer silc_channel_payload_encode(unsigned char *channel_name,
55 unsigned short channel_name_len,
56 unsigned char *channel_id,
57 unsigned int channel_id_len,
59 void silc_channel_payload_free(SilcChannelPayload payload);
60 void silc_channel_payload_list_free(SilcDList list);
61 unsigned char *silc_channel_get_name(SilcChannelPayload payload,
62 unsigned int *channel_name_len);
63 unsigned char *silc_channel_get_id(SilcChannelPayload payload,
64 unsigned int *channel_id_len);
65 SilcChannelID *silc_channel_get_id_parse(SilcChannelPayload payload);
66 unsigned int silc_channel_get_mode(SilcChannelPayload payload);
67 int silc_channel_message_payload_decrypt(unsigned char *data,
71 SilcChannelMessagePayload
72 silc_channel_message_payload_parse(SilcBuffer buffer,
75 SilcBuffer silc_channel_message_payload_encode(unsigned short flags,
76 unsigned short data_len,
78 unsigned short iv_len,
82 void silc_channel_message_payload_free(SilcChannelMessagePayload payload);
84 silc_channel_message_get_flags(SilcChannelMessagePayload payload);
85 unsigned char *silc_channel_message_get_data(SilcChannelMessagePayload payload,
86 unsigned int *data_len);
87 unsigned char *silc_channel_message_get_mac(SilcChannelMessagePayload payload);
88 unsigned char *silc_channel_message_get_iv(SilcChannelMessagePayload payload);
89 SilcChannelKeyPayload silc_channel_key_payload_parse(SilcBuffer buffer);
90 SilcBuffer silc_channel_key_payload_encode(unsigned short id_len,
92 unsigned short cipher_len,
93 unsigned char *cipher,
94 unsigned short key_len,
96 void silc_channel_key_payload_free(SilcChannelKeyPayload payload);
97 unsigned char *silc_channel_key_get_id(SilcChannelKeyPayload payload,
98 unsigned int *id_len);
99 unsigned char *silc_channel_key_get_cipher(SilcChannelKeyPayload payload,
100 unsigned int *cipher_len);
101 unsigned char *silc_channel_key_get_key(SilcChannelKeyPayload payload,
102 unsigned int *key_len);