paragraph for gnunet devs that don't know how to use the web
[oweals/gnunet.git] / src / core / gnunet-service-core_kx.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009, 2010, 2011 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your option) any later version.
9
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      Affero General Public License for more details.
14     
15      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /**
20  * @file core/gnunet-service-core_kx.h
21  * @brief code for managing the key exchange (SET_KEY, PING, PONG) with other peers
22  * @author Christian Grothoff
23  */
24 #ifndef GNUNET_SERVICE_CORE_KX_H
25 #define GNUNET_SERVICE_CORE_KX_H
26
27 #include "gnunet_util_lib.h"
28 #include "gnunet_transport_service.h"
29
30
31 /**
32  * Information about the status of a key exchange with another peer.
33  */
34 struct GSC_KeyExchangeInfo;
35
36
37 /**
38  * Encrypt and transmit a message with the given payload.
39  *
40  * @param kx key exchange context
41  * @param payload payload of the message
42  * @param payload_size number of bytes in 'payload'
43  */
44 void
45 GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
46                              const void *payload,
47                              size_t payload_size);
48
49
50 /**
51  * Initialize KX subsystem.
52  *
53  * @param pk private key to use for the peer
54  * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
55  */
56 int
57 GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk);
58
59
60 /**
61  * Shutdown KX subsystem.
62  */
63 void
64 GSC_KX_done (void);
65
66
67 /**
68  * Check if the given neighbour has excess bandwidth available.
69  *
70  * @param target neighbour to check
71  * @return #GNUNET_YES if excess bandwidth is available, #GNUNET_NO if not
72  */
73 int
74 GSC_NEIGHBOURS_check_excess_bandwidth (const struct GSC_KeyExchangeInfo *target);
75
76
77 /**
78  * Check how many messages are queued for the given neighbour.
79  *
80  * @param target neighbour to check
81  * @return number of items in the message queue
82  */
83 unsigned int
84 GSC_NEIGHBOURS_get_queue_length (const struct GSC_KeyExchangeInfo *target);
85
86
87 /**
88  * Handle #GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS request.  For this
89  * request type, the client does not have to have transmitted an INIT
90  * request.  All current peers are returned, regardless of which
91  * message types they accept.
92  *
93  * @param mq message queue to add for monitoring
94  */
95 void
96 GSC_KX_handle_client_monitor_peers (struct GNUNET_MQ_Handle *mq);
97
98
99 #endif
100 /* end of gnunet-service-core_kx.h */