gnunet_transport_plugin.h 25 KB

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