#include "command.h"
#include "silcapi.h"
+/* Generic rekey context for connections */
+typedef struct {
+ /* Current sending encryption key, provided for re-key. The `pfs'
+ is TRUE if the Perfect Forward Secrecy is performed in re-key. */
+ unsigned char *send_enc_key;
+ uint32 enc_key_len;
+ int ske_group;
+ bool pfs;
+ uint32 timeout;
+ void *context;
+} *SilcClientRekey;
+
/* Connection structure used in client to associate all the important
connection specific data to this structure. */
struct SilcClientConnectionStruct {
/* Keys and stuff negotiated in the SKE protocol */
SilcCipher send_key;
SilcCipher receive_key;
- SilcHmac hmac;
- unsigned char *hmac_key;
- uint32 hmac_key_len;
+ SilcHmac hmac_send;
+ SilcHmac hmac_receive;
SilcHash hash;
/* Client ID and Channel ID cache. Messages transmitted in SILC network
/* Set away message */
SilcClientAway *away;
+ /* Re-key context */
+ SilcClientRekey rekey;
+
/* Pointer back to the SilcClient. This object is passed to the application
and the actual client object is accesible through this pointer. */
SilcClient client;
/* All client operations that are implemented in the application. */
SilcClientOperations *ops;
- /* SILC client task queues */
+ /* SILC client scheduler and task queues */
+ SilcSchedule schedule;
SilcTaskQueue io_queue;
SilcTaskQueue timeout_queue;
SilcTaskQueue generic_queue;
silc_task_set_iotype(tmptask, SILC_TASK_WRITE); \
} while(0)
-#define SILC_CLIENT_SET_CONNECTION_FOR_INPUT(fd) \
-do { \
- silc_schedule_set_listen_fd((fd), (1L << SILC_TASK_READ)); \
-} while(0) \
+#define SILC_CLIENT_SET_CONNECTION_FOR_INPUT(s, fd) \
+do { \
+ silc_schedule_set_listen_fd((s), (fd), (1L << SILC_TASK_READ)); \
+} while(0)
-#define SILC_CLIENT_SET_CONNECTION_FOR_OUTPUT(fd) \
-do { \
- silc_schedule_set_listen_fd((fd), ((1L << SILC_TASK_READ) | \
- (1L << SILC_TASK_WRITE))); \
+#define SILC_CLIENT_SET_CONNECTION_FOR_OUTPUT(s, fd) \
+do { \
+ silc_schedule_set_listen_fd((s), (fd), ((1L << SILC_TASK_READ) | \
+ (1L << SILC_TASK_WRITE))); \
} while(0)
/* Finds socket connection object by file descriptor */
(__sock) = (__x)->conns[__i]->sock; \
} while(0)
+/* Check whether rekey protocol is active */
+#define SILC_CLIENT_IS_REKEY(sock) \
+ (sock->protocol && sock->protocol->protocol && \
+ sock->protocol->protocol->type == SILC_PROTOCOL_CLIENT_REKEY)
+
/* Prototypes (some of the prototypes are defined in the silcapi.h) */
void silc_client_packet_send(SilcClient client,
SilcClientConnection conn,
SilcClientEntry old,
SilcClientEntry new);
-char *silc_client_chmode(uint32 mode, SilcChannelEntry channel);
-char *silc_client_chumode(uint32 mode);
-char *silc_client_chumode_char(uint32 mode);
void silc_client_process_failure(SilcClient client,
SilcSocketConnection sock,
SilcPacketContext *packet);
void silc_client_private_message(SilcClient client,
SilcSocketConnection sock,
SilcPacketContext *packet);
+
#endif