aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_hello_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_hello_lib.h')
-rw-r--r--src/include/gnunet_hello_lib.h59
1 files changed, 35 insertions, 24 deletions
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h
index 694dfe066..8e96b5879 100644
--- a/src/include/gnunet_hello_lib.h
+++ b/src/include/gnunet_hello_lib.h
@@ -85,18 +85,6 @@ struct GNUNET_HELLO_Address
85 struct GNUNET_PeerIdentity peer; 85 struct GNUNET_PeerIdentity peer;
86 86
87 /** 87 /**
88 * Extended information about address
89 *
90 * This field contains additional #GNUNET_HELLO_AddressInfo flags e.g.
91 * to indicate an address is inbound and cannot be used to initiate an
92 * outbound connection.
93 *
94 * These information are only valid for the local peer and are not serialized
95 * when a #GNUNET_HELLO_Message is created
96 */
97 enum GNUNET_HELLO_AddressInfo local_info;
98
99 /**
100 * Name of the transport plugin enabling the communication using 88 * Name of the transport plugin enabling the communication using
101 * this address. 89 * this address.
102 */ 90 */
@@ -108,28 +96,43 @@ struct GNUNET_HELLO_Address
108 const void *address; 96 const void *address;
109 97
110 /** 98 /**
111 * Number of bytes in 'address'. 99 * Number of bytes in @e address.
112 */ 100 */
113 size_t address_length; 101 size_t address_length;
114 102
103 /**
104 * Extended information about address
105 *
106 * This field contains additional #GNUNET_HELLO_AddressInfo flags e.g.
107 * to indicate an address is inbound and cannot be used to initiate an
108 * outbound connection.
109 *
110 * These information are only valid for the local peer and are not serialized
111 * when a #GNUNET_HELLO_Message is created
112 */
113 enum GNUNET_HELLO_AddressInfo local_info;
114
115}; 115};
116 116
117
117/** 118/**
118 * Allocate an address struct. 119 * Allocate an address struct.
119 * 120 *
120 * @param peer the peer 121 * @param peer the peer
121 * @param transport_name plugin name 122 * @param transport_name plugin name
122 * @param address binary address 123 * @param address binary address
123 * @param address_length number of bytes in 'address' 124 * @param address_length number of bytes in @a address
124 * @param local_info additional local information for the address 125 * @param local_info additional local information for the address
125 * @return the address struct 126 * @return the address struct
126 */ 127 */
127struct GNUNET_HELLO_Address * 128struct GNUNET_HELLO_Address *
128GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer, 129GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
129 const char *transport_name, const void *address, 130 const char *transport_name,
131 const void *address,
130 size_t address_length, 132 size_t address_length,
131 enum GNUNET_HELLO_AddressInfo local_info); 133 enum GNUNET_HELLO_AddressInfo local_info);
132 134
135
133/** 136/**
134 * Copy an address struct. 137 * Copy an address struct.
135 * 138 *
@@ -146,12 +149,13 @@ GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address);
146 * 149 *
147 * @param a1 first address 150 * @param a1 first address
148 * @param a2 second address 151 * @param a2 second address
149 * @return 0 if the addresses are equal, -1 if a1<a2, 1 if a1>a2. 152 * @return 0 if the addresses are equal, -1 if @a a1< @a a2, 1 if @a a1> @a a2.
150 */ 153 */
151int 154int
152GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1, 155GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
153 const struct GNUNET_HELLO_Address *a2); 156 const struct GNUNET_HELLO_Address *a2);
154 157
158
155/** 159/**
156 * Get the size of an address struct. 160 * Get the size of an address struct.
157 * 161 *
@@ -161,16 +165,17 @@ GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
161size_t 165size_t
162GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address); 166GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address);
163 167
168
164/** 169/**
165 * Check if an address has a local option set 170 * Check if an address has a local option set
166 * 171 *
167 * @param address the address to check 172 * @param address the address to check
168 * @param option the respective option to check for 173 * @param option the respective option to check for
169 * @return GNUNET_YES or GNUNET_NO 174 * @return #GNUNET_YES or #GNUNET_NO
170 */ 175 */
171int 176int
172GNUNET_HELLO_address_check_option (const struct GNUNET_HELLO_Address * address, 177GNUNET_HELLO_address_check_option (const struct GNUNET_HELLO_Address *address,
173 enum GNUNET_HELLO_AddressInfo option); 178 enum GNUNET_HELLO_AddressInfo option);
174 179
175 180
176/** 181/**
@@ -184,7 +189,7 @@ GNUNET_HELLO_address_check_option (const struct GNUNET_HELLO_Address * address,
184/** 189/**
185 * A HELLO message is used to exchange information about 190 * A HELLO message is used to exchange information about
186 * transports with other peers. This struct is guaranteed 191 * transports with other peers. This struct is guaranteed
187 * to start with a "GNUNET_MessageHeader", everything else 192 * to start with a `struct GNUNET_MessageHeader`, everything else
188 * should be internal to the HELLO library. 193 * should be internal to the HELLO library.
189 */ 194 */
190struct GNUNET_HELLO_Message; 195struct GNUNET_HELLO_Message;
@@ -213,7 +218,8 @@ GNUNET_HELLO_is_friend_only (const struct GNUNET_HELLO_Message *h);
213 */ 218 */
214size_t 219size_t
215GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address, 220GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address,
216 struct GNUNET_TIME_Absolute expiration, char *target, 221 struct GNUNET_TIME_Absolute expiration,
222 char *target,
217 size_t max); 223 size_t max);
218 224
219 225
@@ -239,9 +245,13 @@ typedef size_t
239 * expiration time and an iterator that spews the 245 * expiration time and an iterator that spews the
240 * transport addresses. 246 * transport addresses.
241 * 247 *
242 * If friend only is set to #GNUNET_YES we create a FRIEND_HELLO which will 248 * If friend only is set to #GNUNET_YES we create a FRIEND_HELLO which
243 * not be gossiped to other peers 249 * will not be gossiped to other peers.
244 * 250 *
251 * @param publicKey public key to include in the HELLO
252 * @param addrgen callback to invoke to get addresses
253 * @param addrgen_cls closure for @a addrgen
254 * @param friend_only should the returned HELLO be only visible to friends?
245 * @return the hello message 255 * @return the hello message
246 */ 256 */
247struct GNUNET_HELLO_Message * 257struct GNUNET_HELLO_Message *
@@ -349,7 +359,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
349 * @param expiration_limit ignore addresses in old_hello 359 * @param expiration_limit ignore addresses in old_hello
350 * that expired before the given time stamp 360 * that expired before the given time stamp
351 * @param it iterator to call on each address 361 * @param it iterator to call on each address
352 * @param it_cls closure for it 362 * @param it_cls closure for @a it
353 */ 363 */
354void 364void
355GNUNET_HELLO_iterate_new_addresses (const struct GNUNET_HELLO_Message *new_hello, 365GNUNET_HELLO_iterate_new_addresses (const struct GNUNET_HELLO_Message *new_hello,
@@ -410,6 +420,7 @@ char *
410GNUNET_HELLO_compose_uri (const struct GNUNET_HELLO_Message *hello, 420GNUNET_HELLO_compose_uri (const struct GNUNET_HELLO_Message *hello,
411 GNUNET_HELLO_TransportPluginsFind plugins_find); 421 GNUNET_HELLO_TransportPluginsFind plugins_find);
412 422
423
413/** 424/**
414 * Parse a hello URI string to a hello message. 425 * Parse a hello URI string to a hello message.
415 * 426 *