34 #define LOG(kind, ...) GNUNET_log_from (kind, "transport-template", __VA_ARGS__)
41 #define LEARNED_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply ( \
42 GNUNET_TIME_UNIT_HOURS, 6)
44 #define PLUGIN_NAME "template"
220 unsigned int priority,
226 ssize_t bytes_sent = 0;
331 const void *addr,
size_t addrlen,
337 asc (asc_cls,
"converted address",
GNUNET_OK);
408 void **
buf,
size_t *added)
516 if (NULL ==
env->receive)
struct GNUNET_MQ_Envelope * env
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
struct TestcasePlugin * plugin
The process handle to the testbed service.
static char * address
GNS address for this phone.
static char * value
Value of the record to add/remove.
enum State state
current state of profiling
static int numeric
Option -n.
Constants for network protocols.
API to create, modify and access statistics.
Transport service plugin API.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
@ GNUNET_NT_WAN
Wide area network (i.e.
@ GNUNET_NT_UNSPECIFIED
Category of last resort.
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 ...
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".
#define TRANSPORT_SESSION_INBOUND_STRING
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 obtain...
GNUNET_TRANSPORT_SessionState
Possible states of a session in a plugin.
@ GNUNET_TRANSPORT_SS_UP
Session is fully UP.
static void notify_session_monitor(struct HTTP_Client_Plugin *plugin, struct GNUNET_ATS_Session *session, enum GNUNET_TRANSPORT_SessionState state)
If a session monitor is attached, notify it about the new session state.
static int send_session_info_iter(void *cls, const struct GNUNET_PeerIdentity *peer, void *value)
Return information about the given session to the monitor callback.
static ssize_t template_plugin_send(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)
Function that can be used by the transport service to transmit a message using the plugin.
static enum GNUNET_NetworkType template_plugin_get_network(void *cls, struct GNUNET_ATS_Session *session)
Function obtain the network type for a session.
static void template_plugin_update_session_timeout(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session)
static void template_plugin_setup_monitor(void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls)
Begin monitoring sessions of a plugin.
void * libgnunet_plugin_transport_template_done(void *cls)
Exit point from the plugin.
static int template_plugin_disconnect_session(void *cls, struct GNUNET_ATS_Session *session)
Function that can be used to force the plugin to disconnect from the given peer and cancel all previo...
static int template_plugin_string_to_address(void *cls, const char *addr, uint16_t addrlen, void **buf, size_t *added)
Function called to convert a string address to a binary address.
static void template_plugin_disconnect_peer(void *cls, const struct GNUNET_PeerIdentity *target)
Function that can be used to force the plugin to disconnect from the given peer and cancel all previo...
static void template_plugin_address_pretty_printer(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.
static enum GNUNET_NetworkType template_plugin_get_network_for_address(void *cls, const struct GNUNET_HELLO_Address *address)
Function obtain the network type for an address.
static struct GNUNET_ATS_Session * template_plugin_get_session(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 ...
void * libgnunet_plugin_transport_template_init(void *cls)
Entry point for the plugin.
static unsigned int template_plugin_query_keepalive_factor(void *cls)
Function that is called to get the keepalive factor.
static int template_plugin_address_suggested(void *cls, const void *addr, size_t addrlen)
Another peer has suggested an address for this peer and transport plugin.
static const char * template_plugin_address_to_string(void *cls, const void *addr, size_t addrlen)
Function called for a quick conversion of the binary address to a numeric address.
Session handle for connections.
struct Plugin * plugin
Pointer to the global plugin struct.
uint64_t last_received
How many bytes have we received since the last_quota_update timestamp?
void * transmit_cont_cls
Closure for transmit_cont.
struct GNUNET_PeerIdentity sender
To whom are we talking to (set to our identity if we are still waiting for the welcome message)
struct GNUNET_ATS_Session * next
Stored in a linked list.
uint32_t quota
Number of bytes per ms that this peer is allowed to send to us.
GNUNET_TRANSPORT_TransmitContinuation transmit_cont
The client (used to identify this connection)
struct GNUNET_TIME_Absolute last_quota_update
At what time did we reset last_received last?
void * cls
Closure for all of the callbacks.
An address for communicating with a peer.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
The transport service will pass a pointer to a struct of this type as the first and only argument to ...
void * cls
Closure for the various callbacks.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
void * cls
Closure for all of the callbacks.
Information about a plugin's session.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
void * sic_cls
Closure for sic.
struct GNUNET_ATS_Session * sessions
List of open sessions (or peer map, or...)
struct GNUNET_DATACACHE_PluginEnvironment * env
Our execution environment.
GNUNET_TRANSPORT_SessionInfoCallback sic
Function to call about session status changes.
uint32_t options
Address options in NBO.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.