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.
24 #error "Do not include this header directly"
27 /* Forward declarations */
28 typedef struct SilcClientStruct *SilcClient;
29 typedef struct SilcClientConnectionStruct *SilcClientConnection;
30 typedef struct SilcClientEntryStruct *SilcClientEntry;
31 typedef struct SilcChannelEntryStruct *SilcChannelEntry;
32 typedef struct SilcServerEntryStruct *SilcServerEntry;
34 typedef struct SilcClientAwayStruct SilcClientAway;
35 typedef struct SilcClientKeyAgreementStruct *SilcClientKeyAgreement;
36 typedef struct SilcClientFtpSessionStruct *SilcClientFtpSession;
37 typedef struct SilcClientCommandReplyContextStruct
38 *SilcClientCommandReplyContext;
39 typedef struct SilcChannelUserStruct *SilcChannelUser;
40 typedef struct SilcClientInternalStruct *SilcClientInternal;
41 typedef struct SilcClientConnectionInternalStruct
42 *SilcClientConnectionInternal;
43 typedef struct SilcChannelPrivateKeyStruct *SilcChannelPrivateKey;
46 /* Internal client entry context */
47 typedef struct SilcClientEntryInternalStruct {
48 SilcCipher send_key; /* Private message key for sending */
49 SilcCipher receive_key; /* Private message key for receiving */
50 SilcHmac hmac_send; /* Private mesage key HMAC for sending */
51 SilcHmac hmac_receive; /* Private mesage key HMAC for receiving */
52 unsigned char *key; /* Valid if application provided the key */
53 SilcUInt32 key_len; /* Key data length */
54 SilcClientKeyAgreement ke; /* Current key agreement context or NULL */
57 unsigned int valid : 1; /* FALSE if this entry is not valid */
58 unsigned int resolving : 1; /* TRUE when entry is being resolved */
59 unsigned int generated : 1; /* TRUE if library generated `key' */
60 unsigned int prv_resp : 1; /* TRUE if we are responder when using
61 private message keys. */
62 SilcUInt16 resolve_cmd_ident; /* Command identifier when resolving */
63 SilcAtomic8 refcnt; /* Reference counter */
64 } SilcClientEntryInternal;
66 /* Internal channel entry context */
67 typedef struct SilcChannelEntryInternalStruct {
68 /* SilcChannelEntry status information */
69 SilcDList old_channel_keys;
72 /* Channel private keys */
73 SilcDList private_keys; /* List of private keys or NULL */
74 SilcChannelPrivateKey curr_key; /* Current private key */
77 SilcCipher channel_key; /* The channel key */
78 SilcHmac hmac; /* Current HMAC */
79 unsigned char iv[SILC_CIPHER_MAX_IV_SIZE]; /* Current IV */
81 SilcUInt16 resolve_cmd_ident; /* Channel information resolving
82 identifier. This is used when
83 resolving users, and other
84 stuff that relates to the
85 channel. Not used for the
86 channel resolving itself. */
87 SilcAtomic16 refcnt; /* Reference counter */
88 } SilcChannelEntryInternal;
90 /* Internal server entry context */
91 typedef struct SilcServerEntryInternalStruct {
92 SilcUInt16 resolve_cmd_ident; /* Resolving identifier */
93 SilcAtomic8 refcnt; /* Reference counter */
94 } SilcServerEntryInternal;