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__) 210 unsigned long long bytes_in_queue;
225 unsigned int msgs_in_queue;
339 if (NULL == plugin->
sic)
341 memset (&info, 0,
sizeof(info));
351 plugin->
sic (plugin->
sic_cls, session, &info);
369 static char rbuf[1024];
375 if ((NULL == addr) || (
sizeof(
struct UnixAddress) > addrlen))
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;
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,
984 plugin->
env->receive (plugin->
env->
cls, session->
address, session, currhdr);
1000 struct sockaddr_un un;
1011 addrlen =
sizeof(un);
1012 memset (&un, 0,
sizeof(un));
1016 (
struct sockaddr *) &un,
1018 if ((
GNUNET_SYSERR == ret) && ((errno == EAGAIN) || (errno == ENOBUFS)))
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);
1052 if ((csize <
sizeof(
struct UNIXMessage)) || (csize > ret))
1058 msgbuf = (
char *) &msg[1];
1065 csize = ntohs (currhdr->
size);
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)
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,
1315 message->header.size = htons (ssize);
1316 message->header.type = htons (0);
1318 plugin->
env->my_identity,
1322 wrapper->
msg = message;
1324 wrapper->
payload = msgbuf_size;
1327 wrapper->
cont = cont;
1337 "# bytes currently in UNIX buffers",
1361 struct sockaddr_un *un;
1368 un->sun_path[0] =
'\0';
1378 if (
'\0' != un->sun_path[0])
1383 _ (
"Cannot create path to `%s'\n"),
1392 (
const struct sockaddr *) un,
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)
1488 if ((NULL != addr) && (addrlen > 0))
1493 asc (asc_cls, NULL, GNUNET_OK);
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';
1553 options = atol (optionstr);
1554 address = strchr (optionstr,
'.');
1555 if (NULL == address)
1570 ua_size =
sizeof(
struct UnixAddress) + strlen (address) + 1;
1572 ua->options = htonl (options);
1573 ua->addrlen = htonl (strlen (address) + 1);
1597 len =
sizeof(
struct UnixAddress) + strlen (plugin->unix_socket_path) + 1;
1599 ua->options = htonl (plugin->myoptions);
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;
1612 plugin->env->notify_address (plugin->env->cls,
GNUNET_YES, address);
1709 sic (sic_cls, NULL, NULL);
1727 int sockets_created;
1762 "USE_ABSTRACT_SOCKETS");
1784 if ((0 == sockets_created) || (
GNUNET_SYSERR == sockets_created))
1821 len =
sizeof(
struct UnixAddress) + strlen (plugin->unix_socket_path) + 1;
1823 ua->options = htonl (plugin->myoptions);
1824 ua->addrlen = htonl (strlen (plugin->unix_socket_path) + 1);
1826 plugin->unix_socket_path,
1827 strlen (plugin->unix_socket_path) + 1);
1833 plugin->env->notify_address (plugin->env->cls,
GNUNET_NO, address);
1838 while (NULL != (msgw = plugin->msg_head))
1846 plugin->bytes_in_queue -= msgw->
msgsize;
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;
static void session_timeout(void *cls)
Session was idle for too long, so disconnect it.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
size_t address_length
Number of bytes in 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.
uint32_t addrlen
Length of the address (path length), in NBO.
Session is being torn down and about to disappear.
const struct GNUNET_SCHEDULER_TaskContext * GNUNET_SCHEDULER_get_task_context(void)
Obtain the reasoning why the current task was started.
GNUNET_TRANSPORT_SessionInfoCallback sic
Function to call about session status changes.
Information we keep for each of our listen sockets.
#define PLUGIN_NAME
Name of the plugin.
uint32_t num_bytes_pending
Number of bytes pending transmission for this session.
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...
struct GNUNET_MessageHeader * msg
GNUNET_TRANSPORT_CreateSession get_session
Function that will be called tell the plugin to create a session object.
GNUNET_TRANSPORT_AddressToString address_to_string
Function that will be called to convert a binary address to a string (numeric conversion only)...
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_TIME_UNIT_ZERO_ABS
Absolute time zero.
uint64_t rel_value_us
The actual value.
const void * address
Binary representation of the address (plugin-specific).
#define RETRY
Return code we give on 'send' if we failed to send right now but it makes sense to retry later...
GNUNET_TRANSPORT_TransmitContinuation cont
Function to call upon transmission.
common internal definitions for transport service
unsigned int msgs_in_queue
Number of messages waiting for transmission to this peer.
static void unix_plugin_select_write(void *cls)
We have been notified that our socket is ready to write.
struct GNUNET_SCHEDULER_Task * timeout_task
Session timeout task.
struct GNUNET_NETWORK_Handle * desc
The network handle.
char * unix_socket_path
Path of our unix domain socket (/tmp/unix-plugin)
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
The reading socket is ready.
Context information passed to each scheduler task.
struct Plugin * plugin
Pointer to the global plugin struct.
struct GNUNET_ATS_Session * next
Stored in a linked list.
struct GNUNET_MessageHeader header
Message header.
GNUNET_TRANSPORT_TransmitFunction send
Function that the transport service will use to transmit data to another peer.
struct UNIXMessage * msg
The actual payload (allocated separately right now).
GNUNET_TRANSPORT_DisconnectPeerFunction disconnect_peer
Function that can be used to force the plugin to disconnect from the given peer and cancel all previo...
struct GNUNET_TIME_Absolute timeout
Timeout for this message.
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 int get_session_delete_it(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Function called on sessions to disconnect.
int is_inbound
GNUNET_YES if this is an inbound connection, GNUNET_NO if this is an outbound connection, GNUNET_SYSERR if connections of this plugin are so fundamentally bidirectional that they have no 'initiator'
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
enum GNUNET_TRANSPORT_SessionState state
New state of the session.
struct GNUNET_ATS_Session * prev
Stored in a linked list.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void unix_plugin_select_read(void *cls)
We have been notified that our socket has something to read.
static struct GNUNET_SCHEDULER_TaskContext tc
Task context of the current task.
GNUNET_TRANSPORT_DisconnectSessionFunction disconnect_session
Function that can be used to force the plugin to disconnect from the given peer and cancel all previo...
size_t msgsize
Number of bytes in msg.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
GNUNET_TRANSPORT_SessionMonitorSetup setup_monitor
Function to monitor the sessions managed by the plugin.
int GNUNET_NETWORK_socket_getsockopt(const struct GNUNET_NETWORK_Handle *desc, int level, int optname, void *optval, socklen_t *optlen)
Get socket options.
int GNUNET_NETWORK_socket_bind(struct GNUNET_NETWORK_Handle *desc, const struct sockaddr *address, socklen_t address_len)
Bind a socket to a particular address.
Closure to lookup_queue_it().
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...
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
static int ret
Return value of the commandline.
struct GNUNET_TIME_Absolute timeout
When does this session time out.
int 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.
static int numeric
Option -n.
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.
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_new(type)
Allocate a struct or union of the given type.
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.
struct GNUNET_HELLO_Address * address
Address.
unsigned int priority
Priority of the message (ignored, just dragged along in UNIX).
struct GNUNET_SCHEDULER_Task * read_task
ID of read task.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
const struct GNUNET_HELLO_Address * address
Address used by the session.
unsigned long long bytes_in_queue
Number of bytes waiting for transmission to this peer.
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).
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
enum GNUNET_SCHEDULER_Reason reason
Reason why the task is run now.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
uint32_t num_msg_pending
Number of messages pending transmission for this session.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_SCHEDULER_Task * address_update_task
ID of task used to update our addresses when one expires.
Binary format for an UNIX Domain Socket address in GNUnet.
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
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.
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.
GNUNET_TRANSPORT_PluginReceiveCallback receive
Function that should be called by the transport plugin whenever a message is received.
GNUNET_TRANSPORT_UpdateSessionTimeout update_session_timeout
Function that will be called whenever the transport service wants to notify the plugin that a session...
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 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.
#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...
Information about a plugin's session.
int GNUNET_HELLO_address_cmp(const struct GNUNET_HELLO_Address *a1, const struct GNUNET_HELLO_Address *a2)
Compare two addresses.
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.
void * cls
Closure for the various callbacks.
enum State state
current state of profiling
struct UNIXMessageWrapper * msg_head
Head of queue of messages to transmit.
UNIX Message-Packet header.
void * cls
Closure for all of the callbacks.
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
static unsigned int csize
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
struct UNIX_Sock_Info unix_sock
socket that we transmit all data with
static void address_notification(void *cls)
Notify transport service about address.
static char * value
Value of the record to add/remove.
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_StringToAddress string_to_address
Function that will be called to convert a string address to binary (numeric conversion only)...
struct GNUNET_CONTAINER_MultiPeerMap * session_map
Sessions (map from peer identity to struct GNUNET_ATS_Session)
Session handle for connections.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
static struct sockaddr_un * unix_address_to_sockaddr(const char *unixpath, socklen_t *sock_len)
Convert unix path to a struct sockaddr_un *
struct GNUNET_DATACACHE_PluginEnvironment * env
Our execution environment.
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.
The transport service will pass a pointer to a struct of this type as the first and only argument to ...
static void unix_plugin_peer_disconnect(void *cls, const struct GNUNET_PeerIdentity *target)
Disconnect from a remote node.
GNUNET_TRANSPORT_GetNetworkType get_network
Function to obtain the network type for a session.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
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).
static struct GNUNET_ATS_Session * lookup_session(struct Plugin *plugin, const struct GNUNET_HELLO_Address *address)
Find an existing session by address.
Information we track for a message awaiting transmission.
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 ...
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
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)...
static enum GNUNET_NetworkType unix_plugin_get_network(void *cls, struct GNUNET_ATS_Session *session)
Function obtain the network type for a session.
struct GNUNET_TIME_Absolute session_timeout
At what time will this session timeout (unless activity happens)?
Internal representation of the hash map.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
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...
static char * plugin
Solver plugin name as string.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
void * cont_cls
Closure for cont.
struct UNIXMessageWrapper * prev
We keep messages in a doubly linked list.
The writing socket is ready.
static void unix_plugin_setup_monitor(void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls)
Begin monitoring sessions of a plugin.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
uint32_t options
Options to use for the address, in NBO.
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
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 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.
struct GNUNET_MQ_Envelope * env
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 GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
static struct GNUNET_SCHEDULER_Task * timeout_task
Task to be run on timeout.
size_t payload
Number of bytes of payload encapsulated in msg.
int is_abstract
Are we using an abstract UNIX domain socket?
static void reschedule_session_timeout(struct GNUNET_ATS_Session *session)
Increment session timeout due to activity.
struct GNUNET_PeerIdentity peer
For which peer is this an address?
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...
static unsigned long long payload
How much data are we currently storing in the database?
struct GNUNET_SCHEDULER_Task * write_task
ID of write task.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Allow multiple values with the same key.
#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...
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...
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.
This is just an update about the session, the state did not change.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
static void unix_plugin_do_read(struct Plugin *plugin)
Read from UNIX domain socket (it is ready).
static unsigned int unix_plugin_query_keepalive_factor(void *cls)
Function that is called to get the keepalive factor.
const struct GNUNET_HELLO_Address * address
Address we are looking for.
GNUNET_TRANSPORT_QueryKeepaliveFactorFunction query_keepalive_factor
Function that is used to query keepalive factor.
The identity of the host (wraps the signing key of the peer).
No additional information.
int 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.
#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_PACKED
gcc-ism to get packed structs.
unsigned long long bytes_in_queue
Number of bytes we currently have in our write queues.
Linux abstract domain sockets should be used.
struct GNUNET_PeerIdentity target
To whom are we talking to.
static struct GNUNET_NETWORK_Handle * unix_sock
socket that we transmit all data with
An address for communicating with a peer.
static int lookup_session_it(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Function called to find a session by address.
struct GNUNET_HELLO_Address * GNUNET_HELLO_address_copy(const struct GNUNET_HELLO_Address *address)
Copy an address struct.
The session was created (first call for each session object).
Entry in list of pending tasks.
struct Queue * res
Location to store the queue, if found.
struct GNUNET_ATS_Session * session
Session this message belongs to.
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! ...
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".
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.
struct UNIXMessageWrapper * next
We keep messages in a doubly linked list.
static void unix_plugin_do_write(struct Plugin *plugin)
Write to UNIX domain socket (it is ready).
void * libgnunet_plugin_transport_unix_init(void *cls)
The exported method.
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?
void * cls
Closure to use for callbacks.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
GNUNET_TRANSPORT_AddressPrettyPrinter address_pretty_printer
Function to pretty-print addresses.
Time for absolute times used by GNUnet, in microseconds.
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...
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file(const char *filename)
Create the directory structure for storing a file.
struct GNUNET_ATS_Session * res
Location to store the session, if found.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
uint32_t myoptions
Address options.
GNUNET_TRANSPORT_CheckAddress check_address
Function that will be called to check if a binary address for this plugin is well-formed and correspo...
GNUNET_TRANSPORT_SessionState
Possible states of a session in a plugin.
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).
static int unix_transport_server_start(void *cls)
Create a slew of UNIX sockets.
UNIX_ADDRESS_OPTIONS
Options for UNIX Domain addresses.
struct GNUNET_PeerIdentity sender
What is the identity of the sender (GNUNET_hash of public key)
static char * address
GNS address for this phone.
void * libgnunet_plugin_transport_unix_done(void *cls)
Shutdown the plugin.
struct UNIXMessageWrapper * msg_tail
Tail of queue of messages to transmit.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
int GNUNET_NETWORK_socket_close(struct GNUNET_NETWORK_Handle *desc)
Close a socket.
#define GNUNET_HELLO_address_free(addr)
Free an address.
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.
void * sic_cls
Closure for sic.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
GNUNET_TRANSPORT_GetNetworkTypeForAddress get_network_for_address
Function to obtain the network type for an address.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_create(int domain, int type, int protocol)
Create a new socket.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.