aboutsummaryrefslogtreecommitdiff
path: root/src/core/gnunet-service-core_kx.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-26 21:12:56 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-26 21:12:56 +0000
commit8c2dc7d19810d58f23c43bf900e2fb3eebe06fed (patch)
tree9173a966e2f51a34d9259a0126484e05d44dcaac /src/core/gnunet-service-core_kx.h
parenta89ea716333ad5ad43757a946efc01cb5e95a0c0 (diff)
downloadgnunet-8c2dc7d19810d58f23c43bf900e2fb3eebe06fed.tar.gz
gnunet-8c2dc7d19810d58f23c43bf900e2fb3eebe06fed.zip
-converting CORE service to new transport MQ API
Diffstat (limited to 'src/core/gnunet-service-core_kx.h')
-rw-r--r--src/core/gnunet-service-core_kx.h96
1 files changed, 21 insertions, 75 deletions
diff --git a/src/core/gnunet-service-core_kx.h b/src/core/gnunet-service-core_kx.h
index 7649315ce..8614f090f 100644
--- a/src/core/gnunet-service-core_kx.h
+++ b/src/core/gnunet-service-core_kx.h
@@ -37,50 +37,6 @@ struct GSC_KeyExchangeInfo;
37 37
38 38
39/** 39/**
40 * Obtain the array of message handlers provided by KX.
41 *
42 * @return NULL-entry terminated array of handlers
43 */
44const struct GNUNET_MQ_MessageHandler *
45GSC_KX_get_handlers (void);
46
47
48/**
49 * We received a EPHEMERAL_KEY message. Validate and update
50 * our key material and status.
51 *
52 * @param kx key exchange status for the corresponding peer
53 * @param msg the set key message we received
54 */
55void
56GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
57 const struct GNUNET_MessageHeader *msg);
58
59
60/**
61 * We received a PING message. Validate and transmit
62 * a PONG message.
63 *
64 * @param kx key exchange status for the corresponding peer
65 * @param msg the encrypted PING message itself
66 */
67void
68GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx,
69 const struct GNUNET_MessageHeader *msg);
70
71
72/**
73 * We received a PONG message. Validate and update our status.
74 *
75 * @param kx key exchange status for the corresponding peer
76 * @param msg the encrypted PONG message itself
77 */
78void
79GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx,
80 const struct GNUNET_MessageHeader *msg);
81
82
83/**
84 * Encrypt and transmit a message with the given payload. 40 * Encrypt and transmit a message with the given payload.
85 * 41 *
86 * @param kx key exchange context 42 * @param kx key exchange context
@@ -89,57 +45,47 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx,
89 */ 45 */
90void 46void
91GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, 47GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
92 const void *payload, size_t payload_size); 48 const void *payload,
49 size_t payload_size);
93 50
94 51
95/** 52/**
96 * We received an encrypted message. Decrypt, validate and 53 * Initialize KX subsystem.
97 * pass on to the appropriate clients.
98 *
99 * @param kx key exchange information context
100 * @param msg encrypted message
101 */
102void
103GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
104 const struct GNUNET_MessageHeader *msg);
105
106
107/**
108 * Start the key exchange with the given peer.
109 * 54 *
110 * @param pid identity of the peer to do a key exchange with 55 * @param pk private key to use for the peer
111 * @return key exchange information context 56 * @param server the server of the CORE service
57 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
112 */ 58 */
113struct GSC_KeyExchangeInfo * 59int
114GSC_KX_start (const struct GNUNET_PeerIdentity *pid); 60GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk,
61 struct GNUNET_SERVER_Handle *server);
115 62
116 63
117/** 64/**
118 * Stop key exchange with the given peer. Clean up key material. 65 * Shutdown KX subsystem.
119 *
120 * @param kx key exchange to stop
121 */ 66 */
122void 67void
123GSC_KX_stop (struct GSC_KeyExchangeInfo *kx); 68GSC_KX_done (void);
124 69
125 70
126/** 71/**
127 * Initialize KX subsystem. 72 * Check if the given neighbour has excess bandwidth available.
128 * 73 *
129 * @param pk private key to use for the peer 74 * @param target neighbour to check
130 * @param server the server of the CORE service 75 * @return #GNUNET_YES if excess bandwidth is available, #GNUNET_NO if not
131 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
132 */ 76 */
133int 77int
134GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk, 78GSC_NEIGHBOURS_check_excess_bandwidth (const struct GSC_KeyExchangeInfo *target);
135 struct GNUNET_SERVER_Handle *server);
136 79
137 80
138/** 81/**
139 * Shutdown KX subsystem. 82 * Check how many messages are queued for the given neighbour.
83 *
84 * @param target neighbour to check
85 * @return number of items in the message queue
140 */ 86 */
141void 87unsigned int
142GSC_KX_done (void); 88GSC_NEIGHBOURS_get_queue_length (const struct GSC_KeyExchangeInfo *target);
143 89
144 90
145/** 91/**