49 #define PLUGIN_NAME "unix"
71 #define HOSTNAME_RESOLVE_TIMEOUT \
72 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
74 #define LOG(kind, ...) GNUNET_log_from (kind, "transport-unix", __VA_ARGS__)
369 static char rbuf[1024];
380 addrstr = (
char *) &ua[1];
381 addr_str_len = ntohl (ua->
addrlen);
383 if (addr_str_len != addrlen -
sizeof(
struct UnixAddress))
388 if (
'\0' != addrstr[addr_str_len - 1])
393 if (strlen (addrstr) + 1 != addr_str_len)
400 if (
'\0' == addrstr[0])
402 memset (rbuf, 0,
sizeof(rbuf));
408 (off == 1) ?
"@" :
"",
409 (
int) (addr_str_len - off),
432 "Disconnecting session for peer `%s' `%s'\n",
451 if (NULL != msgw->
cont)
465 "# UNIX sessions active",
509 "Session %p was idle for %s, disconnecting\n",
541 static struct sockaddr_un *
544 struct sockaddr_un *un;
549 un->sun_family = AF_UNIX;
550 slen = strlen (unixpath);
551 if (slen >=
sizeof(un->sun_path))
552 slen =
sizeof(un->sun_path) - 1;
554 un->sun_path[slen] =
'\0';
555 slen =
sizeof(
struct sockaddr_un);
556 #if HAVE_SOCKADDR_UN_SUN_LEN
557 un->sun_len = (u_char) slen;
671 unsigned int priority,
681 struct sockaddr_un *un;
683 const char *unixpath;
685 if (NULL == send_handle)
690 if ((NULL == addr) || (0 == addrlen))
697 unixpath = (
const char *) &addr[1];
707 un->sun_path[0] =
'\0';
714 (
const struct sockaddr *) un,
718 if ((EAGAIN == errno) || (ENOBUFS == errno))
723 if (EMSGSIZE == errno)
734 if (
size < msgbuf_size)
737 "Trying to increase socket buffer size from %u to %u for message size %u\n",
739 (
unsigned int) ((msgbuf_size / 1000) + 2) * 1000,
740 (
unsigned int) msgbuf_size);
741 size = ((msgbuf_size / 1000) + 2) * 1000;
770 "UNIX transmitted %u-byte message to %s (%d: %s)\n",
771 (
unsigned int) msgbuf_size,
772 GNUNET_a2s ((
const struct sockaddr *) un, un_len),
774 (sent < 0) ? strerror (errno) :
"ok");
825 uint32_t addr_str_len;
826 uint32_t addr_option;
829 if ((NULL ==
address->address) || (0 ==
address->address_length) ||
835 addrstr = (
char *) &ua[1];
836 addr_str_len = ntohl (ua->
addrlen);
837 addr_option = ntohl (ua->
options);
850 if (
'\0' != addrstr[addr_str_len - 1])
855 if (strlen (addrstr) + 1 != addr_str_len)
865 "Found existing session %p for address `%s'\n",
885 "Creating a new session %p for address `%s'\n",
896 "# UNIX sessions active",
955 "Received message from %s\n",
958 "# bytes received via UNIX",
959 ntohs (currhdr->
size),
974 plugin->env->session_start (NULL,
1000 struct sockaddr_un un;
1011 addrlen =
sizeof(un);
1012 memset (&un, 0,
sizeof(un));
1016 (
struct sockaddr *) &un,
1028 "Read %d bytes from socket %s\n",
1035 if (
'\0' == un.sun_path[0])
1037 un.sun_path[0] =
'@';
1041 ua_len =
sizeof(
struct UnixAddress) + strlen (un.sun_path) + 1;
1043 ua->
addrlen = htonl (strlen (&un.sun_path[0]) + 1);
1044 GNUNET_memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1);
1058 msgbuf = (
char *) &
msg[1];
1067 (
csize > tsize - offset))
1094 while (NULL != (msgw =
plugin->msg_head))
1101 "Timeout for message with %u bytes \n",
1102 (
unsigned int) msgw->
msgsize);
1111 "# bytes currently in UNIX buffers",
1115 "# UNIX bytes discarded",
1118 if (NULL != msgw->
cont)
1137 (
const char *) msgw->
msg,
1149 "# UNIX retry attempts",
1162 "# bytes currently in UNIX buffers",
1169 if (NULL != msgw->
cont)
1176 "# UNIX bytes discarded",
1186 "# bytes transmitted via UNIX",
1189 if (NULL != msgw->
cont)
1212 plugin->read_task = NULL;
1236 plugin->write_task = NULL;
1240 if (NULL ==
plugin->msg_head)
1282 unsigned int priority,
1298 "Invalid session for peer `%s' `%s'\n",
1307 "Sending %lu bytes with session for peer `%s' `%s'\n",
1308 (
unsigned long) msgbuf_size,
1318 plugin->env->my_identity,
1322 wrapper->
msg = message;
1324 wrapper->
payload = msgbuf_size;
1327 wrapper->
cont = cont;
1333 plugin->bytes_in_queue += ssize;
1337 "# bytes currently in UNIX buffers",
1341 if (NULL ==
plugin->write_task)
1361 struct sockaddr_un *un;
1367 plugin->unix_socket_path[0] =
'@';
1368 un->sun_path[0] =
'\0';
1372 if (NULL ==
plugin->unix_sock.desc)
1378 if (
'\0' != un->sun_path[0])
1383 _ (
"Cannot create path to `%s'\n"),
1386 plugin->unix_sock.desc = NULL;
1392 (
const struct sockaddr *) un,
1398 plugin->unix_sock.desc = NULL;
1435 size_t addr_str_len;
1437 if ((NULL == addr) || (0 ==
addrlen) ||
1443 addrstr = (
char *) &ua[1];
1444 addr_str_len = ntohl (ua->
addrlen);
1445 if (
'\0' != addrstr[addr_str_len - 1])
1450 if (strlen (addrstr) + 1 != addr_str_len)
1456 if (0 == strcmp (
plugin->unix_socket_path, addrstr))
1488 if ((NULL != addr) && (
addrlen > 0))
1528 if ((NULL == addr) || (
addrlen == 0))
1533 if (
'\0' != addr[
addrlen - 1])
1538 if (strlen (addr) !=
addrlen - 1)
1544 optionstr = strchr (
plugin,
'.');
1545 if (NULL == optionstr)
1551 optionstr[0] =
'\0';
1554 address = strchr (optionstr,
'.');
1600 ua->
addrlen = htonl (strlen (
plugin->unix_socket_path) + 1);
1601 unix_path = (
char *) &ua[1];
1603 plugin->unix_socket_path,
1604 strlen (
plugin->unix_socket_path) + 1);
1606 plugin->address_update_task = NULL;
1727 int sockets_created;
1729 if (NULL ==
env->receive)
1746 &
plugin->unix_socket_path))
1762 "USE_ABSTRACT_SOCKETS");
1784 if ((0 == sockets_created) || (
GNUNET_SYSERR == sockets_created))
1793 plugin->address_update_task =
1824 ua->
addrlen = htonl (strlen (
plugin->unix_socket_path) + 1);
1826 plugin->unix_socket_path,
1827 strlen (
plugin->unix_socket_path) + 1);
1838 while (NULL != (msgw =
plugin->msg_head))
1847 if (NULL != msgw->
cont)
1857 if (NULL !=
plugin->read_task)
1860 plugin->read_task = NULL;
1862 if (NULL !=
plugin->write_task)
1865 plugin->write_task = NULL;
1867 if (NULL !=
plugin->address_update_task)
1870 plugin->address_update_task = NULL;
1872 if (NULL !=
plugin->unix_sock.desc)
1876 plugin->unix_sock.desc = NULL;
struct GNUNET_GETOPT_CommandLineOption options[]
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static int ret
Return value of the commandline.
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.
struct GNUNET_HashCode key
The key used in the DHT.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
static char * value
Value of the record to add/remove.
enum State state
current state of profiling
static unsigned long long payload
How much data are we currently storing in the database?
static unsigned int csize
static int numeric
Option -n.
Helper library for handling HELLOs.
Constants for network protocols.
API to create, modify and access statistics.
Transport service plugin API.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
After how long do we consider a connection to a peer dead if we don't receive messages from the peer?
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file(const char *filename)
Create the directory structure for storing a file.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_contains_value(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Check if the map contains the given value under the given key.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
int GNUNET_CONTAINER_multipeermap_get_multiple(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map that match a particular key.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
struct GNUNET_HELLO_Address * GNUNET_HELLO_address_allocate(const struct GNUNET_PeerIdentity *peer, const char *transport_name, const void *address, size_t address_length, enum GNUNET_HELLO_AddressInfo local_info)
Allocate an address struct.
#define GNUNET_HELLO_address_free(addr)
Free an address.
struct GNUNET_HELLO_Address * GNUNET_HELLO_address_copy(const struct GNUNET_HELLO_Address *address)
Copy an address struct.
int GNUNET_HELLO_address_cmp(const struct GNUNET_HELLO_Address *a1, const struct GNUNET_HELLO_Address *a2)
Compare two addresses.
@ GNUNET_HELLO_ADDRESS_INFO_NONE
No additional information.
#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_ALIGN
gcc-ism to force alignment; we use this to align char-arrays that may then be cast to 'struct's.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_PACKED
gcc-ism to get packed structs.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#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.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
const char * GNUNET_a2s(const struct sockaddr *addr, socklen_t addrlen)
Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_getsockopt(const struct GNUNET_NETWORK_Handle *desc, int level, int optname, void *optval, socklen_t *optlen)
Get socket options.
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_close(struct GNUNET_NETWORK_Handle *desc)
Close a socket.
ssize_t GNUNET_NETWORK_socket_recvfrom(const struct GNUNET_NETWORK_Handle *desc, void *buffer, size_t length, struct sockaddr *src_addr, socklen_t *addrlen)
Read data from a socket (always non-blocking).
struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_create(int domain, int type, int protocol)
Create a new socket.
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_bind(struct GNUNET_NETWORK_Handle *desc, const struct sockaddr *address, socklen_t address_len)
Bind a socket to a particular address.
int GNUNET_NETWORK_socket_setsockopt(struct GNUNET_NETWORK_Handle *fd, int level, int option_name, const void *option_value, socklen_t option_len)
Set socket option.
ssize_t GNUNET_NETWORK_socket_sendto(const struct GNUNET_NETWORK_Handle *desc, const void *message, size_t length, const struct sockaddr *dest_addr, socklen_t dest_len)
Send data to a particular destination (always non-blocking).
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
@ GNUNET_NT_LOOPBACK
Loopback (same host).
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_write_net(struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *wfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_net(struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
const struct GNUNET_SCHEDULER_TaskContext * GNUNET_SCHEDULER_get_task_context(void)
Obtain the reasoning why the current task was started.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
@ GNUNET_SCHEDULER_REASON_READ_READY
The reading socket is ready.
@ GNUNET_SCHEDULER_REASON_WRITE_READY
The writing socket is ready.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Add a given relative duration to the given start time.
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
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".
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_INIT
The session was created (first call for each session object).
@ GNUNET_TRANSPORT_SS_DONE
Session is being torn down and about to disappear.
@ GNUNET_TRANSPORT_SS_UP
Session is fully UP.
@ GNUNET_TRANSPORT_SS_UPDATE
This is just an update about the session, the state did not change.
static unsigned int size
Size of the "table".
static ssize_t unix_real_send(void *cls, struct GNUNET_NETWORK_Handle *send_handle, const struct GNUNET_PeerIdentity *target, const char *msgbuf, size_t msgbuf_size, unsigned int priority, struct GNUNET_TIME_Absolute timeout, const struct UnixAddress *addr, size_t addrlen, size_t payload, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
Actually send out the message, assume we've got the address and send_handle squared away!
#define PLUGIN_NAME
Name of the plugin.
static struct GNUNET_ATS_Session * unix_plugin_get_session(void *cls, const struct GNUNET_HELLO_Address *address)
Creates a new outbound session the transport service will use to send data to the peer.
static void unix_plugin_select_read(void *cls)
We have been notified that our socket has something to read.
static void unix_plugin_peer_disconnect(void *cls, const struct GNUNET_PeerIdentity *target)
Disconnect from a remote node.
static int unix_plugin_check_address(void *cls, const void *addr, size_t addrlen)
Function that will be called to check if a binary address for this plugin is well-formed and correspo...
void * libgnunet_plugin_transport_unix_init(void *cls)
The exported method.
static void address_notification(void *cls)
Notify transport service about address.
static void session_timeout(void *cls)
Session was idle for too long, so disconnect it.
static void unix_plugin_do_read(struct Plugin *plugin)
Read from UNIX domain socket (it is ready).
static struct GNUNET_ATS_Session * lookup_session(struct Plugin *plugin, const struct GNUNET_HELLO_Address *address)
Find an existing session by address.
static struct sockaddr_un * unix_address_to_sockaddr(const char *unixpath, socklen_t *sock_len)
Convert unix path to a struct sockaddr_un *
static void unix_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 void reschedule_session_timeout(struct GNUNET_ATS_Session *session)
Increment session timeout due to activity.
static unsigned int unix_plugin_query_keepalive_factor(void *cls)
Function that is called to get the keepalive factor.
static int unix_transport_server_start(void *cls)
Create a slew of UNIX sockets.
static int unix_plugin_session_disconnect(void *cls, struct GNUNET_ATS_Session *session)
Functions with this signature are called whenever we need to close a session due to a disconnect or f...
UNIX_ADDRESS_OPTIONS
Options for UNIX Domain addresses.
@ UNIX_OPTIONS_USE_ABSTRACT_SOCKETS
Linux abstract domain sockets should be used.
@ UNIX_OPTIONS_NONE
No special options.
static int get_session_delete_it(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Function called on sessions to disconnect.
static enum GNUNET_NetworkType unix_plugin_get_network_for_address(void *cls, const struct GNUNET_HELLO_Address *address)
Function obtain the network type for a session.
static enum GNUNET_NetworkType unix_plugin_get_network(void *cls, struct GNUNET_ATS_Session *session)
Function obtain the network type for a session.
static void unix_plugin_setup_monitor(void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls)
Begin monitoring sessions of a plugin.
static int lookup_session_it(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Function called to find a session by address.
static void unix_demultiplexer(struct Plugin *plugin, struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *currhdr, const struct UnixAddress *ua, size_t ua_len)
Demultiplexer for UNIX messages.
static const char * unix_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.
static int unix_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 unix_plugin_update_session_timeout(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...
static ssize_t unix_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.
#define RETRY
Return code we give on 'send' if we failed to send right now but it makes sense to retry later.
void * libgnunet_plugin_transport_unix_done(void *cls)
Shutdown the plugin.
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 void unix_plugin_select_write(void *cls)
We have been notified that our socket is ready to write.
static void notify_session_monitor(struct 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 void unix_plugin_do_write(struct Plugin *plugin)
Write to UNIX domain socket (it is ready).
static struct GNUNET_SCHEDULER_TaskContext tc
Task context of the current task.
Session handle for connections.
struct GNUNET_PeerIdentity target
To whom are we talking to.
struct Plugin * plugin
Pointer to the global plugin struct.
unsigned int msgs_in_queue
Number of messages waiting for transmission to this peer.
struct GNUNET_TIME_Absolute timeout
When does this session time out.
struct GNUNET_HELLO_Address * address
Address.
struct GNUNET_ATS_Session * next
Stored in a linked list.
unsigned long long bytes_in_queue
Number of bytes waiting for transmission to this peer.
struct GNUNET_SCHEDULER_Task * timeout_task
Session timeout task.
struct GNUNET_ATS_Session * prev
Stored in a linked list.
void * cls
Closure for all of the callbacks.
Internal representation of the hash map.
An address for communicating with a peer.
size_t address_length
Number of bytes in address.
const void * address
Binary representation of the address (plugin-specific).
The identity of the host (wraps the signing key of the peer).
Context information passed to each scheduler task.
enum GNUNET_SCHEDULER_Reason reason
Reason why the task is run now.
Entry in list of pending tasks.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
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.
Closure to lookup_queue_it().
const struct GNUNET_HELLO_Address * address
Address we are looking for.
struct GNUNET_ATS_Session * res
Location to store the session, if found.
struct Queue * res
Location to store the queue, if found.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
void * sic_cls
Closure for sic.
int is_abstract
Are we using an abstract UNIX domain socket?
char * unix_socket_path
Path of our unix domain socket (/tmp/unix-plugin)
struct GNUNET_SCHEDULER_Task * read_task
Task that reads incoming UDP packets.
unsigned long long bytes_in_queue
Number of bytes we currently have in our write queues.
struct UNIXMessageWrapper * msg_head
Head of queue of messages to transmit.
struct GNUNET_SCHEDULER_Task * address_update_task
ID of task used to update our addresses when one expires.
struct UNIXMessageWrapper * msg_tail
Tail of queue of messages to transmit.
struct UNIX_Sock_Info unix_sock
socket that we transmit all data with
struct GNUNET_DATACACHE_PluginEnvironment * env
Our execution environment.
uint32_t myoptions
Address options.
GNUNET_TRANSPORT_SessionInfoCallback sic
Function to call about session status changes.
struct GNUNET_SCHEDULER_Task * write_task
ID of write task.
struct GNUNET_CONTAINER_MultiPeerMap * session_map
Sessions (map from peer identity to struct GNUNET_ATS_Session)
Information we track for a message awaiting transmission.
size_t payload
Number of bytes of payload encapsulated in msg.
struct UNIXMessageWrapper * next
We keep messages in a doubly linked list.
struct UNIXMessageWrapper * prev
We keep messages in a doubly linked list.
struct GNUNET_TIME_Absolute timeout
Timeout for this message.
struct UNIXMessage * msg
The actual payload (allocated separately right now).
unsigned int priority
Priority of the message (ignored, just dragged along in UNIX).
size_t msgsize
Number of bytes in msg.
GNUNET_TRANSPORT_TransmitContinuation cont
Function to call upon transmission.
void * cont_cls
Closure for cont.
struct GNUNET_ATS_Session * session
Session this message belongs to.
UNIX Message-Packet header.
struct GNUNET_MessageHeader header
Message header.
struct GNUNET_PeerIdentity sender
What is the identity of the sender (GNUNET_hash of public key)
Information we keep for each of our listen sockets.
struct GNUNET_NETWORK_Handle * desc
The network handle.
Binary format for an UNIX Domain Socket address in GNUnet.
uint32_t options
Options to use for the address, in NBO.
uint32_t addrlen
Length of the address (path length), in NBO.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
common internal definitions for transport service