helper for the testcases for plugin_transport_wlan.c More...
#include "platform.h"
#include "gnunet_protocols.h"
#include "gnunet_util_lib.h"
#include "plugin_transport_wlan.h"
Go to the source code of this file.
Data Structures | |
struct | SendBuffer |
IO buffer used for buffering data in transit (to wireless or to stdout). More... | |
Macros | |
#define | FIFO_FILE1 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_in" |
Name of the fifo to use for IPC with the other dummy process. More... | |
#define | FIFO_FILE2 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_out" |
Name of the fifo to use for IPC with the other dummy process. More... | |
#define | MAXLINE 4096 |
Maximum size of a message allowed in either direction (used for our receive and sent buffers). More... | |
Functions | |
static void | sigfunc (int sig) |
We're being killed, clean up. More... | |
static int | send_mac_to_plugin (char *buffer, struct GNUNET_TRANSPORT_WLAN_MacAddress *mac) |
Create control message for plugin. More... | |
static int | stdin_send (void *cls, const struct GNUNET_MessageHeader *hdr) |
We got a message from the FIFO, check it, convert the message type to the output forward and copy it to the buffer for stdout. More... | |
static int | file_in_send (void *cls, const struct GNUNET_MessageHeader *hdr) |
We read a full message from stdin. More... | |
int | main (int argc, char *argv[]) |
Main function of a program that pretends to be a WLAN card. More... | |
Variables | |
static int | closeprog |
Flag set to 1 if we are to terminate, otherwise 0. More... | |
helper for the testcases for plugin_transport_wlan.c
Definition in file gnunet-helper-transport-wlan-dummy.c.
#define FIFO_FILE1 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_in" |
Name of the fifo to use for IPC with the other dummy process.
Definition at line 33 of file gnunet-helper-transport-wlan-dummy.c.
#define FIFO_FILE2 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_out" |
Name of the fifo to use for IPC with the other dummy process.
Definition at line 38 of file gnunet-helper-transport-wlan-dummy.c.
#define MAXLINE 4096 |
Maximum size of a message allowed in either direction (used for our receive and sent buffers).
Definition at line 44 of file gnunet-helper-transport-wlan-dummy.c.
|
static |
We're being killed, clean up.
sig | killing signal |
Definition at line 84 of file gnunet-helper-transport-wlan-dummy.c.
References closeprog, FIFO_FILE1, and FIFO_FILE2.
Referenced by main().
|
static |
Create control message for plugin.
buffer | pointer to buffer for the message |
mac | pointer to the mac address |
Definition at line 100 of file gnunet-helper-transport-wlan-dummy.c.
References GNUNET_memcpy, GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL, GNUNET_TRANSPORT_WLAN_HelperControlMessage::hdr, GNUNET_TRANSPORT_WLAN_HelperControlMessage::mac, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
Referenced by main().
|
static |
We got a message from the FIFO, check it, convert the message type to the output forward and copy it to the buffer for stdout.
cls | the 'struct SendBuffer' to copy the converted message to |
hdr | inbound message from the FIFO |
Definition at line 128 of file gnunet-helper-transport-wlan-dummy.c.
References SendBuffer::buf, GNUNET_TRANSPORT_WLAN_RadiotapSendMessage::frame, GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage::frame, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER, GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER, GNUNET_OK, GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage::header, MAXLINE, GNUNET_MessageHeader::size, SendBuffer::size, GNUNET_MessageHeader::type, and write_pout.
Referenced by main().
|
static |
We read a full message from stdin.
Copy it to our send buffer.
cls | the 'struct SendBuffer' to copy to |
hdr | the message we received to copy to the buffer |
Definition at line 177 of file gnunet-helper-transport-wlan-dummy.c.
References SendBuffer::buf, GNUNET_memcpy, GNUNET_OK, MAXLINE, GNUNET_MessageHeader::size, SendBuffer::size, and write_std.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main function of a program that pretends to be a WLAN card.
argc | should be 2 |
argv | either '1' or '2', depending on which of the two cards this dummy is to emulate |
Definition at line 202 of file gnunet-helper-transport-wlan-dummy.c.
References SendBuffer::buf, closeprog, end, FIFO_FILE1, FIFO_FILE2, file_in_send(), GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_QUALITY_STRONG, GNUNET_CRYPTO_random_u32(), GNUNET_DISK_directory_create_for_file(), GNUNET_MST_create(), GNUNET_MST_destroy(), GNUNET_MST_from_buffer(), GNUNET_NO, GNUNET_OK, GNUNET_TERM_SIG, GNUNET_TRANSPORT_WLAN_MacAddress::mac, MAXLINE, SendBuffer::pos, ret, send_mac_to_plugin(), sigfunc(), SendBuffer::size, st, stdin_mst, stdin_send(), write_pout, and write_std.
|
static |
Flag set to 1 if we are to terminate, otherwise 0.
Definition at line 75 of file gnunet-helper-transport-wlan-dummy.c.