diff options
Diffstat (limited to 'src/include/gnunet_transport_core_service.h')
-rw-r--r-- | src/include/gnunet_transport_core_service.h | 85 |
1 files changed, 43 insertions, 42 deletions
diff --git a/src/include/gnunet_transport_core_service.h b/src/include/gnunet_transport_core_service.h index f442b53c0..076514779 100644 --- a/src/include/gnunet_transport_core_service.h +++ b/src/include/gnunet_transport_core_service.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2016 GNUnet e.V. | 3 | Copyright (C) 2009-2019 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 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 | 6 | under the terms of the GNU Affero General Public License as published |
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 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/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -21,7 +21,7 @@ | |||
21 | * @author Christian Grothoff | 21 | * @author Christian Grothoff |
22 | * | 22 | * |
23 | * @file | 23 | * @file |
24 | * API of the transport service towards the CORE service. | 24 | * API of the transport service towards the CORE service (TNG version) |
25 | * | 25 | * |
26 | * @defgroup transport TRANSPORT service | 26 | * @defgroup transport TRANSPORT service |
27 | * Communication with other peers | 27 | * Communication with other peers |
@@ -34,9 +34,8 @@ | |||
34 | #define GNUNET_TRANSPORT_CORE_SERVICE_H | 34 | #define GNUNET_TRANSPORT_CORE_SERVICE_H |
35 | 35 | ||
36 | #ifdef __cplusplus | 36 | #ifdef __cplusplus |
37 | extern "C" | 37 | extern "C" { |
38 | { | 38 | #if 0 /* keep Emacsens' auto-indent happy */ |
39 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
40 | } | 39 | } |
41 | #endif | 40 | #endif |
42 | #endif | 41 | #endif |
@@ -62,15 +61,15 @@ struct GNUNET_TRANSPORT_CoreHandle; | |||
62 | * @param cls closure | 61 | * @param cls closure |
63 | * @param peer the identity of the peer that connected; this | 62 | * @param peer the identity of the peer that connected; this |
64 | * pointer will remain valid until the disconnect, hence | 63 | * pointer will remain valid until the disconnect, hence |
65 | * applications do not necessarily have to make a copy | 64 | * applications do not necessarily have to make a copy |
66 | * of the value if they only need it until disconnect | 65 | * of the value if they only need it until disconnect |
67 | * @param mq message queue to use to transmit to @a peer | 66 | * @param mq message queue to use to transmit to @a peer |
68 | * @return closure to use in MQ handlers | 67 | * @return closure to use in MQ handlers |
69 | */ | 68 | */ |
70 | typedef void * | 69 | typedef void *(*GNUNET_TRANSPORT_NotifyConnect) ( |
71 | (*GNUNET_TRANSPORT_NotifyConnect) (void *cls, | 70 | void *cls, |
72 | const struct GNUNET_PeerIdentity *peer, | 71 | const struct GNUNET_PeerIdentity *peer, |
73 | struct GNUNET_MQ_Handle *mq); | 72 | struct GNUNET_MQ_Handle *mq); |
74 | 73 | ||
75 | 74 | ||
76 | /** | 75 | /** |
@@ -84,33 +83,10 @@ typedef void * | |||
84 | * @param handlers_cls closure of the handlers, was returned from the | 83 | * @param handlers_cls closure of the handlers, was returned from the |
85 | * connect notification callback | 84 | * connect notification callback |
86 | */ | 85 | */ |
87 | typedef void | 86 | typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) ( |
88 | (*GNUNET_TRANSPORT_NotifyDisconnect) (void *cls, | 87 | void *cls, |
89 | const struct GNUNET_PeerIdentity *peer, | 88 | const struct GNUNET_PeerIdentity *peer, |
90 | void *handler_cls); | 89 | void *handler_cls); |
91 | |||
92 | |||
93 | /** | ||
94 | * Function called if we have "excess" bandwidth to a peer. | ||
95 | * The notification will happen the first time we have excess | ||
96 | * bandwidth, and then only again after the client has performed | ||
97 | * some transmission to the peer. | ||
98 | * | ||
99 | * Excess bandwidth is defined as being allowed (by ATS) to send | ||
100 | * more data, and us reaching the limit of the capacity build-up | ||
101 | * (which, if we go past it, means we don't use available bandwidth). | ||
102 | * See also the "max carry" in `struct GNUNET_BANDWIDTH_Tracker`. | ||
103 | * | ||
104 | * @param cls the closure | ||
105 | * @param neighbour peer that we have excess bandwidth to | ||
106 | * @param handlers_cls closure of the handlers, was returned from the | ||
107 | * connect notification callback | ||
108 | */ | ||
109 | typedef void | ||
110 | (*GNUNET_TRANSPORT_NotifyExcessBandwidth)(void *cls, | ||
111 | const struct GNUNET_PeerIdentity *neighbour, | ||
112 | void *handlers_cls); | ||
113 | |||
114 | 90 | ||
115 | 91 | ||
116 | /** | 92 | /** |
@@ -136,8 +112,7 @@ GNUNET_TRANSPORT_core_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
136 | const struct GNUNET_MQ_MessageHandler *handlers, | 112 | const struct GNUNET_MQ_MessageHandler *handlers, |
137 | void *cls, | 113 | void *cls, |
138 | GNUNET_TRANSPORT_NotifyConnect nc, | 114 | GNUNET_TRANSPORT_NotifyConnect nc, |
139 | GNUNET_TRANSPORT_NotifyDisconnect nd, | 115 | GNUNET_TRANSPORT_NotifyDisconnect nd); |
140 | GNUNET_TRANSPORT_NotifyExcessBandwidth neb); | ||
141 | 116 | ||
142 | 117 | ||
143 | /** | 118 | /** |
@@ -150,7 +125,33 @@ GNUNET_TRANSPORT_core_disconnect (struct GNUNET_TRANSPORT_CoreHandle *handle); | |||
150 | 125 | ||
151 | 126 | ||
152 | /** | 127 | /** |
128 | * Notification from the CORE service to the TRANSPORT service | ||
129 | * that the CORE service has finished processing a message from | ||
130 | * TRANSPORT (via the @code{handlers} of #GNUNET_TRANSPORT_core_connect()) | ||
131 | * and that it is thus now OK for TRANSPORT to send more messages | ||
132 | * for @a pid. | ||
133 | * | ||
134 | * Used to provide flow control, this is our equivalent to | ||
135 | * #GNUNET_SERVICE_client_continue() of an ordinary service. | ||
136 | * | ||
137 | * Note that due to the use of a window, TRANSPORT may send multiple | ||
138 | * messages destined for the same peer even without an intermediate | ||
139 | * call to this function. However, CORE must still call this function | ||
140 | * once per message received, as otherwise eventually the window will | ||
141 | * be full and TRANSPORT will stop providing messages to CORE for @a | ||
142 | * pid. | ||
143 | * | ||
144 | * @param ch core handle | ||
145 | * @param pid which peer was the message from that was fully processed by CORE | ||
146 | */ | ||
147 | void | ||
148 | GNUNET_TRANSPORT_core_receive_continue (struct GNUNET_TRANSPORT_CoreHandle *ch, | ||
149 | const struct GNUNET_PeerIdentity *pid); | ||
150 | |||
151 | |||
152 | /** | ||
153 | * Checks if a given peer is connected to us and get the message queue. | 153 | * Checks if a given peer is connected to us and get the message queue. |
154 | * Convenience function. | ||
154 | * | 155 | * |
155 | * @param handle connection to transport service | 156 | * @param handle connection to transport service |
156 | * @param peer the peer to check | 157 | * @param peer the peer to check |
@@ -161,7 +162,7 @@ GNUNET_TRANSPORT_core_get_mq (struct GNUNET_TRANSPORT_CoreHandle *handle, | |||
161 | const struct GNUNET_PeerIdentity *peer); | 162 | const struct GNUNET_PeerIdentity *peer); |
162 | 163 | ||
163 | 164 | ||
164 | #if 0 /* keep Emacsens' auto-indent happy */ | 165 | #if 0 /* keep Emacsens' auto-indent happy */ |
165 | { | 166 | { |
166 | #endif | 167 | #endif |
167 | #ifdef __cplusplus | 168 | #ifdef __cplusplus |
@@ -171,6 +172,6 @@ GNUNET_TRANSPORT_core_get_mq (struct GNUNET_TRANSPORT_CoreHandle *handle, | |||
171 | /* ifndef GNUNET_TRANSPORT_CORE_SERVICE_H */ | 172 | /* ifndef GNUNET_TRANSPORT_CORE_SERVICE_H */ |
172 | #endif | 173 | #endif |
173 | 174 | ||
174 | /** @} */ /* end of group */ | 175 | /** @} */ /* end of group */ |
175 | 176 | ||
176 | /* end of gnunet_transport_core_service.h */ | 177 | /* end of gnunet_transport_core_service.h */ |