Classes | Defines | Functions | Variables
marte_layer.cc File Reference
#include <cstdio>
#include <unistd.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/ether.h>
#include <sys/utsname.h>
#include <net/if.h>
#include <fcntl.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <time.h>
#include <cstring>
#include <signal.h>
#include <cstdlib>
#include <map>
#include "marte_layer.h"
Include dependency graph for marte_layer.cc:

Go to the source code of this file.

Classes

struct  __attribute__

Defines

#define DEBUG(x, args...)
#define ETH_MIN_PAYLOAD   46
#define LOGGER_PROTOCOL   0x1010
#define NIC_INTERFACE   "eth1"
#define OUTPUT_FILE   "output_file.log"

Functions

void marte_layer_close ()
int marte_layer_init (int nnodes)
int marte_sniff_packet (char *data, simData_Hdr &sd, unsigned long long &time_us, std::map< int, robo_pose_t > &poses)

Variables

char device [] = "eth1"
int err
struct sockaddr_ll host_addr
struct ifreq ifr
static bool marte_keep_running
ssize_t nbytes
static int pfd [2]
eth_frame_t receive_buffer
static int sock
size_t written_bytes

Define Documentation

#define DEBUG (   x,
  args... 
)

Definition at line 61 of file marte_layer.cc.

#define ETH_MIN_PAYLOAD   46

ETH_MIN_PAYLOAD is the minimum payload in an ethernet frame, if one sends less bytes the rest of the frame will be padded with zeros. To know when this situation happens we have added a flag in the first byte of each frame:

  • 0: if there is no padding (we sent data >= the 45)
  • 1-44: if there is padding (we sent data < 45)

Definition at line 74 of file marte_layer.cc.

#define LOGGER_PROTOCOL   0x1010

Definition at line 64 of file marte_layer.cc.

#define NIC_INTERFACE   "eth1"

Definition at line 66 of file marte_layer.cc.

#define OUTPUT_FILE   "output_file.log"

Definition at line 65 of file marte_layer.cc.


Function Documentation

Definition at line 86 of file marte_layer.cc.

int marte_layer_init ( int  nnodes)

Definition at line 104 of file marte_layer.cc.

int marte_sniff_packet ( char *  data,
simData_Hdr sd,
unsigned long long &  time_us,
std::map< int, robo_pose_t > &  poses 
)

Definition at line 140 of file marte_layer.cc.


Variable Documentation

char device[] = "eth1"

Definition at line 97 of file marte_layer.cc.

int err

Definition at line 96 of file marte_layer.cc.

struct sockaddr_ll host_addr

Definition at line 98 of file marte_layer.cc.

struct ifreq ifr

Definition at line 99 of file marte_layer.cc.

bool marte_keep_running [static]

Definition at line 83 of file marte_layer.cc.

ssize_t nbytes

Definition at line 100 of file marte_layer.cc.

int pfd[2] [static]

Definition at line 84 of file marte_layer.cc.

eth_frame_t receive_buffer

Definition at line 102 of file marte_layer.cc.

int sock [static]

Definition at line 82 of file marte_layer.cc.

size_t written_bytes

Definition at line 101 of file marte_layer.cc.



ros_rt_wmp_sniffer
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Mon Oct 6 2014 08:27:58