aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-01-13 16:56:29 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-01-13 16:56:29 +0000
commit10cb35698e245a9f02e577d60541d7e09d7f05ca (patch)
tree0dc33499c14624870cf1034e5195b613557a8dc1 /src
parentdd610f2588f8c53cb677722377301fb641da5c23 (diff)
downloadgnunet-10cb35698e245a9f02e577d60541d7e09d7f05ca.tar.gz
gnunet-10cb35698e245a9f02e577d60541d7e09d7f05ca.zip
implementing 0003268
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_hello_lib.h40
-rw-r--r--src/include/gnunet_transport_plugin.h47
2 files changed, 52 insertions, 35 deletions
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h
index 609cb2822..a6b9ccb72 100644
--- a/src/include/gnunet_hello_lib.h
+++ b/src/include/gnunet_hello_lib.h
@@ -48,6 +48,28 @@ extern "C"
48 */ 48 */
49#define GNUNET_FRIEND_HELLO_URI_PREFIX "gnunet://friend-hello/" 49#define GNUNET_FRIEND_HELLO_URI_PREFIX "gnunet://friend-hello/"
50 50
51
52/**
53 * Additional local information about an address
54 *
55 * These information are only valid for the local peer and are not serialized
56 * when a #GNUNET_HELLO_Message is created
57 */
58enum GNUNET_HELLO_AddressInfo
59{
60 /**
61 * No additional information
62 */
63 GNUNET_HELLO_ADDRESS_INFO_NONE = 0,
64
65 /**
66 * This is an inbound address and cannot be used to initiate an outbound
67 * connection to another peer
68 */
69 GNUNET_HELLO_ADDRESS_INFO_INBOUND = 1
70};
71
72
51/** 73/**
52 * An address for communicating with a peer. We frequently 74 * An address for communicating with a peer. We frequently
53 * need this tuple and the components cannot really be 75 * need this tuple and the components cannot really be
@@ -63,6 +85,18 @@ struct GNUNET_HELLO_Address
63 struct GNUNET_PeerIdentity peer; 85 struct GNUNET_PeerIdentity peer;
64 86
65 /** 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 /**
66 * Name of the transport plugin enabling the communication using 100 * Name of the transport plugin enabling the communication using
67 * this address. 101 * this address.
68 */ 102 */
@@ -88,12 +122,14 @@ struct GNUNET_HELLO_Address
88 * @param transport_name plugin name 122 * @param transport_name plugin name
89 * @param address binary address 123 * @param address binary address
90 * @param address_length number of bytes in 'address' 124 * @param address_length number of bytes in 'address'
125 * @param local_info additional address information, will not get serialized
91 * @return the address struct 126 * @return the address struct
92 */ 127 */
93struct GNUNET_HELLO_Address * 128struct GNUNET_HELLO_Address *
94GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer, 129GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
95 const char *transport_name, const void *address, 130 const char *transport_name, const void *address,
96 size_t address_length); 131 size_t address_length,
132 enum GNUNET_HELLO_AddressInfo local_info);
97 133
98 134
99/** 135/**
@@ -118,7 +154,6 @@ int
118GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1, 154GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
119 const struct GNUNET_HELLO_Address *a2); 155 const struct GNUNET_HELLO_Address *a2);
120 156
121
122/** 157/**
123 * Get the size of an address struct. 158 * Get the size of an address struct.
124 * 159 *
@@ -128,6 +163,7 @@ GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
128size_t 163size_t
129GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address); 164GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address);
130 165
166
131/** 167/**
132 * Free an address. 168 * Free an address.
133 * 169 *
diff --git a/src/include/gnunet_transport_plugin.h b/src/include/gnunet_transport_plugin.h
index 62c8f1638..bf84819ad 100644
--- a/src/include/gnunet_transport_plugin.h
+++ b/src/include/gnunet_transport_plugin.h
@@ -82,26 +82,17 @@ typedef void
82 struct Session *session); 82 struct Session *session);
83 83
84/** 84/**
85 * Function that will be called whenever the plugin internally 85 * Plugin tells transport service about a new inbound session
86 * creates a new session and hence transport need to tell ATS.
87 * This happens when we have a inbound connection we did not
88 * initiate.
89 * 86 *
90 * @param cls closure 87 * @param cls unused
91 * @param peer peer 88 * @param address the address
92 * @param plugin plugin 89 * @param session the new session
93 * @param address address 90 * @param ats ats information
94 * @param address_len length of the @a address 91 * @param ats_count number of @a ats information
95 * @param session session
96 * @param ats ATS information
97 * @param ats_count number of entries in @a ats array
98 */ 92 */
99typedef void 93typedef void
100(*GNUNET_TRANSPORT_SessionStart) (void *cls, 94(*GNUNET_TRANSPORT_SessionStart) (void *cls,
101 const struct GNUNET_PeerIdentity *peer, 95 struct GNUNET_HELLO_Address *address,
102 const char *plugin,
103 const void *address,
104 uint16_t address_len,
105 struct Session *session, 96 struct Session *session,
106 const struct GNUNET_ATS_Information *ats, 97 const struct GNUNET_ATS_Information *ats,
107 uint32_t ats_count); 98 uint32_t ats_count);
@@ -130,11 +121,9 @@ typedef void
130 */ 121 */
131typedef struct GNUNET_TIME_Relative 122typedef struct GNUNET_TIME_Relative
132(*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls, 123(*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls,
133 const struct GNUNET_PeerIdentity *peer, 124 const struct GNUNET_HELLO_Address *address,
134 const struct GNUNET_MessageHeader *message, 125 struct Session *session,
135 struct Session *session, 126 const struct GNUNET_MessageHeader *message);
136 const char *sender_address,
137 uint16_t sender_address_len);
138 127
139 128
140/** 129/**
@@ -165,9 +154,7 @@ typedef struct GNUNET_ATS_Information
165 */ 154 */
166typedef void 155typedef void
167(*GNUNET_TRANSPORT_UpdateAddressMetrics) (void *cls, 156(*GNUNET_TRANSPORT_UpdateAddressMetrics) (void *cls,
168 const struct GNUNET_PeerIdentity *peer, 157 const struct GNUNET_HELLO_Address *address,
169 const void *address,
170 uint16_t address_len,
171 struct Session *session, 158 struct Session *session,
172 const struct GNUNET_ATS_Information *ats, 159 const struct GNUNET_ATS_Information *ats,
173 uint32_t ats_count); 160 uint32_t ats_count);
@@ -179,17 +166,11 @@ typedef void
179 * @param cls closure 166 * @param cls closure
180 * @param add_remove should the address added (#GNUNET_YES) or removed (#GNUNET_NO) from the 167 * @param add_remove should the address added (#GNUNET_YES) or removed (#GNUNET_NO) from the
181 * set of valid addresses? 168 * set of valid addresses?
182 * @param addr one of the addresses of the host 169 * @param address the address to add or remove
183 * the specific address format depends on the transport
184 * @param addrlen length of the @a addr
185 * @param dest_plugin plugin to use this address with
186 */ 170 */
187typedef void 171typedef void
188(*GNUNET_TRANSPORT_AddressNotification) (void *cls, 172(*GNUNET_TRANSPORT_AddressNotification) (void *cls, int add_remove,
189 int add_remove, 173 const struct GNUNET_HELLO_Address *address);
190 const void *addr,
191 size_t addrlen,
192 const char *dest_plugin);
193 174
194 175
195/** 176/**