aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/mesh.h
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-04-06 17:27:25 +0000
committerBart Polot <bart@net.in.tum.de>2011-04-06 17:27:25 +0000
commit78821fe96de53ff40851c11cf2134654a0b63640 (patch)
tree1dfecd3050c4b62488c295e3bdbb8a702cce5723 /src/mesh/mesh.h
parentba830bbe8fe27e46ac748a2e02bdc7dfeb1f3b5c (diff)
downloadgnunet-78821fe96de53ff40851c11cf2134654a0b63640.tar.gz
gnunet-78821fe96de53ff40851c11cf2134654a0b63640.zip
New mesh API
Diffstat (limited to 'src/mesh/mesh.h')
-rw-r--r--src/mesh/mesh.h102
1 files changed, 83 insertions, 19 deletions
diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h
index 2c260030d..a29c63f88 100644
--- a/src/mesh/mesh.h
+++ b/src/mesh/mesh.h
@@ -36,19 +36,20 @@
36/* API CALL MESSAGE USED 36/* API CALL MESSAGE USED
37 * -------- ------------ 37 * -------- ------------
38 * connect GNUNET_MESH_Connect 38 * connect GNUNET_MESH_Connect
39 * disconnect Server_disconnect 39 * disconnect None (network level disconnect)
40 *
41 * tunnel_create GNUNET_MESH_TunnelMessage
42 * tunnel_destroy GNUNET_MESH_TunnelMessage
40 * 43 *
41 * peer_request_connect_any GNUNET_MESH_ConnectPeer
42 * peer_request_connect_all GNUNET_MESH_ConnectPeer
43 * peer_request_connect_add GNUNET_MESH_ConnectPeer 44 * peer_request_connect_add GNUNET_MESH_ConnectPeer
44 * peer_request_connect_del GNUNET_MESH_ConnectPeer 45 * peer_request_connect_del GNUNET_MESH_ConnectPeer
45 * peer_request_connect_by_type GNUNET_MESH_ConnectPeerByType 46 * peer_request_connect_by_type GNUNET_MESH_ConnectPeerByType
46 * peer_request_connect_cancel GNUNET_MESH_Control
47 * 47 *
48 * notify_transmit_ready GNUNET_MESH_Control 48 * notify_transmit_ready GNUNET_MESH_Control
49 * notify_transmit_ready_cancel None 49 * notify_transmit_ready_cancel None
50 */ 50 */
51 51
52
52struct GNUNET_MESH_Connect { 53struct GNUNET_MESH_Connect {
53 /** 54 /**
54 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 55 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT
@@ -60,74 +61,137 @@ struct GNUNET_MESH_Connect {
60 /* uint16_t messages_subscribed[] */ 61 /* uint16_t messages_subscribed[] */
61}; 62};
62 63
63struct GNUNET_MESH_ConnectPeer { 64
65/**
66 *
67 */
68struct GNUNET_MESH_TunnelMessage {
64 /** 69 /**
65 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_[ANY|ALL|ADD|DEL] 70 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATE|DESTROY]
66 *
67 * Size: sizeof(struct GNUNET_MESH_ConnectPeer) + npeers * sizeof (struct GNUNET_PeerIdentity)
68 */ 71 */
69 struct GNUNET_MessageHeader header; 72 struct GNUNET_MessageHeader header;
70 73
71 /* struct GNUNET_PeerIdentity peers[] */ 74 /**
75 * ID of a tunnel controlled by this client.
76 */
77 uint32_t tunnel_id GNUNET_PACKED;
72}; 78};
73 79
80
81struct GNUNET_MESH_PeerControl {
82
83 /**
84 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_[ADD|DEL] (client to service, client created tunnel)
85 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_NOTIFY[CONNECT|DISCONNECT] (service to client)
86 *
87 * Size: sizeof(struct GNUNET_MESH_PeerControl)
88 */
89 struct GNUNET_MessageHeader header;
90
91 /**
92 * ID of a tunnel controlled by this client.
93 */
94 uint32_t tunnel_id GNUNET_PACKED;
95
96 /**
97 * Peer to connect/disconnect.
98 */
99 struct GNUNET_PeerIdentity peer;
100};
101
102
103
104
74struct GNUNET_MESH_ConnectPeerByType { 105struct GNUNET_MESH_ConnectPeerByType {
75 /** 106 /**
76 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE 107 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE
77 */ 108 */
78 struct GNUNET_MessageHeader header; 109 struct GNUNET_MessageHeader header;
79 110
80 /* Type specification */ 111 /**
112 * ID of a tunnel controlled by this client.
113 */
114 uint32_t tunnel_id GNUNET_PACKED;
115
116 /**
117 * Type specification
118 */
81 GNUNET_MESH_ApplicationType type; 119 GNUNET_MESH_ApplicationType type;
82}; 120};
83 121
84struct GNUNET_MESH_Control { 122
123struct GNUNET_MESH_RequestTransmitReady {
85 /** 124 /**
86 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL 125 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_REQUEST_TRANSMIT_READY
87 * GNUNET_MESSAGE_TYPE_MESH_LOCAL_TRANSMIT_READY
88 */ 126 */
89 struct GNUNET_MessageHeader header; 127 struct GNUNET_MessageHeader header;
90 128
129 /**
130 * ID of a tunnel controlled by this client.
131 */
91 uint32_t tunnel_id GNUNET_PACKED; 132 uint32_t tunnel_id GNUNET_PACKED;
92 uint32_t variable GNUNET_PACKED; /* Size of data / connection ID */ 133
134 /**
135 * Size of message we would like to transmit to this tunnel
136 */
137 uint32_t msg_size GNUNET_PACKED;
93}; 138};
94 139
95struct GNUNET_MESH_TunnelEvent { 140struct GNUNET_MESH_NotifyTransmitReady {
96 /** 141 /**
97 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATED\DESTROYED] 142 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_NOTIFY_TRANSMIT_READY
98 */ 143 */
99 struct GNUNET_MessageHeader header; 144 struct GNUNET_MessageHeader header;
100 145
146 /**
147 * ID of a tunnel controlled by this client.
148 */
101 uint32_t tunnel_id GNUNET_PACKED; 149 uint32_t tunnel_id GNUNET_PACKED;
102 uint32_t reason GNUNET_PACKED; /* incoming, connect, timeout, disconnect */ 150
151 /**
152 * Size of message we can now transmit to this tunnel
153 */
154 uint32_t msg_size GNUNET_PACKED;
103}; 155};
104 156
157
105struct GNUNET_MESH_Data { 158struct GNUNET_MESH_Data {
106 /** 159 /**
107 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA 160 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA (client to service, or service to client)
108 * 161 *
109 * Size: sizeof(struct GNUNET_MESH_Data) + sizeof (data) 162 * Size: sizeof(struct GNUNET_MESH_Data) + sizeof (data)
110 */ 163 */
111 struct GNUNET_MessageHeader header; 164 struct GNUNET_MessageHeader header;
112 165
166 /**
167 * ID of a tunnel controlled by this client.
168 */
113 uint32_t tunnel_id GNUNET_PACKED; 169 uint32_t tunnel_id GNUNET_PACKED;
114 170
171 /**
172 * Source or destination of the message (depending on direction).
173 */
115 struct GNUNET_PeerIdentity destination; 174 struct GNUNET_PeerIdentity destination;
116 175
117 /* uint8_t data[] */ 176 /* uint8_t data[] */
118}; 177};
119 178
179
120struct GNUNET_MESH_DataBroadcast { 180struct GNUNET_MESH_DataBroadcast {
121 /** 181 /**
122 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST 182 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST (client to service only, client created tunnel)
123 * 183 *
124 * Size: sizeof(struct GNUNET_MESH_DataBroadcast) + sizeof (data) 184 * Size: sizeof(struct GNUNET_MESH_DataBroadcast) + sizeof (data)
125 */ 185 */
126 struct GNUNET_MessageHeader header; 186 struct GNUNET_MessageHeader header;
127 187
188 /**
189 * ID of a tunnel controlled by this client.
190 */
128 uint32_t tunnel_id GNUNET_PACKED; 191 uint32_t tunnel_id GNUNET_PACKED;
129 192
130 /* uint8_t data[] */ 193 /* uint8_t data[] */
131}; 194};
132 195
196
133#endif 197#endif