Specifies the struct that is given to the plugin's entry method and the other struct that must be returned. More...
Data Structures | |
struct | GNUNET_TRANSPORT_PluginEnvironment |
The transport service will pass a pointer to a struct of this type as the first and only argument to the entry point of each transport plugin. More... | |
struct | GNUNET_TRANSPORT_PluginFunctions |
Each plugin is required to return a pointer to a struct of this type as the return value from its entry point. More... | |
Macros | |
#define | TRANSPORT_SESSION_INBOUND_STRING "<inbound>" |
Typedefs | |
typedef void(* | GNUNET_TRANSPORT_SessionEnd) (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Function that will be called whenever the plugin internally cleans up a session pointer and hence the service needs to discard all of those sessions as well. More... | |
typedef void(* | GNUNET_TRANSPORT_SessionStart) (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, enum GNUNET_NetworkType net) |
Plugin tells transport service about a new inbound session. More... | |
typedef struct GNUNET_TIME_Relative(* | GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, const struct GNUNET_MessageHeader *message) |
Function called by the transport for each received message. More... | |
typedef enum GNUNET_NetworkType(* | GNUNET_TRANSPORT_AddressToType) (void *cls, const struct sockaddr *addr, size_t addrlen) |
Function that can be called by plugins to figure if an address is an loopback, LAN or WAN address. More... | |
typedef void(* | GNUNET_TRANSPORT_UpdateAddressDistance) (void *cls, const struct GNUNET_HELLO_Address *address, uint32_t distance) |
Function called when distance of an address changes. More... | |
typedef void(* | GNUNET_TRANSPORT_AddressNotification) (void *cls, int add_remove, const struct GNUNET_HELLO_Address *address) |
Function that will be called for each address the transport is aware that it might be reachable under. More... | |
typedef struct GNUNET_TIME_Relative(* | GNUNET_TRANSPORT_TrafficReport) (void *cls, const struct GNUNET_PeerIdentity *peer, size_t amount_recved) |
Function that will be called whenever the plugin receives data over the network and wants to determine how long it should wait until the next time it reads from the given peer. More... | |
typedef const struct GNUNET_MessageHeader *(* | GNUNET_TRANSPORT_GetHelloCallback) (void) |
Function that returns a HELLO message. More... | |
typedef void(* | GNUNET_TRANSPORT_TransmitContinuation) (void *cls, const struct GNUNET_PeerIdentity *target, int result, size_t size_payload, size_t size_on_wire) |
Function called by the GNUNET_TRANSPORT_TransmitFunction upon "completion". More... | |
typedef ssize_t(* | GNUNET_TRANSPORT_TransmitFunction) (void *cls, struct GNUNET_ATS_Session *session, const char *msgbuf, size_t msgbuf_size, unsigned int priority, struct GNUNET_TIME_Relative to, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) |
The new send function with just the session and no address. More... | |
typedef int(* | GNUNET_TRANSPORT_DisconnectSessionFunction) (void *cls, struct GNUNET_ATS_Session *session) |
Function that can be called to force a disconnect from the specified neighbour for the given session only. More... | |
typedef unsigned int(* | GNUNET_TRANSPORT_QueryKeepaliveFactorFunction) (void *cls) |
Function that is called to get the keepalive factor. More... | |
typedef void(* | GNUNET_TRANSPORT_DisconnectPeerFunction) (void *cls, const struct GNUNET_PeerIdentity *target) |
Function that can be called to force a disconnect from the specified neighbour. More... | |
typedef void(* | GNUNET_TRANSPORT_AddressStringCallback) (void *cls, const char *address, int res) |
Function called by the pretty printer for the resolved address for each human-readable address obtained. More... | |
typedef void(* | GNUNET_TRANSPORT_AddressPrettyPrinter) (void *cls, const char *type, const void *addr, size_t addrlen, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls) |
Convert the transports address to a nice, human-readable format. More... | |
typedef int(* | GNUNET_TRANSPORT_CheckAddress) (void *cls, const void *addr, size_t addrlen) |
Another peer has suggested an address for this peer and transport plugin. More... | |
typedef struct GNUNET_ATS_Session *(* | GNUNET_TRANSPORT_CreateSession) (void *cls, const struct GNUNET_HELLO_Address *address) |
Create a new session to transmit data to the target This session will used to send data to this peer and the plugin will notify us by calling the env->session_end function. More... | |
typedef void(* | GNUNET_TRANSPORT_UpdateSessionTimeout) (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session) |
Function that will be called whenever the transport service wants to notify the plugin that a session is still active and in use and therefore the session timeout for this session has to be updated. More... | |
typedef void(* | GNUNET_TRANSPORT_UpdateInboundDelay) (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session, struct GNUNET_TIME_Relative delay) |
Function that will be called whenever the transport service wants to notify the plugin that the inbound quota changed and that the plugin should update it's delay for the next receive value. More... | |
typedef const char *(* | GNUNET_TRANSPORT_AddressToString) (void *cls, const void *addr, size_t addrlen) |
Function called for a quick conversion of the binary address to a numeric address. More... | |
typedef int(* | GNUNET_TRANSPORT_StringToAddress) (void *cls, const char *addr, uint16_t addrlen, void **buf, size_t *added) |
Function called to convert a string address to a binary address. More... | |
typedef enum GNUNET_NetworkType(* | GNUNET_TRANSPORT_GetNetworkType) (void *cls, struct GNUNET_ATS_Session *session) |
Function to obtain the network type for a session. More... | |
typedef enum GNUNET_NetworkType(* | GNUNET_TRANSPORT_GetNetworkTypeForAddress) (void *cls, const struct GNUNET_HELLO_Address *address) |
Function to obtain the network type for an address. More... | |
typedef void(* | GNUNET_TRANSPORT_SessionInfoCallback) (void *cls, struct GNUNET_ATS_Session *session, const struct GNUNET_TRANSPORT_SessionInfo *info) |
Function called by the plugin with information about the current sessions managed by the plugin (for monitoring). More... | |
typedef void(* | GNUNET_TRANSPORT_SessionMonitorSetup) (void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls) |
Begin monitoring sessions of a plugin. More... | |
Specifies the struct that is given to the plugin's entry method and the other struct that must be returned.
Note that the destructors of transport plugins will be given the value returned by the constructor and is expected to return a NULL pointer.
#define TRANSPORT_SESSION_INBOUND_STRING "<inbound>" |
Definition at line 49 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_SessionEnd) (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Function that will be called whenever the plugin internally cleans up a session pointer and hence the service needs to discard all of those sessions as well.
Plugins that do not use sessions can simply omit calling this function and always use NULL wherever a session pointer is needed. This function should be called BEFORE a potential "TransmitContinuation" from the "TransmitFunction".
cls | closure |
peer | which peer was the session for |
session | which session is being destroyed |
Definition at line 80 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_SessionStart) (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, enum GNUNET_NetworkType net) |
Plugin tells transport service about a new inbound session.
cls | unused |
address | the address |
session | the new session |
net | network information |
Definition at line 94 of file gnunet_transport_plugin.h.
typedef struct GNUNET_TIME_Relative(* GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, const struct GNUNET_MessageHeader *message) |
Function called by the transport for each received message.
This function should also be called with "NULL" for the message to signal that the other peer disconnected.
cls | closure |
peer | (claimed) identity of the other peer |
message | the message, NULL if we only care about learning about the delay until we should receive again |
session | identifier used for this session (NULL for plugins that do not offer bi-directional communication to the sender using the same "connection") |
sender_address | binary address of the sender (if we established the connection or are otherwise sure of it; should be NULL for inbound TCP/UDP connections since it it not clear that we could establish ourselves a connection to that IP address and get the same system) |
sender_address_len | number of bytes in sender_address |
Definition at line 94 of file gnunet_transport_plugin.h.
typedef enum GNUNET_NetworkType(* GNUNET_TRANSPORT_AddressToType) (void *cls, const struct sockaddr *addr, size_t addrlen) |
Function that can be called by plugins to figure if an address is an loopback, LAN or WAN address.
Ultimately invokes #GNUNET_ATS_address_get_type().
cls | closure |
addr | binary address |
addrlen | length of the addr |
Definition at line 94 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_UpdateAddressDistance) (void *cls, const struct GNUNET_HELLO_Address *address, uint32_t distance) |
Function called when distance of an address changes.
cls | closure |
peer | peer |
distance | new distance |
Definition at line 155 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_AddressNotification) (void *cls, int add_remove, const struct GNUNET_HELLO_Address *address) |
Function that will be called for each address the transport is aware that it might be reachable under.
cls | closure |
add_remove | should the address added (GNUNET_YES) or removed (GNUNET_NO) from the set of valid addresses? |
address | the address to add or remove |
Definition at line 171 of file gnunet_transport_plugin.h.
typedef struct GNUNET_TIME_Relative(* GNUNET_TRANSPORT_TrafficReport) (void *cls, const struct GNUNET_PeerIdentity *peer, size_t amount_recved) |
Function that will be called whenever the plugin receives data over the network and wants to determine how long it should wait until the next time it reads from the given peer.
Note that some plugins (such as UDP) may not be able to wait (for a particular peer), so the waiting part is optional. Plugins that can wait should call this function, sleep the given amount of time, and call it again (with zero bytes read) UNTIL it returns zero and only then read.
cls | closure |
peer | which peer did we read data from |
amount_recved | number of bytes read (can be zero) |
Definition at line 171 of file gnunet_transport_plugin.h.
typedef const struct GNUNET_MessageHeader*(* GNUNET_TRANSPORT_GetHelloCallback) (void) |
Function that returns a HELLO message.
Definition at line 171 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_TransmitContinuation) (void *cls, const struct GNUNET_PeerIdentity *target, int result, size_t size_payload, size_t size_on_wire) |
Function called by the GNUNET_TRANSPORT_TransmitFunction upon "completion".
In the case that a peer disconnects, this function must be called for each pending request (with a 'failure' indication) AFTER notifying the service about the disconnect event (so that the service won't try to transmit more messages, believing the connection still exists...).
cls | closure |
target | who was the recipient of the message? |
result | GNUNET_OK on success GNUNET_SYSERR if the target disconnected; disconnect will ALSO be signalled using the ReceiveCallback. |
size_payload | bytes of payload from transport service in message |
size_on_wire | bytes required on wire for transmission, 0 if result == GNUNET_SYSERR |
Definition at line 310 of file gnunet_transport_plugin.h.
typedef ssize_t(* GNUNET_TRANSPORT_TransmitFunction) (void *cls, struct GNUNET_ATS_Session *session, const char *msgbuf, size_t msgbuf_size, unsigned int priority, struct GNUNET_TIME_Relative to, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) |
The new send function with just the session and no address.
Function that can be used by the transport service to transmit a message using the plugin. Note that in the case of a peer disconnecting, the continuation MUST be called prior to the disconnect notification itself. This function will be called with this peer's HELLO message to initiate a fresh connection to another peer.
cls | closure |
session | which session must be used |
msgbuf | the message to transmit |
msgbuf_size | number of bytes in msgbuf |
priority | how important is the message (most plugins will ignore message priority and just FIFO) |
to | how long to wait at most for the transmission (does not require plugins to discard the message after the timeout, just advisory for the desired delay; most plugins will ignore this as well) |
cont | continuation to call once the message has been transmitted (or if the transport is ready for the next transmission call; or if the peer disconnected...); can be NULL |
cont_cls | closure for cont |
Definition at line 348 of file gnunet_transport_plugin.h.
typedef int(* GNUNET_TRANSPORT_DisconnectSessionFunction) (void *cls, struct GNUNET_ATS_Session *session) |
Function that can be called to force a disconnect from the specified neighbour for the given session only.
. This should also cancel all previously scheduled transmissions for this session. Obviously the transmission may have been partially completed already, which is OK. The plugin is supposed to close the connection (if applicable).
cls | closure with the struct Plugin |
session | session to destroy |
Definition at line 371 of file gnunet_transport_plugin.h.
typedef unsigned int(* GNUNET_TRANSPORT_QueryKeepaliveFactorFunction) (void *cls) |
Function that is called to get the keepalive factor.
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to calculate the interval between keepalive packets.
cls | closure with the struct Plugin |
Definition at line 385 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_DisconnectPeerFunction) (void *cls, const struct GNUNET_PeerIdentity *target) |
Function that can be called to force a disconnect from the specified neighbour.
This should also cancel all previously scheduled transmissions. Obviously the transmission may have been partially completed already, which is OK. The plugin is supposed to close the connection (if applicable) and no longer call the transmit continuation(s).
cls | closure |
target | peer for which the last transmission is to be cancelled |
Definition at line 401 of file gnunet_transport_plugin.h.
Function called by the pretty printer for the resolved address for each human-readable address obtained.
The callback can be called several times. The last invocation must be with a address of NULL and a res of GNUNET_OK. Thus, to indicate conversion errors, the callback might be called first with address NULL and res being GNUNET_SYSERR. In that case, there must still be a subsequent call later with address NULL and res GNUNET_OK.
cls | closure |
address | one of the names for the host, NULL on last callback |
res | GNUNET_OK if conversion was successful, GNUNET_SYSERR on failure, GNUNET_OK on last callback |
Definition at line 421 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_AddressPrettyPrinter) (void *cls, const char *type, const void *addr, size_t addrlen, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls) |
Convert the transports address to a nice, human-readable format.
cls | closure |
type | name of the transport that generated the address |
addr | one of the addresses of the host, NULL for the last address the specific address format depends on the transport |
addrlen | length of the addr |
numeric | should (IP) addresses be displayed in numeric form? |
timeout | after how long should we give up? |
asc | function to call on each string |
asc_cls | closure for asc |
Definition at line 441 of file gnunet_transport_plugin.h.
typedef int(* GNUNET_TRANSPORT_CheckAddress) (void *cls, const void *addr, size_t addrlen) |
Another peer has suggested an address for this peer and transport plugin.
Check that this could be a valid address. This function is not expected to 'validate' the address in the sense of trying to connect to it but simply to see if the binary format is technically legal for establishing a connection to this peer (and make sure that the address really corresponds to our network connection/settings and not some potential man-in-the-middle).
addr | pointer to the address |
addrlen | length of addr |
Definition at line 467 of file gnunet_transport_plugin.h.
typedef struct GNUNET_ATS_Session*(* GNUNET_TRANSPORT_CreateSession) (void *cls, const struct GNUNET_HELLO_Address *address) |
Create a new session to transmit data to the target This session will used to send data to this peer and the plugin will notify us by calling the env->session_end function.
cls | the plugin |
address | the hello address |
Definition at line 467 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_UpdateSessionTimeout) (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session) |
Function that will be called whenever the transport service wants to notify the plugin that a session is still active and in use and therefore the session timeout for this session has to be updated.
cls | closure |
peer | which peer was the session for |
session | which session is being updated |
Definition at line 496 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_UpdateInboundDelay) (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session, struct GNUNET_TIME_Relative delay) |
Function that will be called whenever the transport service wants to notify the plugin that the inbound quota changed and that the plugin should update it's delay for the next receive value.
cls | closure |
peer | which peer was the session for |
session | which session is being updated |
delay | new delay to use for receiving |
Definition at line 513 of file gnunet_transport_plugin.h.
typedef const char*(* GNUNET_TRANSPORT_AddressToString) (void *cls, const void *addr, size_t addrlen) |
Function called for a quick conversion of the binary address to a numeric address.
Note that the caller must not free the address and that the next call to this function is allowed to override the address again.
cls | closure |
addr | binary address |
addr_len | length of the addr |
Definition at line 531 of file gnunet_transport_plugin.h.
typedef int(* GNUNET_TRANSPORT_StringToAddress) (void *cls, const char *addr, uint16_t addrlen, void **buf, size_t *added) |
Function called to convert a string address to a binary address.
cls | closure (struct Plugin* ) |
addr | string address |
addrlen | length of the addr including \0 termination |
buf | location to store the buffer If the function returns GNUNET_SYSERR, its contents are undefined. |
added | length of created address |
Definition at line 549 of file gnunet_transport_plugin.h.
typedef enum GNUNET_NetworkType(* GNUNET_TRANSPORT_GetNetworkType) (void *cls, struct GNUNET_ATS_Session *session) |
Function to obtain the network type for a session.
cls | closure (struct Plugin * ) |
session | the session |
Definition at line 549 of file gnunet_transport_plugin.h.
typedef enum GNUNET_NetworkType(* GNUNET_TRANSPORT_GetNetworkTypeForAddress) (void *cls, const struct GNUNET_HELLO_Address *address) |
Function to obtain the network type for an address.
cls | closure (struct Plugin * ) |
address | the address |
Definition at line 549 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_SessionInfoCallback) (void *cls, struct GNUNET_ATS_Session *session, const struct GNUNET_TRANSPORT_SessionInfo *info) |
Function called by the plugin with information about the current sessions managed by the plugin (for monitoring).
cls | closure |
session | session handle this information is about, NULL to indicate that we are "in sync" (initial iteration complete) |
info | information about the state of the session, NULL if session is also NULL and we are merely signalling that the initial iteration is over |
Definition at line 594 of file gnunet_transport_plugin.h.
typedef void(* GNUNET_TRANSPORT_SessionMonitorSetup) (void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls) |
Begin monitoring sessions of a plugin.
There can only be one active monitor per plugin (i.e. if there are multiple monitors, the transport service needs to multiplex the generated events over all of them).
cls | closure of the plugin |
sic | callback to invoke, NULL to disable monitor; plugin will being by iterating over all active sessions immediately and then enter monitor mode |
sic_cls | closure for sic |
Definition at line 613 of file gnunet_transport_plugin.h.