Main Page Class Hierarchy Compound List File List Compound Members Examples

# usipp::Layer2 Class Reference

`#include <Layer2.h>`

Inheritance diagram for usipp::Layer2:

List of all members.

## Public Methods
| Layer2 (RX *r = NULL, TX *t = NULL)
virtual | ~Layer2 ()
virtual int | sniffpack (void *, size_t)
virtual int | sendpack (void *buf, size_t len, struct sockaddr *)
virtual int | init_device (char *dev, int promisc, size_t snaplen)
int | setfilter (char *f)
int | timeout (struct timeval)
bool | timeout ()
TX* | register_tx (TX *t)
RX* | register_rx (RX *r)
TX* | tx ()
RX* | rx ()

## Detailed Description

Describing layer 2

## Constructor & Destructor Documentation

usipp::Layer2::Layer2 ( | RX * r = NULL,
| TX * t = NULL )

| Give us a Layer 2! Default to Raw IP sockets and pcap packet capturing. This MUST NOT be. You could also say you want to use ethertap devices etc.

## Member Function Documentation

int usipp::Layer2::init_device ( | char * dev,
| int promisc,
| size_t snaplen )`[virtual]`

| Initialize a device for packet capturing Reimplemented in usipp::ICMP, usipp::IP, usipp::TCP, and usipp::UDP.

RX * usipp::Layer2::register_rx ( | RX * r )`[inline]`

| register a new capturer, return the old

TX * usipp::Layer2::register_tx ( | TX * t )`[inline]`

| register a new transmitter, return the old

RX * usipp::Layer2::rx ( | )`[inline]`

| return current RX object

int usipp::Layer2::sendpack ( | void * buf,
| size_t len,
| struct sockaddr * )`[virtual]`

| Send a packet

int usipp::Layer2::setfilter ( | char * f )

| Set a filter rule

int usipp::Layer2::sniffpack ( | void * buf,
| size_t buflen )`[virtual]`

| Actually, capture a packet Reimplemented in usipp::ICMP, usipp::IP, usipp::TCP, and usipp::UDP.

bool usipp::Layer2::timeout ( | )

| return was timeout?

int usipp::Layer2::timeout ( | struct timeval )

| Set a timeout

TX * usipp::Layer2::tx ( | )`[inline]`

| return current TX object

The documentation for this class was generated from the following file:

- Layer2.h