diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-03-11 10:38:11 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-03-11 10:38:11 +0000 |
commit | 49da466bce647497cfc034db9e9761804e9d1a36 (patch) | |
tree | 65e289dcdb8c985ffa9ff4d243af6daeb83a6477 /src/dv/dv.h | |
parent | e927f9bbf828bfc5038323c39aa3046ef948afe5 (diff) | |
download | gnunet-49da466bce647497cfc034db9e9761804e9d1a36.tar.gz gnunet-49da466bce647497cfc034db9e9761804e9d1a36.zip |
shell for dv plugin and service, not yet working
Diffstat (limited to 'src/dv/dv.h')
-rw-r--r-- | src/dv/dv.h | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/src/dv/dv.h b/src/dv/dv.h new file mode 100644 index 000000000..3063bc917 --- /dev/null +++ b/src/dv/dv.h | |||
@@ -0,0 +1,165 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2001, 2002, 2003, 2004, 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Christian Grothoff | ||
23 | * @author NOT Nathan Evans | ||
24 | * @file dv/dv.h | ||
25 | */ | ||
26 | #ifndef DV_H | ||
27 | #define DV_H | ||
28 | |||
29 | #include "gnunet_common.h" | ||
30 | |||
31 | #define DEBUG_DV GNUNET_YES | ||
32 | #define DEBUG_DV_API GNUNET_YES | ||
33 | |||
34 | typedef void (*GNUNET_DV_MessageReceivedHandler) (void *cls, | ||
35 | struct GNUNET_PeerIdentity *sender, | ||
36 | struct GNUNET_MessageHeader *msg, | ||
37 | unsigned int distance, | ||
38 | char *sender_address, | ||
39 | size_t sender_address_len); | ||
40 | |||
41 | /** | ||
42 | * DV Message, contains a message that was received | ||
43 | * via DV for this peer! | ||
44 | * | ||
45 | * Sender address is copied to the end of this struct. | ||
46 | */ | ||
47 | struct GNUNET_DV_MessageReceived | ||
48 | { | ||
49 | /** | ||
50 | * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_MESSAGE | ||
51 | */ | ||
52 | struct GNUNET_MessageHeader header; | ||
53 | |||
54 | /** | ||
55 | * The sender of the message | ||
56 | */ | ||
57 | struct GNUNET_PeerIdentity *sender; | ||
58 | |||
59 | /** | ||
60 | * The message that was sent | ||
61 | */ | ||
62 | struct GNUNET_MessageHeader *msg; | ||
63 | |||
64 | /** | ||
65 | * The distance to the peer that we received the message from | ||
66 | */ | ||
67 | size_t distance; | ||
68 | |||
69 | /** | ||
70 | * Length of the sender address, appended to end of this message | ||
71 | */ | ||
72 | size_t sender_address_len; | ||
73 | |||
74 | }; | ||
75 | |||
76 | |||
77 | /** | ||
78 | * DV Message, indicates that we have learned of a new DV level peer. | ||
79 | * | ||
80 | * Sender address is copied to the end of this struct. | ||
81 | */ | ||
82 | struct GNUNET_DV_ConnectMessage | ||
83 | { | ||
84 | /** | ||
85 | * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_MESSAGE | ||
86 | */ | ||
87 | struct GNUNET_MessageHeader header; | ||
88 | |||
89 | /** | ||
90 | * The sender of the message | ||
91 | */ | ||
92 | struct GNUNET_PeerIdentity *sender; | ||
93 | |||
94 | /** | ||
95 | * The message that was sent | ||
96 | */ | ||
97 | struct GNUNET_MessageHeader *msg; | ||
98 | |||
99 | /** | ||
100 | * The distance to the peer that we received the message from | ||
101 | */ | ||
102 | size_t distance; | ||
103 | |||
104 | /** | ||
105 | * Length of the sender address, appended to end of this message | ||
106 | */ | ||
107 | size_t sender_address_len; | ||
108 | |||
109 | }; | ||
110 | |||
111 | |||
112 | /** | ||
113 | * Message to send a message over DV via a specific peer | ||
114 | */ | ||
115 | struct GNUNET_DV_SendMessage | ||
116 | { | ||
117 | /** | ||
118 | * Type: GNUNET_MESSAGE_TYPE_DV_SEND | ||
119 | */ | ||
120 | struct GNUNET_MessageHeader header; | ||
121 | |||
122 | /** | ||
123 | * Intended final recipient of this message | ||
124 | */ | ||
125 | struct GNUNET_PeerIdentity target; | ||
126 | |||
127 | /** | ||
128 | * The message(s) to be sent. | ||
129 | */ | ||
130 | char *msgbuf; | ||
131 | |||
132 | /** | ||
133 | * The size of the msgbuf | ||
134 | */ | ||
135 | size_t msgbuf_size; | ||
136 | |||
137 | /** | ||
138 | * Message priority | ||
139 | */ | ||
140 | size_t priority; | ||
141 | |||
142 | /** | ||
143 | * How long can we delay sending? | ||
144 | */ | ||
145 | struct GNUNET_TIME_Relative timeout; | ||
146 | |||
147 | /** | ||
148 | * Size of the address (appended to end of struct) | ||
149 | */ | ||
150 | size_t addrlen; | ||
151 | |||
152 | /* | ||
153 | * Sender, appended to end of struct tells via whom | ||
154 | * to send this message. | ||
155 | */ | ||
156 | |||
157 | }; | ||
158 | |||
159 | struct GNUNET_DV_Handle * | ||
160 | GNUNET_DV_connect (struct GNUNET_SCHEDULER_Handle *sched, | ||
161 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
162 | GNUNET_DV_MessageReceivedHandler receive_handler, | ||
163 | void *receive_handler_cls); | ||
164 | |||
165 | #endif | ||