EMANE  1.2.1
EMANE::Transports::Virtual::TunTap Class Reference

#include <tuntap.h>

Public Member Functions

 TunTap (PlatformServiceProvider *pPlatformService)
 
 ~TunTap ()
 destructor More...
 
int open (const char *, const char *)
 
int close ()
 
int activate (bool)
 
int deactivate ()
 
int get_handle ()
 
int readv (struct iovec *, size_t)
 
int writev (const struct iovec *, size_t)
 
int set_addr (const INETAddr &, const INETAddr &)
 
int set_ethaddr (const Utils::EtherAddr &)
 
int set_ethaddr (NEMId)
 
INETAddrget_addr ()
 
INETAddrget_mask ()
 

Detailed Description

Definition at line 70 of file tuntap.h.

Constructor & Destructor Documentation

◆ TunTap()

TunTap::TunTap ( PlatformServiceProvider pPlatformService)

Definition at line 60 of file tuntap.cc.

◆ ~TunTap()

TunTap::~TunTap ( )

destructor

Definition at line 74 of file tuntap.cc.

Member Function Documentation

◆ activate()

int TunTap::activate ( bool  arpEnabled)

Activates tuntap

Parameters
arpEnabledenable or disable arp
Returns
0 on success, -1 on error.
Note
sets the device to the UP state.

Definition at line 186 of file tuntap.cc.

◆ close()

int TunTap::close ( )

Closes tuntap handle

Returns
0

Definition at line 170 of file tuntap.cc.

◆ deactivate()

int TunTap::deactivate ( )

Deactivates tuntap

Returns
0 on success, -1 on error.
Note
sets the device to the DOWN state.

Definition at line 201 of file tuntap.cc.

◆ get_addr()

EMANE::INETAddr & TunTap::get_addr ( )

Gets the tuntap ip address

Returns
tuntap ip address

Definition at line 473 of file tuntap.cc.

◆ get_handle()

int TunTap::get_handle ( )

Gets tuntap handle

Returns
tuntap handle.

Definition at line 179 of file tuntap.cc.

◆ get_mask()

EMANE::INETAddr & TunTap::get_mask ( )

Gets the tuntap netmask

Returns
tuntap netmask

Definition at line 480 of file tuntap.cc.

◆ open()

int TunTap::open ( const char *  sDevicePath,
const char *  sDeviceName 
)

Opens tuntap handle

Parameters
sDevicePathpath to device
sDeviceNamename of device
Returns
0 on success, -1 on error

Definition at line 80 of file tuntap.cc.

◆ readv()

int TunTap::readv ( struct iovec *  iov,
size_t  iov_len 
)

Reads from tuntap

Parameters
ioviovector
iov_lennumber of elements in the iovector
Returns
total number of bytes read

Definition at line 452 of file tuntap.cc.

◆ set_addr()

int TunTap::set_addr ( const INETAddr addr,
const INETAddr mask 
)

Sets tuntap interface address and netmask

ipv4 addr "192.168.1.1" mask "255.255.255.0" ipv6 addr "::192.168.1.1" mask "ffff:ffff:ffff:ffff::"

Parameters
addrtun address ipv4 or ipv6 address
masktun netmask used as an ipv4 or ipv6 netmask
Returns
0 on success, -1 on error.

Definition at line 208 of file tuntap.cc.

◆ set_ethaddr() [1/2]

int TunTap::set_ethaddr ( const Utils::EtherAddr ethAddr)

Sets tuntap eth address

Parameters
ethAddreth address
Returns
0 on success, -1 on error.

Definition at line 381 of file tuntap.cc.

◆ set_ethaddr() [2/2]

int TunTap::set_ethaddr ( NEMId  id)

Sets tuntap eth address

Parameters
idnem id
Returns
0 on success, -1 on error.

Definition at line 368 of file tuntap.cc.

◆ writev()

int TunTap::writev ( const struct iovec *  iov,
size_t  iov_len 
)

Writes to tuntap

Parameters
ioviovector
iov_lennumber of elements in the iovector
Returns
total number of bytes written

Definition at line 430 of file tuntap.cc.


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