diff options
Diffstat (limited to 'src/service/core/gnunet-service-core_kx.h')
-rw-r--r-- | src/service/core/gnunet-service-core_kx.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/service/core/gnunet-service-core_kx.h b/src/service/core/gnunet-service-core_kx.h new file mode 100644 index 000000000..8bcac3f68 --- /dev/null +++ b/src/service/core/gnunet-service-core_kx.h | |||
@@ -0,0 +1,102 @@ | |||
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 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
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 | ||
25 | */ | ||
26 | #ifndef GNUNET_SERVICE_CORE_KX_H | ||
27 | #define GNUNET_SERVICE_CORE_KX_H | ||
28 | |||
29 | #include "gnunet_util_lib.h" | ||
30 | |||
31 | |||
32 | /** | ||
33 | * Information about the status of a key exchange with another peer. | ||
34 | */ | ||
35 | struct GSC_KeyExchangeInfo; | ||
36 | |||
37 | |||
38 | /** | ||
39 | * Encrypt and transmit a message with the given payload. | ||
40 | * | ||
41 | * @param kx key exchange context | ||
42 | * @param payload payload of the message | ||
43 | * @param payload_size number of bytes in 'payload' | ||
44 | */ | ||
45 | void | ||
46 | GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, | ||
47 | const void *payload, | ||
48 | size_t payload_size); | ||
49 | |||
50 | |||
51 | /** | ||
52 | * Initialize KX subsystem. | ||
53 | * | ||
54 | * @param pk private key to use for the peer | ||
55 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
56 | */ | ||
57 | int | ||
58 | GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk); | ||
59 | |||
60 | |||
61 | /** | ||
62 | * Shutdown KX subsystem. | ||
63 | */ | ||
64 | void | ||
65 | GSC_KX_done (void); | ||
66 | |||
67 | |||
68 | /** | ||
69 | * Check if the given neighbour has excess bandwidth available. | ||
70 | * | ||
71 | * @param target neighbour to check | ||
72 | * @return #GNUNET_YES if excess bandwidth is available, #GNUNET_NO if not | ||
73 | */ | ||
74 | int | ||
75 | GSC_NEIGHBOURS_check_excess_bandwidth (const struct | ||
76 | GSC_KeyExchangeInfo *target); | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Check how many messages are queued for the given neighbour. | ||
81 | * | ||
82 | * @param target neighbour to check | ||
83 | * @return number of items in the message queue | ||
84 | */ | ||
85 | unsigned int | ||
86 | GSC_NEIGHBOURS_get_queue_length (const struct GSC_KeyExchangeInfo *target); | ||
87 | |||
88 | |||
89 | /** | ||
90 | * Handle #GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS request. For this | ||
91 | * request type, the client does not have to have transmitted an INIT | ||
92 | * request. All current peers are returned, regardless of which | ||
93 | * message types they accept. | ||
94 | * | ||
95 | * @param mq message queue to add for monitoring | ||
96 | */ | ||
97 | void | ||
98 | GSC_KX_handle_client_monitor_peers (struct GNUNET_MQ_Handle *mq); | ||
99 | |||
100 | |||
101 | #endif | ||
102 | /* end of gnunet-service-core_kx.h */ | ||