aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_core_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-05-04 22:16:24 +0200
committerChristian Grothoff <christian@grothoff.org>2019-05-04 22:16:24 +0200
commit80f480c752fd8dfa1be51d78fce314d9f0650b50 (patch)
tree459c21a3fde3b5f66194ac9960632de53586c5f0 /src/include/gnunet_core_service.h
parent3d2a951fa12546c09809f0a4d7e789ef8e971b03 (diff)
downloadgnunet-80f480c752fd8dfa1be51d78fce314d9f0650b50.tar.gz
gnunet-80f480c752fd8dfa1be51d78fce314d9f0650b50.zip
simplify MQ logic to always carry the same kinds of flags, and extend transport API to pass them to (TNG) service
Diffstat (limited to 'src/include/gnunet_core_service.h')
-rw-r--r--src/include/gnunet_core_service.h90
1 files changed, 22 insertions, 68 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index f10ddee75..111eb529d 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -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
@@ -34,9 +34,8 @@
34#define GNUNET_CORE_SERVICE_H 34#define GNUNET_CORE_SERVICE_H
35 35
36#ifdef __cplusplus 36#ifdef __cplusplus
37extern "C" 37extern "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
@@ -49,35 +48,6 @@ extern "C"
49 */ 48 */
50#define GNUNET_CORE_VERSION 0x00000001 49#define GNUNET_CORE_VERSION 0x00000001
51 50
52/**
53 * Traffic priorities.
54 */
55enum GNUNET_CORE_Priority
56{
57
58 /**
59 * Lowest priority, i.e. background traffic (i.e. fs)
60 */
61 GNUNET_CORE_PRIO_BACKGROUND = 0,
62
63 /**
64 * Normal traffic (i.e. cadet/dv relay, DHT)
65 */
66 GNUNET_CORE_PRIO_BEST_EFFORT = 1,
67
68 /**
69 * Urgent traffic (local peer, i.e. conversation).
70 */
71 GNUNET_CORE_PRIO_URGENT = 2,
72
73 /**
74 * Highest priority, control traffic (i.e. NSE, Core/Cadet KX).
75 */
76 GNUNET_CORE_PRIO_CRITICAL_CONTROL = 3
77
78
79};
80
81 51
82/** 52/**
83 * Opaque handle to the service. 53 * Opaque handle to the service.
@@ -93,10 +63,10 @@ struct GNUNET_CORE_Handle;
93 * @return closure associated with @a peer. given to mq callbacks and 63 * @return closure associated with @a peer. given to mq callbacks and
94 * #GNUNET_CORE_DisconnectEventHandler 64 * #GNUNET_CORE_DisconnectEventHandler
95 */ 65 */
96typedef void * 66typedef void *(*GNUNET_CORE_ConnectEventHandler) (
97(*GNUNET_CORE_ConnectEventHandler) (void *cls, 67 void *cls,
98 const struct GNUNET_PeerIdentity *peer, 68 const struct GNUNET_PeerIdentity *peer,
99 struct GNUNET_MQ_Handle *mq); 69 struct GNUNET_MQ_Handle *mq);
100 70
101 71
102/** 72/**
@@ -107,10 +77,10 @@ typedef void *
107 * @param peer_cls closure associated with peer. given in 77 * @param peer_cls closure associated with peer. given in
108 * #GNUNET_CORE_ConnectEventHandler 78 * #GNUNET_CORE_ConnectEventHandler
109 */ 79 */
110typedef void 80typedef void (*GNUNET_CORE_DisconnectEventHandler) (
111(*GNUNET_CORE_DisconnectEventHandler) (void *cls, 81 void *cls,
112 const struct GNUNET_PeerIdentity *peer, 82 const struct GNUNET_PeerIdentity *peer,
113 void *peer_cls); 83 void *peer_cls);
114 84
115 85
116/** 86/**
@@ -125,9 +95,9 @@ typedef void
125 * @param cls closure 95 * @param cls closure
126 * @param my_identity ID of this peer, NULL if we failed 96 * @param my_identity ID of this peer, NULL if we failed
127 */ 97 */
128typedef void 98typedef void (*GNUNET_CORE_StartupCallback) (
129(*GNUNET_CORE_StartupCallback) (void *cls, 99 void *cls,
130 const struct GNUNET_PeerIdentity *my_identity); 100 const struct GNUNET_PeerIdentity *my_identity);
131 101
132 102
133/** 103/**
@@ -173,22 +143,6 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle);
173 143
174 144
175/** 145/**
176 * Inquire with CORE what options should be set for a message
177 * so that it is transmitted with the given @a priority and
178 * the given @a cork value.
179 *
180 * @param cork desired corking
181 * @param priority desired message priority
182 * @param[out] flags set to `flags` value for #GNUNET_MQ_set_options()
183 * @return `extra` argument to give to #GNUNET_MQ_set_options()
184 */
185const void *
186GNUNET_CORE_get_mq_options (int cork,
187 enum GNUNET_CORE_Priority priority,
188 uint64_t *flags);
189
190
191/**
192 * Obtain the message queue for a connected peer. 146 * Obtain the message queue for a connected peer.
193 * 147 *
194 * @param h the core handle 148 * @param h the core handle
@@ -197,7 +151,7 @@ GNUNET_CORE_get_mq_options (int cork,
197 */ 151 */
198struct GNUNET_MQ_Handle * 152struct GNUNET_MQ_Handle *
199GNUNET_CORE_get_mq (const struct GNUNET_CORE_Handle *h, 153GNUNET_CORE_get_mq (const struct GNUNET_CORE_Handle *h,
200 const struct GNUNET_PeerIdentity *pid); 154 const struct GNUNET_PeerIdentity *pid);
201 155
202 156
203/** 157/**
@@ -287,11 +241,11 @@ enum GNUNET_CORE_KxState
287 * @param state current key exchange state of the peer 241 * @param state current key exchange state of the peer
288 * @param timeout when does the current state expire 242 * @param timeout when does the current state expire
289 */ 243 */
290typedef void 244typedef void (*GNUNET_CORE_MonitorCallback) (
291(*GNUNET_CORE_MonitorCallback)(void *cls, 245 void *cls,
292 const struct GNUNET_PeerIdentity *pid, 246 const struct GNUNET_PeerIdentity *pid,
293 enum GNUNET_CORE_KxState state, 247 enum GNUNET_CORE_KxState state,
294 struct GNUNET_TIME_Absolute timeout); 248 struct GNUNET_TIME_Absolute timeout);
295 249
296 250
297/** 251/**
@@ -360,7 +314,7 @@ GNUNET_CORE_mq_create (struct GNUNET_CORE_Handle *h,
360 const struct GNUNET_PeerIdentity *target); 314 const struct GNUNET_PeerIdentity *target);
361 315
362 316
363#if 0 /* keep Emacsens' auto-indent happy */ 317#if 0 /* keep Emacsens' auto-indent happy */
364{ 318{
365#endif 319#endif
366#ifdef __cplusplus 320#ifdef __cplusplus
@@ -370,6 +324,6 @@ GNUNET_CORE_mq_create (struct GNUNET_CORE_Handle *h,
370/* ifndef GNUNET_CORE_SERVICE_H */ 324/* ifndef GNUNET_CORE_SERVICE_H */
371#endif 325#endif
372 326
373/** @} */ /* end of group core */ 327/** @} */ /* end of group core */
374 328
375/* end of gnunet_core_service.h */ 329/* end of gnunet_core_service.h */