gnunet_transport_plugin.h 25 KB

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