Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 82 lines (70 sloc) 2.306 kB
8f4942c @oliv3 IPv6 support
oliv3 authored
1 %% From http://en.wikipedia.org/wiki/EtherType
f9441d2 @msantos Change the ethernet types to match naming in if_ether.h
authored
2 -define(ETH_P_IP, 16#0800).
3 -define(ETH_P_IPV6, 16#86DD).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
4
4324dcf @msantos die trailing whitespace die!
authored
5 -define(IPPROTO_IP, 0).
6 -define(IPPROTO_ICMP, 1).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
7 -define(IPPROTO_TCP, 6).
8 -define(IPPROTO_UDP, 17).
9
10 -define(ICMP_ECHOREPLY, 0).
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
11
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
12 -define(ICMP_DEST_UNREACH, 3).
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
13 -define( ICMP_UNREACH_NET, 0). % bad net
14 -define( ICMP_UNREACH_HOST, 1). % bad host
15 -define( ICMP_UNREACH_PROTOCOL, 2). % bad protocol
16 -define( ICMP_UNREACH_PORT, 3). % bad port
17 -define( ICMP_UNREACH_NEEDFRAG, 4). % IP_DF caused drop
18 -define( ICMP_UNREACH_SRCFAIL, 5 ). % src route failed
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
19 -define(ICMP_SOURCE_QUENCH, 4).
20 -define(ICMP_REDIRECT, 5).
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
21 -define( ICMP_REDIRECT_NET, 0). % for network
22 -define( ICMP_REDIRECT_HOST, 1). % for host
23 -define( ICMP_REDIRECT_TOSNET, 2). % for tos and net
24 -define( ICMP_REDIRECT_TOSHOST, 3). % for tos and host
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
25 -define(ICMP_ECHO, 8).
26 -define(ICMP_TIME_EXCEEDED, 11).
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
27 -define( ICMP_TIMXCEED_INTRANS, 0). % ttl==0 in transit
28 -define( ICMP_TIMXCEED_REASS, 1). % ttl==0 in reass
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
29 -define(ICMP_PARAMETERPROB, 12).
30 -define(ICMP_TIMESTAMP, 13).
31 -define(ICMP_TIMESTAMPREPLY, 14).
32 -define(ICMP_INFO_REQUEST, 15).
33 -define(ICMP_INFO_REPLY, 16).
34 -define(ICMP_ADDRESS, 17).
35 -define(ICMP_ADDRESSREPLY, 18).
36
37 -record(ether, {
a944075 @msantos Add defaults for records
authored
38 dhost = <<0,0,0,0,0,0>>,
39 shost = <<0,0,0,0,0,0>>,
40 type = ?ETH_P_IP,
41 crc = 0
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
42 }).
43
44 -record(ipv4, {
4324dcf @msantos die trailing whitespace die!
authored
45 v = 4, hl = 5, tos = 0, len = 20,
a944075 @msantos Add defaults for records
authored
46 id = 0, df = 0, mf = 0,
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
47 off = 0, ttl = 0, p = ?IPPROTO_TCP, sum = 0,
48 saddr = {127,0,0,1}, daddr = {127,0,0,1}
4324dcf @msantos die trailing whitespace die!
authored
49 }).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
50
3a1efac @msantos Recursively decapsulate the packet.
authored
51 -record(ipv6, {
4324dcf @msantos die trailing whitespace die!
authored
52 v = 6, class = 0, flow = 0,
3a1efac @msantos Recursively decapsulate the packet.
authored
53 len = 40, next = 0, hop = 0,
54 saddr, daddr
4324dcf @msantos die trailing whitespace die!
authored
55 }).
3a1efac @msantos Recursively decapsulate the packet.
authored
56
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
57 -record(tcp, {
58 sport = 0, dport = 0,
59 seqno = 0,
60 ackno = 0,
61 off = 0, cwr = 0, ece = 0, urg = 0, ack = 0,
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
62 psh = 0, rst = 0, syn = 0, fin = 0, win = 0,
a944075 @msantos Add defaults for records
authored
63 sum = 0, urp = 0,
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
64 opt = <<>>
4324dcf @msantos die trailing whitespace die!
authored
65 }).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
66
67 -record(udp, {
68 sport = 0, dport = 0, ulen = 0, sum = 0
4324dcf @msantos die trailing whitespace die!
authored
69 }).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
70
71 -record(icmp, {
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
72 type, code, checksum = 0,
73 id = 0, sequence = 0,
74 gateway = {127,0,0,1},
75 un = <<>>,
76 mtu = 0,
77 pointer = 0,
78 ts_orig = 0, ts_recv = 0, ts_tx = 0
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
79 }).
80
81
Something went wrong with that request. Please try again.