aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-01-30 18:24:13 +0000
committerChristian Grothoff <christian@grothoff.org>2014-01-30 18:24:13 +0000
commit6fd0a7efde08115b568b99b7755861a50f1b6c2e (patch)
treed8d712f0a5cafe18ddf8ff33296ff24b30beae7f /src/include
parent6a4c5ee6195fb7a6fcf90b1bae5ca36926e82023 (diff)
downloadgnunet-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')
-rw-r--r--src/include/gnunet_core_service.h59
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 */
52enum 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 */
62typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, 90typedef 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 */
72typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, 101typedef 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 */
87typedef int (*GNUNET_CORE_MessageCallback) (void *cls, 117typedef 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,
98struct GNUNET_CORE_MessageHandler 127struct 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 */
132typedef void (*GNUNET_CORE_StartupCallback) (void *cls, 161typedef 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 */
235struct GNUNET_CORE_TransmitHandle * 265struct GNUNET_CORE_TransmitHandle *
236GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, 266GNUNET_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,