44 #define PLUGIN_NAME "wlan"
45 #define CONFIG_NAME "transport-wlan"
46 #define HELPER_NAME "gnunet-helper-transport-wlan"
47 #define DUMMY_HELPER_NAME "gnunet-helper-transport-wlan-dummy"
48 #define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_wlan_init
49 #define LIBGNUNET_PLUGIN_TRANSPORT_DONE libgnunet_plugin_transport_wlan_done
50 #define LOG(kind, ...) GNUNET_log_from (kind, "transport-wlan", __VA_ARGS__)
56 #define MACENDPOINT_TIMEOUT GNUNET_TIME_relative_multiply ( \
57 GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2)
64 #define HELLO_BEACON_SCALING_FACTOR GNUNET_TIME_relative_multiply ( \
65 GNUNET_TIME_UNIT_SECONDS, 2)
72 #define PLUGIN_NAME "bluetooth"
73 #define CONFIG_NAME "transport-bluetooth"
74 #define HELPER_NAME "gnunet-helper-transport-bluetooth"
76 #define DUMMY_HELPER_NAME "gnunet-helper-transport-wlan-dummy"
77 #define LIBGNUNET_PLUGIN_TRANSPORT_INIT \
78 libgnunet_plugin_transport_bluetooth_init
79 #define LIBGNUNET_PLUGIN_TRANSPORT_DONE \
80 libgnunet_plugin_transport_bluetooth_done
81 #define LOG(kind, ...) GNUNET_log_from (kind, "transport-bluetooth", \
87 #define MACENDPOINT_TIMEOUT GNUNET_TIME_relative_multiply ( \
88 GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 60)
96 #define HELLO_BEACON_SCALING_FACTOR GNUNET_TIME_relative_multiply ( \
97 GNUNET_TIME_UNIT_SECONDS, 60)
101 #error need to build wlan or bluetooth
131 #define WLAN_MTU 1430
147 #define MESSAGES_IN_DEFRAG_QUEUE_PER_MAC 2
153 #define WLAN_LLC_DSAP_FIELD 0x1f
154 #define WLAN_LLC_SSAP_FIELD 0x1f
586 static char macstr[20];
590 "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
593 mac->
mac[4], mac->
mac[5]);
615 static char macstr[36];
653 info.num_msg_pending = 0;
654 info.num_bytes_pending = 0;
678 if (NULL != endpoint)
707 const int rate = 11000000;
710 header->
addr1 = *to_mac_addr;
736 uint16_t msize = ntohs (hdr->
size);
741 if (NULL == endpoint)
752 "Sending ACK to %s\n",
757 &radio_header->
frame,
787 _ (
"# Messages defragmented"),
828 _ (
"# Sessions allocated"),
891 for (session = endpoint->
sessions_head; NULL != session; session =
893 if (0 == memcmp (
peer, &session->
target,
sizeof(
struct
914 _ (
"# Sessions allocated"),
926 session->
mac = endpoint;
941 "Created new session %p for peer `%s' with endpoint %s\n",
1005 if (NULL == endpoint)
1010 msize = ntohs (hdr->
size);
1019 "Sending %u bytes of data to MAC `%s'\n",
1020 (
unsigned int) msize,
1024 &radio_header->
frame,
1037 _ (
"# message fragments sent"),
1046 "# bytes currently in buffers",
1049 "# bytes transmitted",
1066 _ (
"# messages pending (with fragmentation)"),
1076 if (NULL != fm->
msg)
1108 if (NULL != fm->
cont)
1140 size_t payload_size,
1195 _ (
"# MAC endpoints allocated"),
1207 if (NULL != endpoint->
defrag)
1261 for (pos =
plugin->mac_head; NULL != pos; pos = pos->
next)
1287 _ (
"# MAC endpoints allocated"),
1290 "New MAC endpoint `%s'\n",
1359 "Service asked to create session for peer `%s' with MAC `%s'\n",
1386 for (endpoint =
plugin->mac_head; NULL != endpoint; endpoint = endpoint->
next)
1387 for (session = endpoint->
sessions_head; NULL != session; session =
1389 if (0 == memcmp (target, &session->
target,
1428 const char *msgbuf,
size_t msgbuf_size,
1429 unsigned int priority,
1439 "Transmitting %llu bytes of payload to peer `%s' (starting with %u byte message of type %u)\n",
1440 (
unsigned long long) msgbuf_size,
1454 "# bytes currently in buffers",
1489 msize = ntohs (hdr->
size);
1495 switch (ntohs (hdr->
type))
1513 "Processing %u bytes of HELLO from peer `%s' at MAC %s\n",
1514 (
unsigned int) msize,
1521 _ (
"# HELLO messages received"), 1,
1553 "Processing %u bytes of FRAGMENT from MAC %s\n",
1554 (
unsigned int) msize,
1559 _ (
"# fragments received"),
1573 _ (
"# ACKs received"),
1581 "Got last ACK, finished message transmission to `%s' (%p)\n",
1587 MACENDPOINT_TIMEOUT);
1588 if (NULL != fm->
cont)
1603 "Got an ACK, message transmission to `%s' not yet finished\n",
1612 "ACK not matched against any active fragmentation with MAC `%s'\n",
1629 wlanheader = (
const struct WlanHeader *) hdr;
1630 if (0 != memcmp (&wlanheader->
target,
1631 plugin->env->my_identity,
1635 "Data for `%s', not for me, ignoring\n",
1639 if (ntohl (wlanheader->
crc) !=
1645 "# DATA messages discarded due to CRC32 error"),
1666 "Notifying transport about peer `%s''s new session %p \n",
1672 "Processing %u bytes of DATA from peer `%s'\n",
1673 (
unsigned int) msize,
1679 (
const char *) &wlanheader[1],
1697 "Received packet with %u bytes of type %u from peer %s\n",
1698 (
unsigned int) msize,
1699 (
unsigned int) ntohs (hdr->type),
1721 uint16_t hello_size;
1725 hello =
plugin->env->get_our_hello ();
1736 "Sending %u byte HELLO beacon\n",
1737 (
unsigned int)
size);
1741 "Broadcasting %u bytes of data to MAC `%s'\n",
1742 (
unsigned int)
size,
1752 _ (
"# HELLO beacons sent"),
1758 (HELLO_BEACON_SCALING_FACTOR,
1785 msize = ntohs (hdr->
size);
1786 switch (ntohs (hdr->
type))
1797 if (0 == memcmp (&
plugin->mac_address,
1819 for (endpoint =
plugin->mac_head; NULL != endpoint; endpoint =
1855 "Received WLAN_HELPER_CONTROL message with MAC address `%s' for peer `%s'\n",
1866 "Got data message from helper with %u bytes\n",
1869 _ (
"# DATA messages received"), 1,
1874 "Size of packet is too small (%llu bytes < %llu)\n",
1875 (
unsigned long long) msize,
1876 (
unsigned long long)
sizeof(
struct
1905 _ (
"# DATA messages processed"),
1908 "Receiving %u bytes of data from MAC `%s'\n",
1909 (
unsigned int) (msize -
sizeof(
struct
1913 "Receiving %u bytes of data to MAC `%s'\n",
1914 (
unsigned int) (msize -
sizeof(
struct
1918 "Receiving %u bytes of data with BSSID MAC `%s'\n",
1919 (
unsigned int) (msize -
sizeof(
struct
1928 (
const char *) &rxinfo[1],
1929 msize -
sizeof(
struct
1937 "Unexpected message of type %u (%u bytes)",
1974 "Rejecting MAC `%s': I don't know my MAC!\n",
1978 if (0 != memcmp (&wa->
mac,
1983 "Rejecting MAC `%s': not my MAC!\n",
2051 memset (&wa, 0,
sizeof(wa));
2066 if (NULL !=
plugin->beacon_task)
2069 plugin->beacon_task = NULL;
2071 if (NULL !=
plugin->suid_helper)
2075 plugin->suid_helper = NULL;
2077 endpoint_next =
plugin->mac_head;
2078 while (NULL != (endpoint = endpoint_next))
2080 endpoint_next = endpoint->
next;
2083 if (NULL !=
plugin->fragment_data_tokenizer)
2086 plugin->fragment_data_tokenizer = NULL;
2088 if (NULL !=
plugin->wlan_header_payload_tokenizer)
2091 plugin->wlan_header_payload_tokenizer = NULL;
2093 if (NULL !=
plugin->helper_payload_tokenizer)
2096 plugin->helper_payload_tokenizer = NULL;
2130 if ((NULL == addr) || (0 == addrlen))
2135 if (
'\0' != addr[addrlen - 1])
2140 if (strlen (addr) != addrlen - 1)
2146 if (8 != sscanf (addr,
2147 "%4s.%u.%X:%X:%X:%X:%X:%X",
2149 &a[0], &a[1], &a[2],
2150 &a[3], &a[4], &a[5]))
2156 for (i = 0; i < 6; i++)
2187 plugin->sic_cls = sic_cls;
2201 sic (sic_cls, NULL, NULL);
2259 unsigned long long testmode;
2263 if (NULL ==
env->receive)
2294 if ((0 == testmode) &&
2301 _ (
"Helper binary `%s' not SUID, cannot run WLAN transport\n"),
2323 _ (
"# sessions allocated"),
2326 _ (
"# MAC endpoints allocated"),
2343 switch ((
unsigned int) testmode)
2346 plugin->helper_argv[0] = (
char *) HELPER_NAME;
2348 plugin->helper_argv[2] = NULL;
2358 plugin->helper_argv[0] = (
char *) DUMMY_HELPER_NAME;
2359 plugin->helper_argv[1] = (
char *)
"1";
2360 plugin->helper_argv[2] = NULL;
2370 plugin->helper_argv[0] = (
char *) DUMMY_HELPER_NAME;
2371 plugin->helper_argv[1] = (
char *)
"2";
2372 plugin->helper_argv[2] = 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.
enum State state
current state of profiling
static int result
Global testing status.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
#define IEEE80211_FC0_TYPE_DATA
static int numeric
Option -n.
Library to help fragment messages.
Helper library for handling HELLOs.
Constants for network protocols.
API to create, modify and access statistics.
Transport service plugin API.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
struct GNUNET_BANDWIDTH_Value32NBO GNUNET_BANDWIDTH_value_init(uint32_t bytes_per_second)
Create a new bandwidth value.
void GNUNET_BANDWIDTH_tracker_init(struct GNUNET_BANDWIDTH_Tracker *av, GNUNET_BANDWIDTH_TrackerUpdateCallback update_cb, void *update_cb_cls, struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit, uint32_t max_carry_s)
Initialize bandwidth tracker.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_have_value(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Test if we have a value for a particular option.
#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?
#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.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
int GNUNET_DEFRAGMENT_process_fragment(struct GNUNET_DEFRAGMENT_Context *dc, const struct GNUNET_MessageHeader *msg)
We have received a fragment.
void GNUNET_FRAGMENT_context_transmission_done(struct GNUNET_FRAGMENT_Context *fc)
Continuation to call from the 'proc' function after the fragment has been transmitted (and hence the ...
int GNUNET_FRAGMENT_process_ack(struct GNUNET_FRAGMENT_Context *fc, const struct GNUNET_MessageHeader *msg)
Process an acknowledgement message we got from the other side (to control re-transmits).
void GNUNET_DEFRAGMENT_context_destroy(struct GNUNET_DEFRAGMENT_Context *dc)
Destroy the given defragmentation context.
struct GNUNET_DEFRAGMENT_Context * GNUNET_DEFRAGMENT_context_create(struct GNUNET_STATISTICS_Handle *stats, uint16_t mtu, unsigned int num_msgs, void *cls, GNUNET_FRAGMENT_MessageProcessor proc, GNUNET_DEFRAGMENT_AckProcessor ackp)
Create a defragmentation context.
void GNUNET_FRAGMENT_context_destroy(struct GNUNET_FRAGMENT_Context *fc, struct GNUNET_TIME_Relative *msg_delay, struct GNUNET_TIME_Relative *ack_delay)
Destroy the given fragmentation context (stop calling 'proc', free resources).
struct GNUNET_FRAGMENT_Context * GNUNET_FRAGMENT_context_create(struct GNUNET_STATISTICS_Handle *stats, uint16_t mtu, struct GNUNET_BANDWIDTH_Tracker *tracker, struct GNUNET_TIME_Relative msg_delay, struct GNUNET_TIME_Relative ack_delay, const struct GNUNET_MessageHeader *msg, GNUNET_FRAGMENT_MessageProcessor proc, void *proc_cls)
Create a fragmentation context for the given message.
int32_t GNUNET_CRYPTO_crc32_n(const void *buf, size_t len)
Compute the CRC32 checksum for the first len bytes of the buffer.
int GNUNET_HELLO_get_id(const struct GNUNET_HELLO_Message *hello, struct GNUNET_PeerIdentity *peer)
Get the peer identity from a HELLO message.
uint16_t GNUNET_HELLO_size(const struct GNUNET_HELLO_Message *hello)
Return the size of the given HELLO message.
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.
@ GNUNET_HELLO_ADDRESS_INFO_NONE
No additional information.
void GNUNET_HELPER_send_cancel(struct GNUNET_HELPER_SendHandle *sh)
Cancel a GNUNET_HELPER_send operation.
struct GNUNET_HELPER_SendHandle * GNUNET_HELPER_send(struct GNUNET_HELPER_Handle *h, const struct GNUNET_MessageHeader *msg, int can_drop, GNUNET_HELPER_Continuation cont, void *cont_cls)
Send an message to the helper.
struct GNUNET_HELPER_Handle * GNUNET_HELPER_start(int with_control_pipe, const char *binary_name, char *const binary_argv[], GNUNET_MessageTokenizerCallback cb, GNUNET_HELPER_ExceptionCallback exp_cb, void *cb_cls)
Starts a helper and begins reading from it.
void GNUNET_HELPER_stop(struct GNUNET_HELPER_Handle *h, int soft_kill)
Kills the helper, closes the pipe, frees the handle and calls wait() on the helper process.
#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_htole16(x)
#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.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
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.
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
@ GNUNET_NT_WLAN
Wireless LAN (i.e.
@ GNUNET_NT_BT
Bluetooth LAN.
char * GNUNET_OS_get_libexec_binary_path(const char *progname)
Given the name of a gnunet-helper, gnunet-service or gnunet-daemon binary, try to prefix it with the ...
enum GNUNET_GenericReturnValue GNUNET_OS_check_helper_binary(const char *binary, bool check_suid, const char *params)
Check whether an executable exists and possibly if the suid bit is set on the file.
#define GNUNET_MESSAGE_TYPE_FRAGMENT
FRAGMENT of a larger message.
#define GNUNET_MESSAGE_TYPE_WLAN_DATA
Type of messages for data over the wlan.
#define GNUNET_MESSAGE_TYPE_FRAGMENT_ACK
Acknowledgement of a FRAGMENT of a larger message.
#define GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER
Type of data messages from the plugin to the gnunet-wlan-helper.
#define GNUNET_MESSAGE_TYPE_HELLO
HELLO message with friend only flag used for communicating peer addresses.
#define GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL
Control message between the gnunet-wlan-helper and the daemon (with the MAC).
#define GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER
Type of data messages from the gnunet-wlan-helper to the plugin.
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.
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.
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.
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?
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
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_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
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.
static unsigned int size
Size of the "table".
int GNUNET_SERVER_mst_receive(struct GNUNET_SERVER_MessageStreamTokenizer *mst, void *client_identity, const char *buf, size_t size, int purge, int one_shot)
Add incoming data to the receive buffer and call the callback for all complete messages.
struct GNUNET_SERVER_MessageStreamTokenizer * GNUNET_SERVER_mst_create(GNUNET_SERVER_MessageTokenizerCallback cb, void *cb_cls)
Create a message stream tokenizer.
void GNUNET_SERVER_mst_destroy(struct GNUNET_SERVER_MessageStreamTokenizer *mst)
Destroys a tokenizer.
int(* GNUNET_SERVER_MessageTokenizerCallback)(void *cls, void *client, const struct GNUNET_MessageHeader *message)
Functions with this signature are called whenever a complete message is received by the tokenizer.
static struct MacEndpoint * create_macendpoint(struct Plugin *plugin, struct WlanAddress *mac)
Find (or create) a MacEndpoint with a specific MAC address.
static void fragmentmessage_timeout(void *cls)
A FragmentMessage has timed out.
static ssize_t wlan_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 unsigned int wlan_plugin_query_keepalive_factor(void *cls)
Function that is called to get the keepalive factor.
static void free_fragment_message(struct FragmentMessage *fm)
Frees the space of a message in the fragment queue (send queue)
#define WLAN_MTU
Max size of packet (that we give to the WLAN driver for transmission)
static const char * mac_to_string(const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac)
Print MAC addresses nicely.
void * LIBGNUNET_PLUGIN_TRANSPORT_INIT(void *cls)
Entry point for the plugin.
static void free_macendpoint(struct MacEndpoint *endpoint)
Free a MAC endpoint.
static void send_ack(void *cls, uint32_t msg_id, const struct GNUNET_MessageHeader *hdr)
Send an ACK for a fragment we received.
static void session_timeout(void *cls)
A session is timing out.
static void wlan_plugin_update_inbound_delay(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 inbou...
static void wlan_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 enum GNUNET_NetworkType scope
Which network scope do we belong to?
static void wlan_data_message_handler(void *cls, const struct GNUNET_MessageHeader *hdr)
Handles the data after all fragments are put together.
static void wlan_plugin_setup_monitor(void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls)
Begin monitoring sessions of a plugin.
static int wlan_plugin_disconnect_session(void *cls, struct GNUNET_ATS_Session *session)
Free a session.
static void send_hello_beacon(void *cls)
Task to (periodically) send a HELLO beacon.
static void get_wlan_header(struct Plugin *plugin, struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header, const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, unsigned int size)
Generate the WLAN hardware header for one packet.
static struct GNUNET_ATS_Session * wlan_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.
#define WLAN_LLC_DSAP_FIELD
Link layer control fields for better compatibility (i.e.
static int wlan_plugin_address_suggested(void *cls, const void *addr, size_t addrlen)
Another peer has suggested an address for this peer and transport plugin.
static void send_with_fragmentation(struct MacEndpoint *endpoint, struct GNUNET_TIME_Relative timeout, const struct GNUNET_PeerIdentity *target, const struct GNUNET_MessageHeader *msg, size_t payload_size, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
Transmit a message to the given destination with fragmentation.
void * LIBGNUNET_PLUGIN_TRANSPORT_DONE(void *cls)
Exit point from the plugin.
static int wlan_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 transmit_fragment(void *cls, const struct GNUNET_MessageHeader *hdr)
Transmit a fragment of a message.
static void wlan_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 wlan_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 void macendpoint_timeout(void *cls)
A MAC endpoint is timing out.
static enum GNUNET_NetworkType wlan_plugin_get_network(void *cls, struct GNUNET_ATS_Session *session)
Function obtain the network type for a session.
static const char * wlan_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 WLAN_LLC_SSAP_FIELD
#define MESSAGES_IN_DEFRAG_QUEUE_PER_MAC
Maximum number of messages in defragmentation queue per MAC.
static void fragment_transmission_done(void *cls, int result)
Function called once we have successfully given the fragment message to the SUID helper process and w...
static int process_data(void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
We have received data from the WLAN via some session.
static int handle_helper_message(void *cls, const struct GNUNET_MessageHeader *hdr)
Function used for to process the data from the suid process.
static void get_radiotap_header(struct MacEndpoint *endpoint, struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header, uint16_t size)
Fill the radiotap header.
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 enum GNUNET_NetworkType wlan_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 * get_session(struct MacEndpoint *endpoint, const struct GNUNET_PeerIdentity *peer)
Look up a session for a peer and create a new session if none is found.
static struct GNUNET_ATS_Session * create_session(struct MacEndpoint *endpoint, const struct GNUNET_PeerIdentity *peer)
Create a new session.
static struct GNUNET_ATS_Session * lookup_session(struct MacEndpoint *endpoint, const struct GNUNET_PeerIdentity *peer)
Lookup a new session.
header for transport plugin and the helper for wlan
static GNUNET_NETWORK_STRUCT_END const struct GNUNET_TRANSPORT_WLAN_MacAddress mac_bssid_gnunet
GNUnet bssid.
static const struct GNUNET_TRANSPORT_WLAN_MacAddress bc_all_mac
Broadcast MAC.
Struct for messages that are being fragmented in a MAC's transmission queue.
struct GNUNET_PeerIdentity target
Intended recipient.
struct GNUNET_HELPER_SendHandle * sh
Transmission handle to helper (to cancel if the frag context is destroyed early for some reason).
struct FragmentMessage * prev
This is a doubly-linked list.
struct GNUNET_FRAGMENT_Context * fragcontext
Fragmentation context.
size_t size_on_wire
Number of bytes used to transmit message.
struct MacEndpoint * macendpoint
MAC endpoint this message belongs to.
struct GNUNET_TIME_Absolute timeout
Timeout value for the message.
struct GNUNET_MessageHeader * msg
Message we need to fragment and transmit, NULL after the fragmentcontext has been created.
GNUNET_TRANSPORT_TransmitContinuation cont
Continuation to call when we're done with this message.
void * cont_cls
Closure for cont.
struct FragmentMessage * next
This is a doubly-linked list.
size_t size_payload
Size of original message.
struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task.
Session handle for connections.
struct GNUNET_PeerIdentity target
To whom are we talking to.
struct MacEndpoint * mac
MAC endpoint with the address of 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.
struct GNUNET_SCHEDULER_Task * timeout_task
Session timeout task.
struct GNUNET_ATS_Session * prev
Stored in a linked list.
Struct to track available bandwidth.
void * cls
Closure for all of the callbacks.
Defragmentation context (one per connection).
An address for communicating with a peer.
A HELLO message is used to exchange information about transports with other peers.
The handle to a helper process.
Entry in the queue of messages we need to transmit to the helper.
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Handle to a message stream tokenizer.
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.
Format of a WLAN Control Message.
struct GNUNET_MessageHeader hdr
Message header.
struct GNUNET_TRANSPORT_WLAN_MacAddress mac
MAC Address of the local WLAN interface.
generic definitions for IEEE 802.11 frames
uint16_t frame_control
802.11 Frame Control field.
struct GNUNET_TRANSPORT_WLAN_MacAddress addr1
Address 1: destination address in ad-hoc mode or AP, BSSID if station,.
uint16_t duration
Microseconds to reserve link (duration), 0 by default.
u_int8_t llc[4]
Link layer control (LLC).
struct GNUNET_TRANSPORT_WLAN_MacAddress addr3
Address 3: BSSID in ad-hoc mode, Destination if station, source if AP.
struct GNUNET_TRANSPORT_WLAN_MacAddress addr2
Address 2: source address if in ad-hoc-mode or station, BSSID if AP.
uint16_t sequence_control
802.11 sequence control field; contains fragment number an sequence number (we set this to all zeros)...
Message from the WLAN helper to the plugin: we have received the given message with the given perform...
struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame frame
IEEE Frame.
Message from the plugin to the WLAN helper: send the given message with the given connection paramete...
uint16_t tx_power
Transmit power expressed as unitless distance from max power set at factory calibration.
uint8_t rate
wlan send rate
struct GNUNET_MessageHeader header
Type is 'GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER'.
struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame frame
IEEE Frame to transmit (the sender MAC address will be overwritten by the helper as it does not trust...
uint8_t antenna
Antenna; the first antenna is 0.
Information associated with a message.
struct GNUNET_ATS_Session * session
NULL if the identity of the other peer is not known.
struct MacEndpoint * endpoint
MAC address of the other peer, NULL if not known.
Struct to represent one network card connection.
struct GNUNET_TIME_Relative ack_delay
ACK delay for fragmentation context.
struct GNUNET_TIME_Absolute timeout
When should this endpoint time out?
uint8_t rate
Desired transmission rate for this MAC.
struct GNUNET_TIME_Relative msg_delay
Message delay for fragmentation context.
struct GNUNET_ATS_Session * sessions_head
Head of sessions that use this MAC.
struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task.
struct FragmentMessage * sending_messages_head
Head of messages we are currently sending to this MAC.
struct Plugin * plugin
Pointer to the global plugin struct.
unsigned int fragment_messages_out_count
count of messages in the fragment out queue for this mac endpoint
struct MacEndpoint * prev
We keep all MACs in a DLL in the plugin.
struct GNUNET_DEFRAGMENT_Context * defrag
Defrag context for this MAC.
uint8_t antenna
Antenna we should use for this MAC.
struct FragmentMessage * sending_messages_tail
Tail of messages we are currently sending to this MAC.
struct MacEndpoint * next
We keep all MACs in a DLL in the plugin.
uint16_t tx_power
Desired transmission power for this MAC.
struct WlanAddress wlan_addr
peer MAC address
struct GNUNET_ATS_Session * sessions_tail
Tail of sessions that use this MAC.
List containing all messages that are yet to be send.
struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task (for this message).
struct PendingMessage * prev
This is a doubly-linked list.
struct WlanHeader * msg
The pending message.
struct PendingMessage * next
DLL next, prev.
GNUNET_TRANSPORT_TransmitContinuation transmit_cont
Continuation function to call once the message has been sent.
void * transmit_cont_cls
Closure for transmit_cont.
struct GNUNET_TRANSPORT_WLAN_MacAddress mac_address
The mac_address of the wlan card given to us by the helper.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
void * sic_cls
Closure for sic.
struct GNUNET_SCHEDULER_Task * beacon_task
Task that periodically sends a HELLO beacon via the helper.
char * helper_argv[3]
ARGV-vector for the helper (all helpers take only the binary name, one actual argument,...
struct GNUNET_BANDWIDTH_Tracker tracker
Bandwidth tracker to limit global UDP traffic.
struct GNUNET_SERVER_MessageStreamTokenizer * fragment_data_tokenizer
Tokenizer for demultiplexing of data packets resulting from defragmentation.
struct MacEndpoint * mac_tail
Tail of list of open connections.
int have_mac
Have we received a control message with our MAC address yet?
struct GNUNET_SERVER_MessageStreamTokenizer * wlan_header_payload_tokenizer
Tokenizer for demultiplexing of data packets that follow the WLAN Header.
struct MacEndpoint * mac_head
Head of list of open connections.
struct GNUNET_DATACACHE_PluginEnvironment * env
Our execution environment.
char * wlan_interface
The interface of the wlan card given to us by the user.
uint32_t options
Options for addresses.
unsigned int mac_count
Number of connections.
GNUNET_TRANSPORT_SessionInfoCallback sic
Function to call about session status changes.
struct GNUNET_SERVER_MessageStreamTokenizer * helper_payload_tokenizer
Tokenizer for demultiplexing of data packets received from the suid helper.
struct GNUNET_HELPER_Handle * suid_helper
Handle to helper process for privileged operations.
struct GNUNET_TRANSPORT_WLAN_MacAddress mac
WLAN addresses using MACs.
uint32_t options
Options set for the WLAN, in NBO.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.