glitch in the license text detected by hyazinthe, thank you!
[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
16 /**
17  * @file core/gnunet-service-core_kx.h
18  * @brief code for managing the key exchange (SET_KEY, PING, PONG) with other peers
19  * @author Christian Grothoff
20  */
21 #ifndef GNUNET_SERVICE_CORE_KX_H
22 #define GNUNET_SERVICE_CORE_KX_H
23
24 #include "gnunet_util_lib.h"
25 #include "gnunet_transport_service.h"
26
27
28 /**
29  * Information about the status of a key exchange with another peer.
30  */
31 struct GSC_KeyExchangeInfo;
32
33
34 /**
35  * Encrypt and transmit a message with the given payload.
36  *
37  * @param kx key exchange context
38  * @param payload payload of the message
39  * @param payload_size number of bytes in 'payload'
40  */
41 void
42 GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
43                              const void *payload,
44                              size_t payload_size);
45
46
47 /**
48  * Initialize KX subsystem.
49  *
50  * @param pk private key to use for the peer
51  * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
52  */
53 int
54 GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk);
55
56
57 /**
58  * Shutdown KX subsystem.
59  */
60 void
61 GSC_KX_done (void);
62
63
64 /**
65  * Check if the given neighbour has excess bandwidth available.
66  *
67  * @param target neighbour to check
68  * @return #GNUNET_YES if excess bandwidth is available, #GNUNET_NO if not
69  */
70 int
71 GSC_NEIGHBOURS_check_excess_bandwidth (const struct GSC_KeyExchangeInfo *target);
72
73
74 /**
75  * Check how many messages are queued for the given neighbour.
76  *
77  * @param target neighbour to check
78  * @return number of items in the message queue
79  */
80 unsigned int
81 GSC_NEIGHBOURS_get_queue_length (const struct GSC_KeyExchangeInfo *target);
82
83
84 /**
85  * Handle #GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS request.  For this
86  * request type, the client does not have to have transmitted an INIT
87  * request.  All current peers are returned, regardless of which
88  * message types they accept.
89  *
90  * @param mq message queue to add for monitoring
91  */
92 void
93 GSC_KX_handle_client_monitor_peers (struct GNUNET_MQ_Handle *mq);
94
95
96 #endif
97 /* end of gnunet-service-core_kx.h */