The friendly Operating System for the Internet of Things
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 promiscous;
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_t netdev
netdev internal member
Definition: netdev_tap.h:42
tap interface initialization parameters
Definition: netdev_tap.h:52
int tap_fd
host file descriptor for the TAP
Definition: netdev_tap.h:44
Definitions low-level network driver interface.
char ** tap_name
Name of the host system's tap inteface to bind to.
Definition: netdev_tap.h:53
void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params)
Setup netdev_tap_t structure.
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
Definition: ethernet/hdr.h:33
char tap_name[IFNAMSIZ]
host dev file name
Definition: netdev_tap.h:43
Structure to hold driver state.
struct netdev_tap netdev_tap_t
tap interface state
Ethernet header definitions.
uint8_t promiscous
Flag for promiscous mode.
Definition: netdev_tap.h:46
tap interface state
Definition: netdev_tap.h:41
uint8_t addr[ETHERNET_ADDR_LEN]
The MAC address of the TAP.
Definition: netdev_tap.h:45