diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-03-29 09:36:22 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-03-29 09:36:22 +0000 |
commit | 6d324c54d68defac2c1727ab40e4d0258361b50b (patch) | |
tree | c99e743ee16de16b3433764ba249db439049431f /src/mesh/mesh.h | |
parent | 76b1f350c95e6f4e28a0bc9d915f20e354fff1ab (diff) | |
download | gnunet-6d324c54d68defac2c1727ab40e4d0258361b50b.tar.gz gnunet-6d324c54d68defac2c1727ab40e4d0258361b50b.zip |
Changed message declaration location, added api messages
Diffstat (limited to 'src/mesh/mesh.h')
-rw-r--r-- | src/mesh/mesh.h | 199 |
1 files changed, 65 insertions, 134 deletions
diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h index e51b0c890..dda3e2fcc 100644 --- a/src/mesh/mesh.h +++ b/src/mesh/mesh.h | |||
@@ -23,178 +23,109 @@ | |||
23 | * @file mesh/mesh.h | 23 | * @file mesh/mesh.h |
24 | * | 24 | * |
25 | * TODO: | 25 | * TODO: |
26 | * - soft stateing (keep-alive (CHANGE?) / timeout / disconnect) -- not a message issue | ||
27 | * - error reporting (CREATE/CHANGE/ADD/DEL?) -- new message! | ||
28 | * - partial disconnect reporting -- same as error reporting? | ||
29 | * - add vs create? change vs. keep-alive? same msg or different ones? -- thinking... | ||
30 | * - speed requirement specification (change?) in mesh API -- API call | ||
31 | * | ||
32 | * - API messages! | 26 | * - API messages! |
33 | */ | 27 | */ |
34 | 28 | ||
35 | |||
36 | #ifndef MESH_H_ | 29 | #ifndef MESH_H_ |
37 | #define MESH_H_ | 30 | #define MESH_H_ |
38 | #include <stdint.h> | 31 | #include <stdint.h> |
39 | #include "gnunet_common.h" | 32 | #include "gnunet_common.h" |
40 | 33 | ||
41 | /** | 34 | /******************************************************************************/ |
42 | * Message for mesh path management | 35 | /******************** MESH NETWORK MESSAGES **************************/ |
36 | /******************************************************************************/ | ||
37 | /* API CALL MESSAGE USED | ||
38 | * -------- ------------ | ||
39 | * connect GNUNET_MESH_Connect / Server_connect? FIXME | ||
40 | * disconnect GNUNET_MESH_Disconnect / Server_disconnect? FIXME | ||
41 | * | ||
42 | * peer_request_connect_any GNUNET_MESH_ConnectPeer | ||
43 | * peer_request_connect_all GNUNET_MESH_ConnectPeer | ||
44 | * peer_request_connect_add GNUNET_MESH_ConnectPeer | ||
45 | * peer_request_connect_del GNUNET_MESH_ConnectPeer | ||
46 | * peer_request_connect_by_type GNUNET_MESH_ConnectPeerByType | ||
47 | * peer_request_connect_cancel GNUNET_MESH_Control | ||
48 | * | ||
49 | * notify_tranmit_ready GNUNET_MESH_Control? FIXME | ||
50 | * notify_tranmit_ready_cancel GNUNET_MESH_Control? FIXME | ||
43 | */ | 51 | */ |
44 | struct GNUNET_MESH_ManipulatePath | ||
45 | { | ||
46 | /** | ||
47 | * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DEL] | ||
48 | * | ||
49 | * Size: sizeof(struct GNUNET_MESH_ManipulatePath) + path_length * sizeof (struct GNUNET_PeerIdentity) | ||
50 | */ | ||
51 | struct GNUNET_MessageHeader header; | ||
52 | |||
53 | /** | ||
54 | * Id of the tunnel this path belongs to, unique in conjunction with the origin. | ||
55 | */ | ||
56 | uint32_t tid GNUNET_PACKED; | ||
57 | 52 | ||
58 | /** | 53 | // struct GNUNET_MESH_Connect { |
59 | * Information about speed requirements. If the tunnel cannot sustain the | 54 | // /** |
60 | * minimum bandwidth, packets are to be dropped. | 55 | // * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT |
56 | // * | ||
57 | // * Size: sizeof(struct GNUNET_MESH_Connect) + messages_subscribed * sizeof (message_type) | ||
58 | // */ | ||
59 | // struct GNUNET_MessageHeader header; | ||
60 | // | ||
61 | // /* uint16_t messages_subscribed[] */ | ||
62 | // }; | ||
63 | // | ||
64 | // struct GNUNET_MESH_Disconnect { | ||
65 | // /** | ||
66 | // * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DISCONNECT | ||
67 | // */ | ||
68 | // struct GNUNET_MessageHeader header; | ||
69 | // | ||
70 | // }; | ||
71 | |||
72 | struct GNUNET_MESH_ConnectPeer { | ||
73 | /** | ||
74 | * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_[ANY|ALL|ADD|DEL] | ||
75 | * | ||
76 | * Size: sizeof(struct GNUNET_MESH_ConnectPeer) + npeers * sizeof (struct GNUNET_PeerIdentity) | ||
61 | */ | 77 | */ |
62 | uint32_t speed_min GNUNET_PACKED; | 78 | struct GNUNET_MessageHeader header; |
63 | 79 | ||
64 | /** | 80 | /* struct GNUNET_PeerIdentity peers[] */ |
65 | * path_length structs defining the *whole* path from the origin [0] to the | ||
66 | * final destination [path_length-1]. | ||
67 | */ | ||
68 | // struct GNUNET_PeerIdentity peers[path_length]; | ||
69 | }; | 81 | }; |
70 | 82 | ||
71 | /** | 83 | struct GNUNET_MESH_ConnectPeerByType { |
72 | * Message for mesh data traffic to all tunnel targets. | ||
73 | */ | ||
74 | struct GNUNET_MESH_OriginMulticast | ||
75 | { | ||
76 | /** | 84 | /** |
77 | * Type: GNUNET_MESSAGE_TYPE_DATA_MULTICAST | 85 | * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE |
78 | */ | 86 | */ |
79 | struct GNUNET_MessageHeader header; | 87 | struct GNUNET_MessageHeader header; |
80 | 88 | ||
81 | /** | 89 | /* FIXME Type specification */ |
82 | * TID of the tunnel | 90 | uint32_t type; |
83 | */ | ||
84 | uint32_t tid GNUNET_PACKED; | ||
85 | |||
86 | /** | ||
87 | * OID of the tunnel | ||
88 | */ | ||
89 | struct GNUNET_PeerIdentity oid; | ||
90 | |||
91 | /** | ||
92 | * FIXME: Some form of authentication | ||
93 | */ | ||
94 | // uint32_t token; | ||
95 | |||
96 | /** | ||
97 | * Payload follows | ||
98 | */ | ||
99 | }; | 91 | }; |
100 | 92 | ||
101 | 93 | struct GNUNET_MESH_Control { | |
102 | /** | ||
103 | * Message for mesh data traffic to a particular destination from origin. | ||
104 | */ | ||
105 | struct GNUNET_MESH_DataMessageFromOrigin | ||
106 | { | ||
107 | /** | 94 | /** |
108 | * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN | 95 | * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL |
96 | * more? transmit_ready? | ||
109 | */ | 97 | */ |
110 | struct GNUNET_MessageHeader header; | 98 | struct GNUNET_MessageHeader header; |
111 | 99 | ||
112 | /** | 100 | uint32_t tunnel_id GNUNET_PACKED; |
113 | * TID of the tunnel | 101 | uint32_t variable GNUNET_PACKED; /* Size of data to transmit? */ |
114 | */ | ||
115 | uint32_t tid GNUNET_PACKED; | ||
116 | |||
117 | /** | ||
118 | * OID of the tunnel | ||
119 | */ | ||
120 | struct GNUNET_PeerIdentity oid; | ||
121 | |||
122 | /** | ||
123 | * Destination. | ||
124 | */ | ||
125 | struct GNUNET_PeerIdentity destination; | ||
126 | |||
127 | /** | ||
128 | * FIXME: Some form of authentication | ||
129 | */ | ||
130 | // uint32_t token; | ||
131 | |||
132 | /** | ||
133 | * Payload follows | ||
134 | */ | ||
135 | }; | 102 | }; |
136 | 103 | ||
137 | 104 | struct GNUNET_MESH_TunnelEvent { | |
138 | /** | ||
139 | * Message for mesh data traffic from a tunnel participant to origin. | ||
140 | */ | ||
141 | struct GNUNET_MESH_DataMessageToOrigin | ||
142 | { | ||
143 | /** | 105 | /** |
144 | * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_TO_ORIGIN | 106 | * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATED\DESTROYED] |
145 | */ | 107 | */ |
146 | struct GNUNET_MessageHeader header; | 108 | struct GNUNET_MessageHeader header; |
147 | 109 | ||
148 | /** | 110 | uint32_t tunnel_id GNUNET_PACKED; |
149 | * TID of the tunnel | 111 | uint32_t reason GNUNET_PACKED; /* incoming, connect, timeout, disconnect */ |
150 | */ | ||
151 | uint32_t tid GNUNET_PACKED; | ||
152 | |||
153 | /** | ||
154 | * OID of the tunnel | ||
155 | */ | ||
156 | struct GNUNET_PeerIdentity oid; | ||
157 | |||
158 | /** | ||
159 | * Sender of the message. | ||
160 | */ | ||
161 | struct GNUNET_PeerIdentity sender; | ||
162 | |||
163 | /** | ||
164 | * FIXME: Some form of authentication | ||
165 | */ | ||
166 | // uint32_t token; | ||
167 | |||
168 | /** | ||
169 | * Payload follows | ||
170 | */ | ||
171 | }; | 112 | }; |
172 | 113 | ||
173 | /** | 114 | struct GNUNET_MESH_Data { |
174 | * Message for mesh flow control | ||
175 | */ | ||
176 | struct GNUNET_MESH_SpeedNotify | ||
177 | { | ||
178 | /** | 115 | /** |
179 | * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY | 116 | * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA |
117 | * | ||
118 | * Size: sizeof(struct GNUNET_MESH_Data) + sizeof (data) | ||
180 | */ | 119 | */ |
181 | struct GNUNET_MessageHeader header; | 120 | struct GNUNET_MessageHeader header; |
182 | 121 | ||
183 | /** | 122 | uint32_t tunnel_id GNUNET_PACKED; |
184 | * TID of the tunnel | ||
185 | */ | ||
186 | uint32_t tid GNUNET_PACKED; | ||
187 | |||
188 | /** | ||
189 | * OID of the tunnel | ||
190 | */ | ||
191 | struct GNUNET_PeerIdentity oid; | ||
192 | 123 | ||
193 | /** | 124 | /* FIXME: Broadcast? New Type / NULL destination ? */ |
194 | * Slowest link down the path (above minimum speed requirement). | 125 | /* FIXME: Reverese order for alignment? 1st ID, 2nd t_id? */ |
195 | */ | 126 | struct GNUNET_PeerIdentity destination GNUNET_PACKED; |
196 | uint32_t speed_min; | ||
197 | 127 | ||
128 | /* uint8_t data[] */ | ||
198 | }; | 129 | }; |
199 | 130 | ||
200 | #endif | 131 | #endif |