netdev_tap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
8 
20 #ifndef NETDEV_TAP_H
21 #define NETDEV_TAP_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <stdint.h>
28 #include "net/netdev.h"
29 
30 #include "net/ethernet/hdr.h"
31 
32 #ifdef __MACH__
33 #include "net/if_var.h"
34 #else
35 #include "net/if.h"
36 #endif
37 
41 typedef struct netdev_tap {
43  char tap_name[IFNAMSIZ];
44  int tap_fd;
46  uint8_t promiscuous;
47 } netdev_tap_t;
48 
52 typedef struct {
53  char **tap_name;
56 
63 void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params);
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif /* NETDEV_TAP_H */
netdev_tap::addr
uint8_t addr[ETHERNET_ADDR_LEN]
The MAC address of the TAP.
Definition: netdev_tap.h:45
netdev_tap_t
struct netdev_tap netdev_tap_t
tap interface state
netdev_tap_params_t
tap interface initialization parameters
Definition: netdev_tap.h:52
netdev_tap
tap interface state
Definition: netdev_tap.h:41
netdev_tap::tap_fd
int tap_fd
host file descriptor for the TAP
Definition: netdev_tap.h:44
netdev_tap_params_t::tap_name
char ** tap_name
Name of the host system's tap interface to bind to.
Definition: netdev_tap.h:53
hdr.h
Ethernet header definitions.
netdev.h
Definitions low-level network driver interface.
ETHERNET_ADDR_LEN
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
Definition: hdr.h:33
netdev_tap::promiscuous
uint8_t promiscuous
Flag for promiscuous mode.
Definition: netdev_tap.h:46
netdev
Structure to hold driver state.
Definition: netdev.h:302
netdev_tap::tap_name
char tap_name[IFNAMSIZ]
host dev file name
Definition: netdev_tap.h:43
netdev_tap_setup
void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params)
Setup netdev_tap_t structure.
netdev_tap::netdev
netdev_t netdev
netdev internal member
Definition: netdev_tap.h:42