Moep Library  2.0-nc
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups

Files

file  tap.h
 

Functions

moep_dev_t moep_dev_tap_open (u8 *addr, const struct in_addr *ip, int prefixlen, int mtu, struct moep_frame_ops *l2_ops)
 open a tap device More...
 
int moep_dev_tap_get_hwaddr (moep_dev_t dev, u8 *addr)
 get hardware address More...
 
moep_frame_t moep_frame_tap_create (struct moep_frame_ops *l2_ops)
 create a tap frame More...
 

Detailed Description

Function Documentation

moep_dev_t moep_dev_tap_open ( u8 *  addr,
const struct in_addr *  ip,
int  prefixlen,
int  mtu,
struct moep_frame_ops l2_ops 
)

open a tap device

The function moep_dev_tap_open() is used to open a tap device.

Parameters
addrthe hardware address of the device; This can be NULL to be automatically set.
ipthe IP address of the device; This can be NULL to set no IP address.
prefixlenthe length of the IP prefix.
mtuthe MTU of the device; This includes all headers.
l2_opsframe header operations for layer 2
Returns
This function returns a moep device.
Return values
NULLon error, errno is set appropriately.
Errors
These are some standard errors generated and returned by this function. Additional errors may be generated and returned from the underlying system calls.
EINVALInvalid argument
EMFILEToo many open files; Some filedescriptors are too big for select.
ENOMEMNot enough memory available
int moep_dev_tap_get_hwaddr ( moep_dev_t  dev,
u8 *  addr 
)

get hardware address

The function moep_dev_tap_get_hwaddr() is used to get the hardware address of a tap device.

Parameters
devthe tap device
addra buffer for the address
Return values
0on success
-1on error, errno is set appropriately.
Errors
These are some standard errors generated and returned by this function. Additional errors may be generated and returned from the underlying system calls.
EACCESThe moep device is not a tap device.
moep_frame_t moep_frame_tap_create ( struct moep_frame_ops l2_ops)

create a tap frame

The function moep_frame_tap_create() is used to create a tap frame with the given frame header operations for layer 2.

Parameters
l2_opsframe header operations for layer 2
Returns
This function returns a moep frame.
Return values
NULLon error, errno is set appropriately.
Errors
The error values are the same as for moep_frame_create().