forked from HMCL-dev/HMCL-PE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tun2tap.h
53 lines (44 loc) · 994 Bytes
/
tun2tap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Created by switchwang(https://github.com/switch-st) on 2018-04-14.
//
#ifndef _TUN2TAP_H_
#define _TUN2TAP_H_
#ifdef HTONS
#undef HTONS
#endif
#include "uip-conf.h"
#include <uip/uip.h>
#include <uip/uip_arp.h>
#define UIP_ARP_LEN 28
struct arp_hdr {
struct uip_eth_hdr ethhdr;
u16_t hwtype;
u16_t protocol;
u8_t hwlen;
u8_t protolen;
u16_t opcode;
struct uip_eth_addr shwaddr;
u16_t sipaddr[2];
struct uip_eth_addr dhwaddr;
u16_t dipaddr[2];
};
struct ethip_hdr {
struct uip_eth_hdr ethhdr;
/* IP header. */
u8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
u16_t ipchksum;
u16_t srcipaddr[2],
destipaddr[2];
};
#define BUF ((struct arp_hdr *)&uip_buf[0])
#define IPBUF ((struct ethip_hdr *)&uip_buf[0])
extern u8_t* uip_buf;
extern u8_t uip_arp_buf[UIP_LLH_LEN + UIP_ARP_LEN];
extern u16_t uip_arp_len;
#endif //_TUN2TAP_H_