gnunet_transport_plugin.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. /*
  2. This file is part of GNUnet
  3. Copyright (C) 2009-2014 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @author Christian Grothoff
  18. *
  19. * @file
  20. * Transport service plugin API
  21. *
  22. * @defgroup transport-plugin Transport Service plugin API
  23. *
  24. * Specifies the struct that is given to the plugin's entry method and the other
  25. * struct that must be returned. Note that the destructors of transport plugins
  26. * will be given the value returned by the constructor and is expected to return
  27. * a NULL pointer.
  28. *
  29. * @{
  30. */
  31. #ifndef PLUGIN_TRANSPORT_H
  32. #define PLUGIN_TRANSPORT_H
  33. #include "gnunet_configuration_lib.h"
  34. #include "gnunet_scheduler_lib.h"
  35. #include "gnunet_statistics_service.h"
  36. #include "gnunet_transport_service.h"
  37. #include "gnunet_ats_service.h"
  38. #define TRANSPORT_SESSION_INBOUND_STRING "<inbound>"
  39. /**
  40. * Opaque pointer that plugins can use to distinguish specific
  41. * connections to a given peer. Typically used by stateful plugins to
  42. * allow the service to refer to specific streams instead of a more
  43. * general notion of "some connection" to the given peer. This is
  44. * useful since sometimes (i.e. for inbound TCP connections) a
  45. * connection may not have an address that can be used for meaningful
  46. * distinction between sessions to the same peer.
  47. *
  48. * Each 'struct GNUNET_ATS_Session' MUST start with the 'struct GNUNET_PeerIdentity'
  49. * of the peer the session is for (which will be used for some error
  50. * checking by the ATS code).
  51. */
  52. struct GNUNET_ATS_Session;
  53. /**
  54. * Function that will be called whenever the plugin internally
  55. * cleans up a session pointer and hence the service needs to
  56. * discard all of those sessions as well. Plugins that do not
  57. * use sessions can simply omit calling this function and always
  58. * use NULL wherever a session pointer is needed. This function
  59. * should be called BEFORE a potential "TransmitContinuation"
  60. * from the "TransmitFunction".
  61. *
  62. * @param cls closure
  63. * @param peer which peer was the session for
  64. * @param session which session is being destroyed
  65. */
  66. typedef void
  67. (*GNUNET_TRANSPORT_SessionEnd) (void *cls,
  68. const struct GNUNET_HELLO_Address *address,
  69. struct GNUNET_ATS_Session *session);
  70. /**
  71. * Plugin tells transport service about a new inbound session
  72. *
  73. * @param cls unused
  74. * @param address the address
  75. * @param session the new session
  76. * @param net network information
  77. */
  78. typedef void
  79. (*GNUNET_TRANSPORT_SessionStart) (void *cls,
  80. const struct GNUNET_HELLO_Address *address,
  81. struct GNUNET_ATS_Session *session,
  82. enum GNUNET_NetworkType net);
  83. /**
  84. * Function called by the transport for each received message.
  85. * This function should also be called with "NULL" for the
  86. * message to signal that the other peer disconnected.
  87. *
  88. * @param cls closure
  89. * @param peer (claimed) identity of the other peer
  90. * @param message the message, NULL if we only care about
  91. * learning about the delay until we should receive again
  92. * @param session identifier used for this session (NULL for plugins
  93. * that do not offer bi-directional communication to the sender
  94. * using the same "connection")
  95. * @param sender_address binary address of the sender (if we established the
  96. * connection or are otherwise sure of it; should be NULL
  97. * for inbound TCP/UDP connections since it it not clear
  98. * that we could establish ourselves a connection to that
  99. * IP address and get the same system)
  100. * @param sender_address_len number of bytes in @a sender_address
  101. * @return how long the plugin should wait until receiving more data;
  102. * returning #GNUNET_TIME_UNIT_FOREVER_REL means that the
  103. * connection should be closed
  104. */
  105. typedef struct GNUNET_TIME_Relative
  106. (*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls,
  107. const struct
  108. GNUNET_HELLO_Address *address,
  109. struct GNUNET_ATS_Session *session,
  110. const struct
  111. GNUNET_MessageHeader *message);
  112. /**
  113. * Function that can be called by plugins to figure if an address is
  114. * an loopback, LAN or WAN address. Ultimately invokes
  115. * #GNUNET_ATS_address_get_type().
  116. *
  117. * @param cls closure
  118. * @param addr binary address
  119. * @param addrlen length of the @a addr
  120. * @return type of the network the address belongs to
  121. */
  122. typedef enum GNUNET_NetworkType
  123. (*GNUNET_TRANSPORT_AddressToType)(void *cls,
  124. const struct sockaddr *addr,
  125. size_t addrlen);
  126. /**
  127. * Function called when distance of an address changes.
  128. *
  129. * @param cls closure
  130. * @param peer peer
  131. * @param distance new distance
  132. */
  133. typedef void
  134. (*GNUNET_TRANSPORT_UpdateAddressDistance) (void *cls,
  135. const struct
  136. GNUNET_HELLO_Address *address,
  137. uint32_t distance);
  138. /**
  139. * Function that will be called for each address the transport
  140. * is aware that it might be reachable under.
  141. *
  142. * @param cls closure
  143. * @param add_remove should the address added (#GNUNET_YES) or removed (#GNUNET_NO) from the
  144. * set of valid addresses?
  145. * @param address the address to add or remove
  146. */
  147. typedef void
  148. (*GNUNET_TRANSPORT_AddressNotification) (void *cls,
  149. int add_remove,
  150. const struct
  151. GNUNET_HELLO_Address *address);
  152. /**
  153. * Function that will be called whenever the plugin receives data over
  154. * the network and wants to determine how long it should wait until
  155. * the next time it reads from the given peer. Note that some plugins
  156. * (such as UDP) may not be able to wait (for a particular peer), so
  157. * the waiting part is optional. Plugins that can wait should call
  158. * this function, sleep the given amount of time, and call it again
  159. * (with zero bytes read) UNTIL it returns zero and only then read.
  160. *
  161. * @param cls closure
  162. * @param peer which peer did we read data from
  163. * @param amount_recved number of bytes read (can be zero)
  164. * @return how long to wait until reading more from this peer
  165. * (to enforce inbound quotas); returning #GNUNET_TIME_UNIT_FOREVER_REL
  166. * means that the connection should be closed
  167. */
  168. typedef struct GNUNET_TIME_Relative
  169. (*GNUNET_TRANSPORT_TrafficReport) (void *cls,
  170. const struct GNUNET_PeerIdentity *peer,
  171. size_t amount_recved);
  172. /**
  173. * Function that returns a HELLO message.
  174. *
  175. * @return HELLO message (FIXME with what?)
  176. */
  177. typedef const struct GNUNET_MessageHeader *
  178. (*GNUNET_TRANSPORT_GetHelloCallback) (void);
  179. /**
  180. * The transport service will pass a pointer to a struct
  181. * of this type as the first and only argument to the
  182. * entry point of each transport plugin.
  183. */
  184. struct GNUNET_TRANSPORT_PluginEnvironment
  185. {
  186. /**
  187. * Configuration to use.
  188. */
  189. const struct GNUNET_CONFIGURATION_Handle *cfg;
  190. /**
  191. * Identity of this peer.
  192. */
  193. const struct GNUNET_PeerIdentity *my_identity;
  194. /**
  195. * Closure for the various callbacks.
  196. */
  197. void *cls;
  198. /**
  199. * Handle for reporting statistics.
  200. */
  201. struct GNUNET_STATISTICS_Handle *stats;
  202. /**
  203. * Function that should be called by the transport plugin
  204. * whenever a message is received. If this field is "NULL",
  205. * the plugin should load in 'stub' mode and NOT fully
  206. * initialize and instead only return an API with the
  207. * @e address_pretty_printer, @e address_to_string and
  208. * @e string_to_address functions.
  209. */
  210. GNUNET_TRANSPORT_PluginReceiveCallback receive;
  211. /**
  212. * Function that returns our HELLO.
  213. */
  214. GNUNET_TRANSPORT_GetHelloCallback get_our_hello;
  215. /**
  216. * Function that must be called by each plugin to notify the
  217. * transport service about the addresses under which the transport
  218. * provided by the plugin can be reached.
  219. */
  220. GNUNET_TRANSPORT_AddressNotification notify_address;
  221. /**
  222. * Function that must be called by the plugin when a non-NULL
  223. * session handle stops being valid (is destroyed).
  224. */
  225. GNUNET_TRANSPORT_SessionEnd session_end;
  226. /**
  227. * Function called by the plugin when a new (incoming) session was created
  228. * not explicitly created using the the get_session function
  229. */
  230. GNUNET_TRANSPORT_SessionStart session_start;
  231. /**
  232. * Function that will be called to figure if an address is an loopback,
  233. * LAN, WAN etc. address
  234. */
  235. GNUNET_TRANSPORT_AddressToType get_address_type;
  236. /**
  237. * Function that will be called by DV to update distance for
  238. * an address.
  239. */
  240. GNUNET_TRANSPORT_UpdateAddressDistance update_address_distance;
  241. /**
  242. * What is the maximum number of connections that this transport
  243. * should allow? Transports that do not have sessions (such as
  244. * UDP) can ignore this value.
  245. */
  246. uint32_t max_connections;
  247. };
  248. /**
  249. * Function called by the #GNUNET_TRANSPORT_TransmitFunction
  250. * upon "completion". In the case that a peer disconnects,
  251. * this function must be called for each pending request
  252. * (with a 'failure' indication) AFTER notifying the service
  253. * about the disconnect event (so that the service won't try
  254. * to transmit more messages, believing the connection still
  255. * exists...).
  256. *
  257. * @param cls closure
  258. * @param target who was the recipient of the message?
  259. * @param result #GNUNET_OK on success
  260. * #GNUNET_SYSERR if the target disconnected;
  261. * disconnect will ALSO be signalled using
  262. * the ReceiveCallback.
  263. * @param size_payload bytes of payload from transport service in message
  264. * @param size_on_wire bytes required on wire for transmission,
  265. * 0 if result == #GNUNET_SYSERR
  266. */
  267. typedef void
  268. (*GNUNET_TRANSPORT_TransmitContinuation) (void *cls,
  269. const struct
  270. GNUNET_PeerIdentity *target,
  271. int result,
  272. size_t size_payload,
  273. size_t size_on_wire);
  274. /**
  275. * The new send function with just the session and no address
  276. *
  277. * Function that can be used by the transport service to transmit
  278. * a message using the plugin. Note that in the case of a
  279. * peer disconnecting, the continuation MUST be called
  280. * prior to the disconnect notification itself. This function
  281. * will be called with this peer's HELLO message to initiate
  282. * a fresh connection to another peer.
  283. *
  284. * @param cls closure
  285. * @param session which session must be used
  286. * @param msgbuf the message to transmit
  287. * @param msgbuf_size number of bytes in @a msgbuf
  288. * @param priority how important is the message (most plugins will
  289. * ignore message priority and just FIFO)
  290. * @param to how long to wait at most for the transmission (does not
  291. * require plugins to discard the message after the timeout,
  292. * just advisory for the desired delay; most plugins will ignore
  293. * this as well)
  294. * @param cont continuation to call once the message has
  295. * been transmitted (or if the transport is ready
  296. * for the next transmission call; or if the
  297. * peer disconnected...); can be NULL
  298. * @param cont_cls closure for @a cont
  299. * @return number of bytes used (on the physical network, with overheads);
  300. * -1 on hard errors (i.e. address invalid); 0 is a legal value
  301. * and does NOT mean that the message was not transmitted (DV)
  302. */
  303. typedef ssize_t
  304. (*GNUNET_TRANSPORT_TransmitFunction) (void *cls,
  305. struct GNUNET_ATS_Session *session,
  306. const char *msgbuf,
  307. size_t msgbuf_size,
  308. unsigned int priority,
  309. struct GNUNET_TIME_Relative to,
  310. GNUNET_TRANSPORT_TransmitContinuation cont,
  311. void *cont_cls);
  312. /**
  313. * Function that can be called to force a disconnect from the
  314. * specified neighbour for the given session only. . This should
  315. * also cancel all previously scheduled transmissions for this
  316. * session. Obviously the transmission may have been partially
  317. * completed already, which is OK. The plugin is supposed to close
  318. * the connection (if applicable).
  319. *
  320. * @param cls closure with the `struct Plugin`
  321. * @param session session to destroy
  322. * @return #GNUNET_OK on success
  323. */
  324. typedef int
  325. (*GNUNET_TRANSPORT_DisconnectSessionFunction) (void *cls,
  326. struct GNUNET_ATS_Session *
  327. session);
  328. /**
  329. * Function that is called to get the keepalive factor.
  330. * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
  331. * calculate the interval between keepalive packets.
  332. *
  333. * @param cls closure with the `struct Plugin`
  334. * @return keepalive factor
  335. */
  336. typedef unsigned int
  337. (*GNUNET_TRANSPORT_QueryKeepaliveFactorFunction) (void *cls);
  338. /**
  339. * Function that can be called to force a disconnect from the
  340. * specified neighbour. This should also cancel all previously
  341. * scheduled transmissions. Obviously the transmission may have been
  342. * partially completed already, which is OK. The plugin is supposed
  343. * to close the connection (if applicable) and no longer call the
  344. * transmit continuation(s).
  345. *
  346. * @param cls closure
  347. * @param target peer for which the last transmission is
  348. * to be cancelled
  349. */
  350. typedef void
  351. (*GNUNET_TRANSPORT_DisconnectPeerFunction) (void *cls,
  352. const struct
  353. GNUNET_PeerIdentity *target);
  354. /**
  355. * Function called by the pretty printer for the resolved address for
  356. * each human-readable address obtained. The callback can be called
  357. * several times. The last invocation must be with a @a address of
  358. * NULL and a @a res of #GNUNET_OK. Thus, to indicate conversion
  359. * errors, the callback might be called first with @a address NULL and
  360. * @a res being #GNUNET_SYSERR. In that case, there must still be a
  361. * subsequent call later with @a address NULL and @a res #GNUNET_OK.
  362. *
  363. * @param cls closure
  364. * @param address one of the names for the host, NULL on last callback
  365. * @param res #GNUNET_OK if conversion was successful, #GNUNET_SYSERR on failure,
  366. * #GNUNET_OK on last callback
  367. */
  368. typedef void
  369. (*GNUNET_TRANSPORT_AddressStringCallback) (void *cls,
  370. const char *address,
  371. int res);
  372. /**
  373. * Convert the transports address to a nice, human-readable
  374. * format.
  375. *
  376. * @param cls closure
  377. * @param type name of the transport that generated the address
  378. * @param addr one of the addresses of the host, NULL for the last address
  379. * the specific address format depends on the transport
  380. * @param addrlen length of the @a addr
  381. * @param numeric should (IP) addresses be displayed in numeric form?
  382. * @param timeout after how long should we give up?
  383. * @param asc function to call on each string
  384. * @param asc_cls closure for @a asc
  385. */
  386. typedef void
  387. (*GNUNET_TRANSPORT_AddressPrettyPrinter) (void *cls,
  388. const char *type,
  389. const void *addr,
  390. size_t addrlen,
  391. int numeric,
  392. struct GNUNET_TIME_Relative timeout,
  393. GNUNET_TRANSPORT_AddressStringCallback
  394. asc,
  395. void *asc_cls);
  396. /**
  397. * Another peer has suggested an address for this peer and transport
  398. * plugin. Check that this could be a valid address. This function
  399. * is not expected to 'validate' the address in the sense of trying to
  400. * connect to it but simply to see if the binary format is technically
  401. * legal for establishing a connection to this peer (and make sure that
  402. * the address really corresponds to our network connection/settings
  403. * and not some potential man-in-the-middle).
  404. *
  405. * @param addr pointer to the address
  406. * @param addrlen length of @a addr
  407. * @return #GNUNET_OK if this is a plausible address for this peer
  408. * and transport, #GNUNET_SYSERR if not
  409. */
  410. typedef int
  411. (*GNUNET_TRANSPORT_CheckAddress) (void *cls,
  412. const void *addr,
  413. size_t addrlen);
  414. /**
  415. * Create a new session to transmit data to the target
  416. * This session will used to send data to this peer and the plugin will
  417. * notify us by calling the env->session_end function
  418. *
  419. * @param cls the plugin
  420. * @param address the hello address
  421. * @return the session if the address is valid, NULL otherwise
  422. */
  423. typedef struct GNUNET_ATS_Session *
  424. (*GNUNET_TRANSPORT_CreateSession) (void *cls,
  425. const struct GNUNET_HELLO_Address *address);
  426. /**
  427. * Function that will be called whenever the transport service wants to
  428. * notify the plugin that a session is still active and in use and
  429. * therefore the session timeout for this session has to be updated
  430. *
  431. * @param cls closure
  432. * @param peer which peer was the session for
  433. * @param session which session is being updated
  434. */
  435. typedef void
  436. (*GNUNET_TRANSPORT_UpdateSessionTimeout) (void *cls,
  437. const struct
  438. GNUNET_PeerIdentity *peer,
  439. struct GNUNET_ATS_Session *session);
  440. /**
  441. * Function that will be called whenever the transport service wants to
  442. * notify the plugin that the inbound quota changed and that the plugin
  443. * should update it's delay for the next receive value
  444. *
  445. * @param cls closure
  446. * @param peer which peer was the session for
  447. * @param session which session is being updated
  448. * @param delay new delay to use for receiving
  449. */
  450. typedef void
  451. (*GNUNET_TRANSPORT_UpdateInboundDelay) (void *cls,
  452. const struct GNUNET_PeerIdentity *peer,
  453. struct GNUNET_ATS_Session *session,
  454. struct GNUNET_TIME_Relative delay);
  455. /**
  456. * Function called for a quick conversion of the binary address to
  457. * a numeric address. Note that the caller must not free the
  458. * address and that the next call to this function is allowed
  459. * to override the address again.
  460. *
  461. * @param cls closure
  462. * @param addr binary address
  463. * @param addr_len length of the @a addr
  464. * @return string representing the same address
  465. */
  466. typedef const char *
  467. (*GNUNET_TRANSPORT_AddressToString) (void *cls,
  468. const void *addr,
  469. size_t addrlen);
  470. /**
  471. * Function called to convert a string address to
  472. * a binary address.
  473. *
  474. * @param cls closure (`struct Plugin*`)
  475. * @param addr string address
  476. * @param addrlen length of the @a addr including \0 termination
  477. * @param buf location to store the buffer
  478. * If the function returns #GNUNET_SYSERR, its contents are undefined.
  479. * @param added length of created address
  480. * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
  481. */
  482. typedef int
  483. (*GNUNET_TRANSPORT_StringToAddress) (void *cls,
  484. const char *addr,
  485. uint16_t addrlen,
  486. void **buf,
  487. size_t *added);
  488. /**
  489. * Function to obtain the network type for a session
  490. *
  491. * @param cls closure (`struct Plugin *`)
  492. * @param session the session
  493. * @return the network type
  494. */
  495. typedef enum GNUNET_NetworkType
  496. (*GNUNET_TRANSPORT_GetNetworkType)(void *cls,
  497. struct GNUNET_ATS_Session *session);
  498. /**
  499. * Function to obtain the network type for an address.
  500. *
  501. * @param cls closure (`struct Plugin *`)
  502. * @param address the address
  503. * @return the network type
  504. */
  505. typedef enum GNUNET_NetworkType
  506. (*GNUNET_TRANSPORT_GetNetworkTypeForAddress)(void *cls,
  507. const struct
  508. GNUNET_HELLO_Address *address);
  509. /**
  510. * Function called by the plugin with information about the
  511. * current sessions managed by the plugin (for monitoring).
  512. *
  513. * @param cls closure
  514. * @param session session handle this information is about,
  515. * NULL to indicate that we are "in sync" (initial
  516. * iteration complete)
  517. * @param info information about the state of the session,
  518. * NULL if @a session is also NULL and we are
  519. * merely signalling that the initial iteration is over
  520. */
  521. typedef void
  522. (*GNUNET_TRANSPORT_SessionInfoCallback) (void *cls,
  523. struct GNUNET_ATS_Session *session,
  524. const struct
  525. GNUNET_TRANSPORT_SessionInfo *info);
  526. /**
  527. * Begin monitoring sessions of a plugin. There can only
  528. * be one active monitor per plugin (i.e. if there are
  529. * multiple monitors, the transport service needs to
  530. * multiplex the generated events over all of them).
  531. *
  532. * @param cls closure of the plugin
  533. * @param sic callback to invoke, NULL to disable monitor;
  534. * plugin will being by iterating over all active
  535. * sessions immediately and then enter monitor mode
  536. * @param sic_cls closure for @a sic
  537. */
  538. typedef void
  539. (*GNUNET_TRANSPORT_SessionMonitorSetup) (void *cls,
  540. GNUNET_TRANSPORT_SessionInfoCallback
  541. sic,
  542. void *sic_cls);
  543. /**
  544. * Each plugin is required to return a pointer to a struct of this
  545. * type as the return value from its entry point.
  546. */
  547. struct GNUNET_TRANSPORT_PluginFunctions
  548. {
  549. /**
  550. * Closure for all of the callbacks.
  551. */
  552. void *cls;
  553. /**
  554. * Function that the transport service will use to transmit data to
  555. * another peer. May be NULL for plugins that only support
  556. * receiving data. After this call, the plugin call the specified
  557. * continuation with success or error before notifying us about the
  558. * target having disconnected.
  559. */
  560. GNUNET_TRANSPORT_TransmitFunction send;
  561. /**
  562. * Function that can be used to force the plugin to disconnect from
  563. * the given peer and cancel all previous transmissions (and their
  564. * continuations).
  565. */
  566. GNUNET_TRANSPORT_DisconnectPeerFunction disconnect_peer;
  567. /**
  568. * Function that can be used to force the plugin to disconnect from
  569. * the given peer and cancel all previous transmissions (and their
  570. * continuations).
  571. */
  572. GNUNET_TRANSPORT_DisconnectSessionFunction disconnect_session;
  573. /**
  574. * Function that will be called whenever the transport service wants to
  575. * notify the plugin that a session is still active and in use and
  576. * therefore the session timeout for this session has to be updated
  577. */
  578. GNUNET_TRANSPORT_UpdateSessionTimeout update_session_timeout;
  579. /**
  580. * Function that will be called whenever the transport service wants to
  581. * notify the plugin that the inbound quota changed and that the plugin
  582. * should update it's delay for the next receive value
  583. */
  584. GNUNET_TRANSPORT_UpdateInboundDelay update_inbound_delay;
  585. /**
  586. * Function that is used to query keepalive factor.
  587. * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
  588. * calculate the interval between keepalive packets.
  589. */
  590. GNUNET_TRANSPORT_QueryKeepaliveFactorFunction query_keepalive_factor;
  591. /**
  592. * Function to pretty-print addresses.
  593. */
  594. GNUNET_TRANSPORT_AddressPrettyPrinter address_pretty_printer;
  595. /**
  596. * Function that will be called to check if a binary address
  597. * for this plugin is well-formed and corresponds to an
  598. * address for THIS peer (as per our configuration). Naturally,
  599. * if absolutely necessary, plugins can be a bit conservative in
  600. * their answer, but in general plugins should make sure that the
  601. * address does not redirect traffic to a 3rd party that might
  602. * try to man-in-the-middle our traffic.
  603. */
  604. GNUNET_TRANSPORT_CheckAddress check_address;
  605. /**
  606. * Function that will be called to convert a binary address
  607. * to a string (numeric conversion only).
  608. */
  609. GNUNET_TRANSPORT_AddressToString address_to_string;
  610. /**
  611. * Function that will be called to convert a string address
  612. * to binary (numeric conversion only).
  613. */
  614. GNUNET_TRANSPORT_StringToAddress string_to_address;
  615. /**
  616. * Function that will be called tell the plugin to create a session
  617. * object.
  618. */
  619. GNUNET_TRANSPORT_CreateSession get_session;
  620. /**
  621. * Function to obtain the network type for a session
  622. */
  623. GNUNET_TRANSPORT_GetNetworkType get_network;
  624. /**
  625. * Function to obtain the network type for an address
  626. */
  627. GNUNET_TRANSPORT_GetNetworkTypeForAddress get_network_for_address;
  628. /**
  629. * Function to monitor the sessions managed by the plugin.
  630. */
  631. GNUNET_TRANSPORT_SessionMonitorSetup setup_monitor;
  632. };
  633. /*#ifndef PLUGIN_TRANSPORT_H*/
  634. #endif
  635. /** @} */ /* end of group */
  636. /* end of gnunet_transport_plugin.h */