diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-01-30 18:24:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-01-30 18:24:13 +0000 |
commit | 6fd0a7efde08115b568b99b7755861a50f1b6c2e (patch) | |
tree | d8d712f0a5cafe18ddf8ff33296ff24b30beae7f /src/include/gnunet_core_service.h | |
parent | 6a4c5ee6195fb7a6fcf90b1bae5ca36926e82023 (diff) | |
download | gnunet-6fd0a7efde08115b568b99b7755861a50f1b6c2e.tar.gz gnunet-6fd0a7efde08115b568b99b7755861a50f1b6c2e.zip |
towards reviving priorities in core API, this time with enum to make classes clearer
Diffstat (limited to 'src/include/gnunet_core_service.h')
-rw-r--r-- | src/include/gnunet_core_service.h | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 4eca0cc03..6c68a6833 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -46,6 +46,34 @@ extern "C" | |||
46 | */ | 46 | */ |
47 | #define GNUNET_CORE_VERSION 0x00000001 | 47 | #define GNUNET_CORE_VERSION 0x00000001 |
48 | 48 | ||
49 | /** | ||
50 | * Traffic priorities. | ||
51 | */ | ||
52 | enum GNUNET_CORE_Priority | ||
53 | { | ||
54 | |||
55 | /** | ||
56 | * Highest priority, control traffic (i.e. NSE, Core/Mesh KX). | ||
57 | */ | ||
58 | GNUNET_CORE_PRIO_CRITICAL_CONTROL = 0, | ||
59 | |||
60 | /** | ||
61 | * Urgent traffic (local peer, i.e. conversation). | ||
62 | */ | ||
63 | GNUNET_CORE_PRIO_URGENT = 1, | ||
64 | |||
65 | /** | ||
66 | * Normal traffic (i.e. mesh/dv relay, DHT) | ||
67 | */ | ||
68 | GNUNET_CORE_PRIO_BEST_EFFORT = 2, | ||
69 | |||
70 | /** | ||
71 | * Background traffic (i.e. fs) | ||
72 | */ | ||
73 | GNUNET_CORE_PRIO_BACKGROUND = 3 | ||
74 | |||
75 | }; | ||
76 | |||
49 | 77 | ||
50 | /** | 78 | /** |
51 | * Opaque handle to the service. | 79 | * Opaque handle to the service. |
@@ -59,8 +87,9 @@ struct GNUNET_CORE_Handle; | |||
59 | * @param cls closure | 87 | * @param cls closure |
60 | * @param peer peer identity this notification is about | 88 | * @param peer peer identity this notification is about |
61 | */ | 89 | */ |
62 | typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, | 90 | typedef void |
63 | const struct GNUNET_PeerIdentity *peer); | 91 | (*GNUNET_CORE_ConnectEventHandler) (void *cls, |
92 | const struct GNUNET_PeerIdentity *peer); | ||
64 | 93 | ||
65 | 94 | ||
66 | /** | 95 | /** |
@@ -69,8 +98,9 @@ typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, | |||
69 | * @param cls closure | 98 | * @param cls closure |
70 | * @param peer peer identity this notification is about | 99 | * @param peer peer identity this notification is about |
71 | */ | 100 | */ |
72 | typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, | 101 | typedef void |
73 | const struct GNUNET_PeerIdentity *peer); | 102 | (*GNUNET_CORE_DisconnectEventHandler) (void *cls, |
103 | const struct GNUNET_PeerIdentity *peer); | ||
74 | 104 | ||
75 | 105 | ||
76 | /** | 106 | /** |
@@ -84,11 +114,10 @@ typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, | |||
84 | * @return #GNUNET_OK to keep the connection open, | 114 | * @return #GNUNET_OK to keep the connection open, |
85 | * #GNUNET_SYSERR to close connection to the peer (signal serious error) | 115 | * #GNUNET_SYSERR to close connection to the peer (signal serious error) |
86 | */ | 116 | */ |
87 | typedef int (*GNUNET_CORE_MessageCallback) (void *cls, | 117 | typedef int |
88 | const struct GNUNET_PeerIdentity * | 118 | (*GNUNET_CORE_MessageCallback) (void *cls, |
89 | other, | 119 | const struct GNUNET_PeerIdentity *other, |
90 | const struct GNUNET_MessageHeader * | 120 | const struct GNUNET_MessageHeader *message); |
91 | message); | ||
92 | 121 | ||
93 | 122 | ||
94 | /** | 123 | /** |
@@ -98,7 +127,7 @@ typedef int (*GNUNET_CORE_MessageCallback) (void *cls, | |||
98 | struct GNUNET_CORE_MessageHandler | 127 | struct GNUNET_CORE_MessageHandler |
99 | { | 128 | { |
100 | /** | 129 | /** |
101 | * Function to call for messages of "type". | 130 | * Function to call for messages of @e type. |
102 | */ | 131 | */ |
103 | GNUNET_CORE_MessageCallback callback; | 132 | GNUNET_CORE_MessageCallback callback; |
104 | 133 | ||
@@ -129,8 +158,9 @@ struct GNUNET_CORE_MessageHandler | |||
129 | * @param cls closure | 158 | * @param cls closure |
130 | * @param my_identity ID of this peer, NULL if we failed | 159 | * @param my_identity ID of this peer, NULL if we failed |
131 | */ | 160 | */ |
132 | typedef void (*GNUNET_CORE_StartupCallback) (void *cls, | 161 | typedef void |
133 | const struct GNUNET_PeerIdentity *my_identity); | 162 | (*GNUNET_CORE_StartupCallback) (void *cls, |
163 | const struct GNUNET_PeerIdentity *my_identity); | ||
134 | 164 | ||
135 | 165 | ||
136 | /** | 166 | /** |
@@ -233,8 +263,9 @@ struct GNUNET_CORE_TransmitHandle; | |||
233 | * if NULL is returned, "notify" will NOT be called. | 263 | * if NULL is returned, "notify" will NOT be called. |
234 | */ | 264 | */ |
235 | struct GNUNET_CORE_TransmitHandle * | 265 | struct GNUNET_CORE_TransmitHandle * |
236 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, | 266 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, |
237 | uint32_t priority, | 267 | int cork, |
268 | enum GNUNET_CORE_Priority priority, | ||
238 | struct GNUNET_TIME_Relative maxdelay, | 269 | struct GNUNET_TIME_Relative maxdelay, |
239 | const struct GNUNET_PeerIdentity *target, | 270 | const struct GNUNET_PeerIdentity *target, |
240 | size_t notify_size, | 271 | size_t notify_size, |