2 This file is part of GNUnet.
3 Copyright (C) 2009-2016 GNUnet e.V.
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 3, or (at your
8 option) any later version.
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.
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Christian Grothoff
25 * obtain information about our current address
27 * @defgroup transport Transport service
30 * @see [Documentation](https://gnunet.org/transport-service)
34 #ifndef GNUNET_TRANSPORT_HELLO_SERVICE_H
35 #define GNUNET_TRANSPORT_HELLO_SERVICE_H
40 #if 0 /* keep Emacsens' auto-indent happy */
45 #include "gnunet_util_lib.h"
46 #include "gnunet_ats_service.h"
49 * Version number of the transport API.
51 #define GNUNET_TRANSPORT_HELLO_VERSION 0x00000000
55 * Function called whenever there is an update to the
59 * @param hello our updated HELLO
62 (*GNUNET_TRANSPORT_HelloUpdateCallback) (void *cls,
63 const struct GNUNET_MessageHeader *hello);
67 * Handle to cancel a #GNUNET_TRANSPORT_hello_get() operation.
69 struct GNUNET_TRANSPORT_GetHelloHandle;
73 * Obtain updates on changes to the HELLO message for this peer. The callback
74 * given in this function is never called synchronously.
76 * @param cfg configuration to use
77 * @param nt which network type should the addresses from the HELLO belong to?
78 * @param rec function to call with the HELLO
79 * @param rec_cls closure for @a rec
80 * @return handle to cancel the operation
82 struct GNUNET_TRANSPORT_GetHelloHandle *
83 GNUNET_TRANSPORT_hello_get (struct GNUNET_CONFIGURATION_Handle *cfg,
84 enum GNUNET_ATS_Network_Type nt,
85 GNUNET_TRANSPORT_HelloUpdateCallback rec,
90 * Stop receiving updates about changes to our HELLO message.
92 * @param ghh handle to cancel
95 GNUNET_TRANSPORT_hello_get_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh);
99 * Function with addresses found in a HELLO.
102 * @param peer identity of the peer
103 * @param address the address (UTF-8, 0-terminated)
104 * @param nt network type of the address
105 * @param expiration when does this address expire?
108 (*GNUNET_TRANSPORT_AddressCallback) (void *cls,
109 const struct GNUNET_PeerIdentity *peer,
111 enum GNUNET_ATS_Network_Type nt,
112 struct GNUNET_TIME_Absolute expiration);
116 * Parse a HELLO message that we have received into its
117 * constituent addresses.
119 * @param hello message to parse
120 * @param cb function to call on each address found
121 * @param cb_cls closure for @a cb
122 * @return #GNUNET_OK if hello was well-formed, #GNUNET_SYSERR if not
125 GNUNET_TRANSPORT_hello_parse (const struct GNUNET_MessageHeader *hello,
126 GNUNET_TRANSPORT_AddressCallback cb,
130 #if 0 /* keep Emacsens' auto-indent happy */
137 /* ifndef GNUNET_TRANSPORT_HELLO_SERVICE_H */
140 /** @} */ /* end of group */
142 /* end of gnunet_transport_hello_service.h */