transport plugin for wlan and/or bluetooth More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
#include "gnunet_transport_plugin.h"
#include "plugin_transport_wlan.h"
#include "gnunet_fragmentation_lib.h"
#include "gnunet_constants.h"
#include "tcp_server_mst_legacy.c"
Go to the source code of this file.
Data Structures | |
struct | WlanHeader |
Header for messages which need fragmentation. More... | |
struct | WlanAddress |
Address format for WLAN. More... | |
struct | PendingMessage |
List containing all messages that are yet to be send. More... | |
struct | GNUNET_ATS_Session |
Session handle for connections. More... | |
struct | FragmentMessage |
Struct for messages that are being fragmented in a MAC's transmission queue. More... | |
struct | MacEndpoint |
Struct to represent one network card connection. More... | |
struct | Plugin |
Handle for a plugin. More... | |
struct | MacAndSession |
Information associated with a message. More... | |
Macros | |
#define | WLAN_MTU 1430 |
Max size of packet (that we give to the WLAN driver for transmission) More... | |
#define | MESSAGES_IN_DEFRAG_QUEUE_PER_MAC 2 |
Maximum number of messages in defragmentation queue per MAC. More... | |
#define | WLAN_LLC_DSAP_FIELD 0x1f |
Link layer control fields for better compatibility (i.e. More... | |
#define | WLAN_LLC_SSAP_FIELD 0x1f |
Typedefs | |
typedef 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. More... | |
Functions | |
static const char * | mac_to_string (const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac) |
Print MAC addresses nicely. More... | |
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. More... | |
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. More... | |
static void | get_radiotap_header (struct MacEndpoint *endpoint, struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header, uint16_t size) |
Fill the radiotap header. More... | |
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. More... | |
static void | send_ack (void *cls, uint32_t msg_id, const struct GNUNET_MessageHeader *hdr) |
Send an ACK for a fragment we received. More... | |
static void | wlan_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hdr) |
Handles the data after all fragments are put together. More... | |
static int | wlan_plugin_disconnect_session (void *cls, struct GNUNET_ATS_Session *session) |
Free a session. More... | |
static unsigned int | wlan_plugin_query_keepalive_factor (void *cls) |
Function that is called to get the keepalive factor. More... | |
static void | session_timeout (void *cls) |
A session is timing out. More... | |
static struct GNUNET_ATS_Session * | lookup_session (struct MacEndpoint *endpoint, const struct GNUNET_PeerIdentity *peer) |
Lookup a new session. More... | |
static struct GNUNET_ATS_Session * | create_session (struct MacEndpoint *endpoint, const struct GNUNET_PeerIdentity *peer) |
Create a new session. More... | |
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. More... | |
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 we are thus ready for the next fragment. More... | |
static void | transmit_fragment (void *cls, const struct GNUNET_MessageHeader *hdr) |
Transmit a fragment of a message. More... | |
static void | free_fragment_message (struct FragmentMessage *fm) |
Frees the space of a message in the fragment queue (send queue) More... | |
static void | fragmentmessage_timeout (void *cls) |
A FragmentMessage has timed out. More... | |
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. More... | |
static void | free_macendpoint (struct MacEndpoint *endpoint) |
Free a MAC endpoint. More... | |
static void | macendpoint_timeout (void *cls) |
A MAC endpoint is timing out. More... | |
static struct MacEndpoint * | create_macendpoint (struct Plugin *plugin, struct WlanAddress *mac) |
Find (or create) a MacEndpoint with a specific MAC address. More... | |
static enum GNUNET_NetworkType | wlan_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) |
Function obtain the network type for a session. More... | |
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. More... | |
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. More... | |
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 previous transmissions (and their continuation). More... | |
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. More... | |
static int | process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) |
We have received data from the WLAN via some session. More... | |
static void | send_hello_beacon (void *cls) |
Task to (periodically) send a HELLO beacon. More... | |
static int | handle_helper_message (void *cls, const struct GNUNET_MessageHeader *hdr) |
Function used for to process the data from the suid process. More... | |
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. More... | |
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. More... | |
void * | LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) |
Exit point from the plugin. More... | |
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. More... | |
static void | wlan_plugin_setup_monitor (void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls) |
Begin monitoring sessions of a plugin. More... | |
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 is still active and in use and therefore the session timeout for this session has to be updated. More... | |
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 inbound quota changed and that the plugin should update it's delay for the next receive value. More... | |
void * | LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) |
Entry point for the plugin. More... | |
Variables | |
static enum GNUNET_NetworkType | scope = GNUNET_NT_BT |
Which network scope do we belong to? More... | |
transport plugin for wlan and/or bluetooth
BUILD_WLAN or BUILD_BLUETOOTH must be defined such that the respective variant of this code is compiled.
Definition in file plugin_transport_wlan.c.
#define WLAN_MTU 1430 |
Max size of packet (that we give to the WLAN driver for transmission)
Definition at line 131 of file plugin_transport_wlan.c.
#define MESSAGES_IN_DEFRAG_QUEUE_PER_MAC 2 |
Maximum number of messages in defragmentation queue per MAC.
Definition at line 147 of file plugin_transport_wlan.c.
#define WLAN_LLC_DSAP_FIELD 0x1f |
Link layer control fields for better compatibility (i.e.
GNUnet over WLAN is not IP-over-WLAN).
Definition at line 153 of file plugin_transport_wlan.c.
#define WLAN_LLC_SSAP_FIELD 0x1f |
Definition at line 154 of file plugin_transport_wlan.c.
typedef 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.
Do not call GNUNET_SERVER_mst_destroy from within the scope of this callback.
cls | closure |
client | identification of the client |
message | the actual message |
Definition at line 117 of file plugin_transport_wlan.c.
|
static |
Print MAC addresses nicely.
mac | the mac address |
Definition at line 584 of file plugin_transport_wlan.c.
References GNUNET_snprintf(), and GNUNET_TRANSPORT_WLAN_MacAddress::mac.
Referenced by create_session(), handle_helper_message(), send_ack(), send_hello_beacon(), transmit_fragment(), wlan_plugin_address_suggested(), and wlan_plugin_address_to_string().
|
static |
Function called for a quick conversion of the binary address to a numeric address.
Note that the caller must not free the address and that the next call to this function is allowed to override the address again.
cls | closure |
addr | binary address |
addrlen | length of the address |
Definition at line 610 of file plugin_transport_wlan.c.
References GNUNET_break, GNUNET_snprintf(), WlanAddress::mac, GNUNET_TRANSPORT_WLAN_MacAddress::mac, mac_to_string(), options, and PLUGIN_NAME.
Referenced by create_macendpoint(), process_data(), wlan_plugin_address_pretty_printer(), and wlan_plugin_get_session().
|
static |
If a session monitor is attached, notify it about the new session state.
plugin | our plugin |
session | session that changed state |
state | new state of the session |
Definition at line 642 of file plugin_transport_wlan.c.
References GNUNET_ATS_Session::address, GNUNET_SYSERR, GNUNET_TIME_UNIT_ZERO_ABS, info, plugin, state, and GNUNET_ATS_Session::timeout.
Referenced by create_session(), wlan_plugin_disconnect_session(), and wlan_plugin_setup_monitor().
|
static |
Fill the radiotap header.
endpoint | pointer to the endpoint, can be NULL |
header | pointer to the radiotap header |
size | total message size |
Definition at line 672 of file plugin_transport_wlan.c.
References MacEndpoint::antenna, GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::antenna, GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER, GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::header, MacEndpoint::rate, GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::rate, GNUNET_MessageHeader::size, size, MacEndpoint::tx_power, GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::tx_power, and GNUNET_MessageHeader::type.
Referenced by send_ack(), send_hello_beacon(), and transmit_fragment().
|
static |
Generate the WLAN hardware header for one packet.
plugin | the plugin handle |
header | address to write the header to |
to_mac_addr | address of the recipient |
size | size of the whole packet, needed to calculate the time to send the packet |
Definition at line 702 of file plugin_transport_wlan.c.
References GNUNET_TRANSPORT_WLAN_Ieee80211Frame::addr1, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::addr2, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::addr3, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::duration, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::frame_control, GNUNET_htole16, IEEE80211_FC0_TYPE_DATA, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::llc, mac_bssid_gnunet, plugin, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::sequence_control, size, WLAN_LLC_DSAP_FIELD, and WLAN_LLC_SSAP_FIELD.
Referenced by send_ack(), send_hello_beacon(), and transmit_fragment().
|
static |
Send an ACK for a fragment we received.
cls | the struct MacEndpoint * the ACK must be sent to |
msg_id | id of the message |
hdr | pointer to the hdr where the ack is stored |
Definition at line 730 of file plugin_transport_wlan.c.
References _, buf, Plugin::env, GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::frame, get_radiotap_header(), get_wlan_header(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELPER_send(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::header, LOG, WlanAddress::mac, mac_to_string(), MacEndpoint::plugin, GNUNET_MessageHeader::size, size, Plugin::suid_helper, and MacEndpoint::wlan_addr.
Referenced by create_macendpoint().
|
static |
Handles the data after all fragments are put together.
cls | macendpoint this messages belongs to |
hdr | pointer to the data |
Definition at line 779 of file plugin_transport_wlan.c.
References _, MacAndSession::endpoint, GNUNET_NO, GNUNET_SERVER_mst_receive(), GNUNET_STATISTICS_update(), GNUNET_YES, plugin, MacEndpoint::plugin, MacAndSession::session, and GNUNET_MessageHeader::size.
Referenced by create_macendpoint().
|
static |
Free a session.
cls | our struct Plugin . |
session | the session free |
Definition at line 807 of file plugin_transport_wlan.c.
References _, GNUNET_ATS_Session::address, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_HELLO_address_free, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_update(), GNUNET_TRANSPORT_SS_DONE, GNUNET_ATS_Session::mac, notify_session_monitor(), plugin, MacEndpoint::plugin, MacEndpoint::sessions_head, MacEndpoint::sessions_tail, and GNUNET_ATS_Session::timeout_task.
Referenced by free_macendpoint(), session_timeout(), and wlan_plugin_disconnect_peer().
|
static |
Function that is called to get the keepalive factor.
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to calculate the interval between keepalive packets.
cls | closure with the struct Plugin |
Definition at line 846 of file plugin_transport_wlan.c.
|
static |
A session is timing out.
Clean up.
cls | pointer to the Session |
Definition at line 858 of file plugin_transport_wlan.c.
References GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_absolute_get_remaining(), GNUNET_ATS_Session::mac, MacEndpoint::plugin, GNUNET_TIME_Relative::rel_value_us, GNUNET_ATS_Session::timeout, GNUNET_ATS_Session::timeout_task, and wlan_plugin_disconnect_session().
Referenced by create_session().
|
static |
Lookup a new session.
endpoint | pointer to the mac endpoint of the peer |
peer | peer identity to use for this session |
Definition at line 886 of file plugin_transport_wlan.c.
References GNUNET_ATS_Session::next, peer, MacEndpoint::sessions_head, and GNUNET_ATS_Session::target.
Referenced by get_session(), and process_data().
|
static |
Create a new session.
endpoint | pointer to the mac endpoint of the peer |
peer | peer identity to use for this session |
Definition at line 908 of file plugin_transport_wlan.c.
References _, GNUNET_ATS_Session::address, Plugin::env, GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELLO_address_allocate(), GNUNET_HELLO_ADDRESS_INFO_NONE, GNUNET_i2s(), GNUNET_new, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_STATISTICS_update(), GNUNET_TIME_relative_to_absolute(), GNUNET_TRANSPORT_SS_INIT, GNUNET_TRANSPORT_SS_UP, LOG, WlanAddress::mac, GNUNET_ATS_Session::mac, mac_to_string(), notify_session_monitor(), peer, MacEndpoint::plugin, PLUGIN_NAME, session_timeout(), MacEndpoint::sessions_head, MacEndpoint::sessions_tail, GNUNET_ATS_Session::target, GNUNET_ATS_Session::timeout, GNUNET_ATS_Session::timeout_task, and MacEndpoint::wlan_addr.
Referenced by get_session(), and process_data().
|
static |
Look up a session for a peer and create a new session if none is found.
endpoint | pointer to the mac endpoint of the peer |
peer | peer identity to use for this session |
Definition at line 958 of file plugin_transport_wlan.c.
References create_session(), lookup_session(), and peer.
Referenced by wlan_plugin_get_session().
|
static |
Function called once we have successfully given the fragment message to the SUID helper process and we are thus ready for the next fragment.
cls | the struct FragmentMessage * |
result | result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR if the helper was stopped) |
Definition at line 980 of file plugin_transport_wlan.c.
References FragmentMessage::fragcontext, GNUNET_FRAGMENT_context_transmission_done(), and FragmentMessage::sh.
Referenced by transmit_fragment().
|
static |
Transmit a fragment of a message.
cls | struct FragmentMessage * this fragment message belongs to |
hdr | pointer to the start of the fragment message |
Definition at line 997 of file plugin_transport_wlan.c.
References _, buf, Plugin::env, FragmentMessage::fragcontext, fragment_transmission_done(), GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::frame, get_radiotap_header(), get_wlan_header(), GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_FRAGMENT_context_transmission_done(), GNUNET_HELPER_send(), GNUNET_memcpy, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::header, LOG, WlanAddress::mac, mac_to_string(), FragmentMessage::macendpoint, MacEndpoint::plugin, FragmentMessage::sh, GNUNET_MessageHeader::size, size, FragmentMessage::size_on_wire, Plugin::suid_helper, and MacEndpoint::wlan_addr.
Referenced by handle_helper_message(), and send_with_fragmentation().
|
static |
Frees the space of a message in the fragment queue (send queue)
fm | message to free |
Definition at line 1061 of file plugin_transport_wlan.c.
References _, MacEndpoint::ack_delay, Plugin::env, FragmentMessage::fragcontext, GNUNET_CONTAINER_DLL_remove, GNUNET_FRAGMENT_context_destroy(), GNUNET_free, GNUNET_HELPER_send_cancel(), GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_update(), FragmentMessage::macendpoint, FragmentMessage::msg, MacEndpoint::msg_delay, MacEndpoint::plugin, MacEndpoint::sending_messages_head, MacEndpoint::sending_messages_tail, FragmentMessage::sh, and FragmentMessage::timeout_task.
Referenced by fragmentmessage_timeout(), free_macendpoint(), and process_data().
|
static |
A FragmentMessage has timed out.
Remove it.
cls | pointer to the 'struct FragmentMessage' |
Definition at line 1103 of file plugin_transport_wlan.c.
References FragmentMessage::cont, FragmentMessage::cont_cls, free_fragment_message(), GNUNET_SYSERR, FragmentMessage::size_on_wire, FragmentMessage::size_payload, FragmentMessage::target, and FragmentMessage::timeout_task.
Referenced by send_with_fragmentation().
|
static |
Transmit a message to the given destination with fragmentation.
endpoint | desired destination |
timeout | how long can the message wait? |
target | peer that should receive the message |
msg | message to transmit |
payload_size | bytes of payload |
cont | continuation to call once the message has been transmitted (or if the transport is ready for the next transmission call; or if the peer disconnected...); can be NULL |
cont_cls | closure for cont |
Definition at line 1136 of file plugin_transport_wlan.c.
References MacEndpoint::ack_delay, FragmentMessage::cont, FragmentMessage::cont_cls, FragmentMessage::fragcontext, fragmentmessage_timeout(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_copy_message(), GNUNET_FRAGMENT_context_create(), GNUNET_new, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_relative_to_absolute(), GNUNET_YES, FragmentMessage::macendpoint, msg, FragmentMessage::msg, MacEndpoint::msg_delay, plugin, MacEndpoint::plugin, MacEndpoint::sending_messages_head, MacEndpoint::sending_messages_tail, FragmentMessage::size_payload, FragmentMessage::target, timeout, FragmentMessage::timeout, FragmentMessage::timeout_task, transmit_fragment(), and WLAN_MTU.
Referenced by wlan_plugin_send().
|
static |
Free a MAC endpoint.
endpoint | pointer to the MacEndpoint to free |
Definition at line 1188 of file plugin_transport_wlan.c.
References _, MacEndpoint::defrag, free_fragment_message(), GNUNET_CONTAINER_DLL_remove, GNUNET_DEFRAGMENT_context_destroy(), GNUNET_free, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_update(), plugin, MacEndpoint::plugin, MacEndpoint::sending_messages_head, MacEndpoint::sessions_head, MacEndpoint::timeout_task, and wlan_plugin_disconnect_session().
Referenced by LIBGNUNET_PLUGIN_TRANSPORT_DONE(), and macendpoint_timeout().
|
static |
A MAC endpoint is timing out.
Clean up.
cls | pointer to the struct MacEndpoint * |
Definition at line 1229 of file plugin_transport_wlan.c.
References free_macendpoint(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_Relative::rel_value_us, timeout, MacEndpoint::timeout, and MacEndpoint::timeout_task.
Referenced by create_macendpoint().
|
static |
Find (or create) a MacEndpoint with a specific MAC address.
plugin | pointer to the plugin struct |
mac | the MAC address of the endpoint |
Definition at line 1256 of file plugin_transport_wlan.c.
References _, MacEndpoint::ack_delay, MacEndpoint::defrag, GNUNET_CONTAINER_DLL_insert, GNUNET_DEFRAGMENT_context_create(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_STATISTICS_update(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_MILLISECONDS, LOG, macendpoint_timeout(), MESSAGES_IN_DEFRAG_QUEUE_PER_MAC, MacEndpoint::msg_delay, MacEndpoint::next, plugin, MacEndpoint::plugin, send_ack(), MacEndpoint::timeout, MacEndpoint::timeout_task, MacEndpoint::wlan_addr, wlan_data_message_handler(), WLAN_MTU, and wlan_plugin_address_to_string().
Referenced by handle_helper_message(), and wlan_plugin_get_session().
|
static |
Function obtain the network type for a session.
cls | closure (struct Plugin* ) |
session | the session |
Definition at line 1256 of file plugin_transport_wlan.c.
|
static |
Function obtain the network type for an address.
cls | closure (struct Plugin * ) |
address | the address |
Definition at line 1256 of file plugin_transport_wlan.c.
|
static |
Creates a new outbound session the transport service will use to send data to the peer.
cls | the struct Plugin * |
address | the address |
Definition at line 1345 of file plugin_transport_wlan.c.
References address, create_macendpoint(), get_session(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), LOG, plugin, and wlan_plugin_address_to_string().
|
static |
Function that can be used to force the plugin to disconnect from the given peer and cancel all previous transmissions (and their continuation).
cls | closure |
target | peer from which to disconnect |
Definition at line 1379 of file plugin_transport_wlan.c.
References GNUNET_ATS_Session::next, MacEndpoint::next, plugin, MacEndpoint::sessions_head, GNUNET_ATS_Session::target, and wlan_plugin_disconnect_session().
|
static |
Function that can be used by the transport service to transmit a message using the plugin.
Note that in the case of a peer disconnecting, the continuation MUST be called prior to the disconnect notification itself. This function will be called with this peer's HELLO message to initiate a fresh connection to another peer.
cls | closure |
session | which session must be used |
msgbuf | the message to transmit |
msgbuf_size | number of bytes in msgbuf |
priority | how important is the message (most plugins will ignore message priority and just FIFO) |
to | how long to wait at most for the transmission (does not require plugins to discard the message after the timeout, just advisory for the desired delay; most plugins will ignore this as well) |
cont | continuation to call once the message has been transmitted (or if the transport is ready for the next transmission call; or if the peer disconnected...); can be NULL |
cont_cls | closure for cont |
Definition at line 1426 of file plugin_transport_wlan.c.
References buf, WlanHeader::crc, GNUNET_ALIGN, GNUNET_CRYPTO_crc32_n(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_WLAN_DATA, GNUNET_NO, GNUNET_STATISTICS_update(), WlanHeader::header, LOG, GNUNET_ATS_Session::mac, plugin, send_with_fragmentation(), WlanHeader::sender, GNUNET_MessageHeader::size, size, GNUNET_ATS_Session::target, WlanHeader::target, GNUNET_MessageHeader::type, and type.
|
static |
We have received data from the WLAN via some session.
Process depending on the message type (HELLO, DATA, FRAGMENTATION or FRAGMENTATION-ACK).
cls | pointer to the plugin |
client | pointer to the session this message belongs to |
hdr | start of the message |
Definition at line 1476 of file plugin_transport_wlan.c.
References _, address, GNUNET_ATS_Session::address, FragmentMessage::cont, FragmentMessage::cont_cls, WlanHeader::crc, create_session(), MacEndpoint::defrag, MacAndSession::endpoint, FragmentMessage::fragcontext, free_fragment_message(), GNUNET_break, GNUNET_break_op, GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, GNUNET_CRYPTO_crc32_n(), GNUNET_DEFRAGMENT_process_fragment(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_FRAGMENT_process_ack(), GNUNET_HELLO_address_allocate(), GNUNET_HELLO_address_free, GNUNET_HELLO_ADDRESS_INFO_NONE, GNUNET_HELLO_get_id(), GNUNET_i2s(), GNUNET_MESSAGE_TYPE_FRAGMENT, GNUNET_MESSAGE_TYPE_FRAGMENT_ACK, GNUNET_MESSAGE_TYPE_HELLO, GNUNET_MESSAGE_TYPE_WLAN_DATA, GNUNET_NO, GNUNET_OK, GNUNET_SERVER_mst_receive(), GNUNET_STATISTICS_update(), GNUNET_TIME_relative_to_absolute(), GNUNET_YES, LOG, lookup_session(), FragmentMessage::next, plugin, PLUGIN_NAME, ret, scope, WlanHeader::sender, MacEndpoint::sending_messages_head, MacAndSession::session, GNUNET_MessageHeader::size, FragmentMessage::size_on_wire, FragmentMessage::size_payload, GNUNET_ATS_Session::target, WlanHeader::target, FragmentMessage::target, GNUNET_ATS_Session::timeout, MacEndpoint::timeout, GNUNET_MessageHeader::type, MacEndpoint::wlan_addr, and wlan_plugin_address_to_string().
|
static |
Task to (periodically) send a HELLO beacon.
cls | pointer to the plugin struct |
Definition at line 1717 of file plugin_transport_wlan.c.
References _, bc_all_mac, buf, GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::frame, get_radiotap_header(), get_wlan_header(), GNUNET_ALIGN, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELLO_size(), GNUNET_HELPER_send(), GNUNET_memcpy, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_STATISTICS_update(), GNUNET_TIME_relative_multiply(), GNUNET_YES, GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::header, LOG, mac_to_string(), plugin, size, and WLAN_MTU.
Referenced by handle_helper_message().
|
static |
Function used for to process the data from the suid process.
cls | the plugin handle |
hdr | header of the GNUNET_MessageHeader |
Definition at line 1772 of file plugin_transport_wlan.c.
References _, MacEndpoint::ack_delay, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::addr1, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::addr2, GNUNET_TRANSPORT_WLAN_Ieee80211Frame::addr3, bc_all_mac, create_macendpoint(), MacAndSession::endpoint, FragmentMessage::fragcontext, GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage::frame, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_FRAGMENT_context_create(), GNUNET_free, GNUNET_HELLO_address_allocate(), GNUNET_HELLO_address_free, GNUNET_HELLO_ADDRESS_INFO_NONE, GNUNET_i2s(), GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER, GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SERVER_mst_receive(), GNUNET_STATISTICS_update(), GNUNET_YES, GNUNET_TRANSPORT_WLAN_HelperControlMessage::hdr, LOG, WlanAddress::mac, GNUNET_TRANSPORT_WLAN_HelperControlMessage::mac, mac_bssid_gnunet, mac_to_string(), FragmentMessage::macendpoint, FragmentMessage::msg, MacEndpoint::msg_delay, FragmentMessage::next, MacEndpoint::next, WlanAddress::options, plugin, PLUGIN_NAME, send_hello_beacon(), MacEndpoint::sending_messages_head, MacAndSession::session, GNUNET_MessageHeader::size, transmit_fragment(), GNUNET_MessageHeader::type, and WLAN_MTU.
|
static |
Another peer has suggested an address for this peer and transport plugin.
Check that this could be a valid address. If so, consider adding it to the list of addresses.
cls | closure |
addr | pointer to the address |
addrlen | length of addr |
Definition at line 1958 of file plugin_transport_wlan.c.
References GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, LOG, WlanAddress::mac, mac_to_string(), and plugin.
|
static |
Convert the transports address to a nice, human-readable format.
cls | closure |
type | name of the transport that generated the address |
addr | one of the addresses of the host, NULL for the last address the specific address format depends on the transport |
addrlen | length of the address |
numeric | should (IP) addresses be displayed in numeric form? |
timeout | after how long should we give up? |
asc | function to call on each string |
asc_cls | closure for asc |
Definition at line 2004 of file plugin_transport_wlan.c.
References GNUNET_OK, GNUNET_SYSERR, ret, and wlan_plugin_address_to_string().
void* LIBGNUNET_PLUGIN_TRANSPORT_DONE | ( | void * | cls | ) |
Exit point from the plugin.
cls | pointer to the api struct |
Definition at line 2034 of file plugin_transport_wlan.c.
References address, Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_TRANSPORT_PluginFunctions::cls, free_macendpoint(), GNUNET_free, GNUNET_HELLO_address_allocate(), GNUNET_HELLO_address_free, GNUNET_HELLO_ADDRESS_INFO_NONE, GNUNET_HELPER_stop(), GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_SERVER_mst_destroy(), GNUNET_YES, WlanAddress::mac, MacEndpoint::next, WlanAddress::options, plugin, and PLUGIN_NAME.
|
static |
Function called to convert a string address to a binary address.
cls | closure (struct Plugin * ) |
addr | string address |
addrlen | length of the address |
buf | location to store the buffer |
added | location to store the number of bytes in the buffer. If the function returns GNUNET_SYSERR, its contents are undefined. |
Definition at line 2117 of file plugin_transport_wlan.c.
References buf, GNUNET_break, GNUNET_new, GNUNET_OK, GNUNET_SYSERR, WlanAddress::mac, GNUNET_TRANSPORT_WLAN_MacAddress::mac, options, WlanAddress::options, and plugin.
|
static |
Begin monitoring sessions of a plugin.
There can only be one active monitor per plugin (i.e. if there are multiple monitors, the transport service needs to multiplex the generated events over all of them).
cls | closure of the plugin |
sic | callback to invoke, NULL to disable monitor; plugin will being by iterating over all active sessions immediately and then enter monitor mode |
sic_cls | closure for sic |
Definition at line 2177 of file plugin_transport_wlan.c.
References GNUNET_TRANSPORT_SS_INIT, GNUNET_TRANSPORT_SS_UP, GNUNET_ATS_Session::mac, GNUNET_ATS_Session::next, MacEndpoint::next, notify_session_monitor(), plugin, and MacEndpoint::sessions_head.
|
static |
Function that will be called whenever the transport service wants to notify the plugin that a session is still active and in use and therefore the session timeout for this session has to be updated.
cls | closure |
peer | which peer was the session for |
session | which session is being updated |
Definition at line 2215 of file plugin_transport_wlan.c.
References GNUNET_assert, GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, GNUNET_TIME_relative_to_absolute(), GNUNET_ATS_Session::timeout, and GNUNET_ATS_Session::timeout_task.
|
static |
Function that will be called whenever the transport service wants to notify the plugin that the inbound quota changed and that the plugin should update it's delay for the next receive value.
cls | closure |
peer | which peer was the session for |
session | which session is being updated |
delay | new delay to use for receiving |
Definition at line 2236 of file plugin_transport_wlan.c.
void* LIBGNUNET_PLUGIN_TRANSPORT_INIT | ( | void * | cls | ) |
Entry point for the plugin.
cls | closure, the struct GNUNET_TRANSPORT_PluginEnvironment * |
struct GNUNET_TRANSPORT_PluginFunctions *
or NULL on error Definition at line 2252 of file plugin_transport_wlan.c.
|
static |
Which network scope do we belong to?
Definition at line 117 of file plugin_transport_wlan.c.
Referenced by create_session(), GAS_plugin_notify_feedback(), GNUNET_ATS_performance_give_feedback(), plugin_env_session_start(), process_data(), server_lookup_connection(), and setup_job_headers().