2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2011 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @file core/gnunet-service-core_kx.h
23 * @brief code for managing the key exchange (SET_KEY, PING, PONG) with other peers
24 * @author Christian Grothoff
26 #ifndef GNUNET_SERVICE_CORE_KX_H
27 #define GNUNET_SERVICE_CORE_KX_H
29 #include "gnunet_util_lib.h"
30 #include "gnunet_transport_service.h"
34 * Information about the status of a key exchange with another peer.
36 struct GSC_KeyExchangeInfo;
40 * Encrypt and transmit a message with the given payload.
42 * @param kx key exchange context
43 * @param payload payload of the message
44 * @param payload_size number of bytes in 'payload'
47 GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
53 * Initialize KX subsystem.
55 * @param pk private key to use for the peer
56 * @param server the server of the CORE service
57 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
60 GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk,
61 struct GNUNET_SERVER_Handle *server);
65 * Shutdown KX subsystem.
72 * Check if the given neighbour has excess bandwidth available.
74 * @param target neighbour to check
75 * @return #GNUNET_YES if excess bandwidth is available, #GNUNET_NO if not
78 GSC_NEIGHBOURS_check_excess_bandwidth (const struct GSC_KeyExchangeInfo *target);
82 * Check how many messages are queued for the given neighbour.
84 * @param target neighbour to check
85 * @return number of items in the message queue
88 GSC_NEIGHBOURS_get_queue_length (const struct GSC_KeyExchangeInfo *target);
92 * Handle #GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS request. For this
93 * request type, the client does not have to have transmitted an INIT
94 * request. All current peers are returned, regardless of which
95 * message types they accept.
98 * @param client client sending the iteration request
99 * @param message iteration request message
102 GSC_KX_handle_client_monitor_peers (void *cls,
103 struct GNUNET_SERVER_Client *client,
104 const struct GNUNET_MessageHeader *message);
108 /* end of gnunet-service-core_kx.h */