Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 149 lines (128 sloc) 4.027 kb
bbd5d9c @msantos Add comment pointing to pkt
authored
1 %%% Code has moved to:
2 %%% https://github.com/msantos/pkt
3
8f4942c @oliv3 IPv6 support
oliv3 authored
4 %% From http://en.wikipedia.org/wiki/EtherType
f9441d2 @msantos Change the ethernet types to match naming in if_ether.h
authored
5 -define(ETH_P_IP, 16#0800).
dac3973 @msantos Add support for arp
authored
6 -define(ETH_P_ARP, 16#0806).
f9441d2 @msantos Change the ethernet types to match naming in if_ether.h
authored
7 -define(ETH_P_IPV6, 16#86DD).
883d110 @msantos Add macro for value used by procket
authored
8 -define(ETH_P_ALL, 16#0300).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
9
dac3973 @msantos Add support for arp
authored
10 -define(ARPHRD_ETHER, 1).
11 -define(ARPHRD_IEEE80211, 801).
12
13 -define(ARPOP_REQUEST, 1). % ARP request
14 -define(ARPOP_REPLY, 2). % ARP reply
15 -define(ARPOP_RREQUEST, 3). % RARP request
16 -define(ARPOP_RREPLY, 4). % RARP reply
17 -define(ARPOP_InREQUEST, 8). % InARP request
18 -define(ARPOP_InREPLY, 9). % InARP reply
19 -define(ARPOP_NAK, 10). % (ATM)ARP NAK
20
d0b5376 @msantos Manually deprecated files with pkt
authored
21 -define(DLT_NULL, 0). % BSD loopback
3d82ba6 @laf0rge Introduce ability to decapsulate/decode Linux cooked (-i any) pcaps
laf0rge authored
22 -define(DLT_EN10MB, 1). % Ethernet
23 -define(DLT_LINUX_SLL, 113). % Linux cooked sockets fake hdr
24
d0b5376 @msantos Manually deprecated files with pkt
authored
25 -define(PF_INET, 2).
26 -define(PF_INET6, 10).
27
4324dcf @msantos die trailing whitespace die!
authored
28 -define(IPPROTO_IP, 0).
29 -define(IPPROTO_ICMP, 1).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
30 -define(IPPROTO_TCP, 6).
31 -define(IPPROTO_UDP, 17).
6e10beb @laf0rge Add simplistic SCTP support (only DATA chunks are parsed in erlang recor...
laf0rge authored
32 -define(IPPROTO_SCTP, 132).
cf8bb53 @lefan Added support of GRE (RFC2784)
lefan authored
33 -define(IPPROTO_GRE, 47).
34
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
35
36 -define(ICMP_ECHOREPLY, 0).
37 -define(ICMP_DEST_UNREACH, 3).
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
38 -define( ICMP_UNREACH_NET, 0). % bad net
39 -define( ICMP_UNREACH_HOST, 1). % bad host
40 -define( ICMP_UNREACH_PROTOCOL, 2). % bad protocol
41 -define( ICMP_UNREACH_PORT, 3). % bad port
42 -define( ICMP_UNREACH_NEEDFRAG, 4). % IP_DF caused drop
43 -define( ICMP_UNREACH_SRCFAIL, 5 ). % src route failed
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
44 -define(ICMP_SOURCE_QUENCH, 4).
45 -define(ICMP_REDIRECT, 5).
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
46 -define( ICMP_REDIRECT_NET, 0). % for network
47 -define( ICMP_REDIRECT_HOST, 1). % for host
48 -define( ICMP_REDIRECT_TOSNET, 2). % for tos and net
49 -define( ICMP_REDIRECT_TOSHOST, 3). % for tos and host
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
50 -define(ICMP_ECHO, 8).
51 -define(ICMP_TIME_EXCEEDED, 11).
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
52 -define( ICMP_TIMXCEED_INTRANS, 0). % ttl==0 in transit
53 -define( ICMP_TIMXCEED_REASS, 1). % ttl==0 in reass
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
54 -define(ICMP_PARAMETERPROB, 12).
55 -define(ICMP_TIMESTAMP, 13).
56 -define(ICMP_TIMESTAMPREPLY, 14).
57 -define(ICMP_INFO_REQUEST, 15).
58 -define(ICMP_INFO_REPLY, 16).
59 -define(ICMP_ADDRESS, 17).
60 -define(ICMP_ADDRESSREPLY, 18).
61
3d82ba6 @laf0rge Introduce ability to decapsulate/decode Linux cooked (-i any) pcaps
laf0rge authored
62 -record(linux_cooked, {
63 packet_type,
64 hrd = ?ARPHRD_ETHER,
65 ll_len = 0,
66 ll_bytes = <<>>,
67 pro = ?ETH_P_IP
68 }).
69
d0b5376 @msantos Manually deprecated files with pkt
authored
70 -record(null, {
71 family = ?PF_INET
72 }).
73
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
74 -record(ether, {
a944075 @msantos Add defaults for records
authored
75 dhost = <<0,0,0,0,0,0>>,
76 shost = <<0,0,0,0,0,0>>,
77 type = ?ETH_P_IP,
78 crc = 0
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
79 }).
80
dac3973 @msantos Add support for arp
authored
81 -record(arp, {
82 hrd = ?ARPHRD_ETHER,
83 pro = ?ETH_P_IP,
84 hln = 6,
85 pln = 4,
86 op = ?ARPOP_REPLY,
87
88 sha = <<0,0,0,0,0,0>>,
89 sip = {127,0,0,1},
90
91 tha = <<0,0,0,0,0,0>>,
92 tip = {127,0,0,1}
93 }).
94
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
95 -record(ipv4, {
4324dcf @msantos die trailing whitespace die!
authored
96 v = 4, hl = 5, tos = 0, len = 20,
a944075 @msantos Add defaults for records
authored
97 id = 0, df = 0, mf = 0,
00e85c7 @msantos Adjust default values for records
authored
98 off = 0, ttl = 64, p = ?IPPROTO_TCP, sum = 0,
0ef9351 @msantos IPv4 options
authored
99 saddr = {127,0,0,1}, daddr = {127,0,0,1},
100 opt = <<>>
4324dcf @msantos die trailing whitespace die!
authored
101 }).
cf8bb53 @lefan Added support of GRE (RFC2784)
lefan authored
102 %% RFC 2784 - Generic Routing Encapsulation (GRE)
103 -record(gre, {
104 c = 0, res0 = 0, ver = 0,
105 type = ?ETH_P_IP,
106 chksum = <<>>, res1 = <<>>
107 }).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
108
3a1efac @msantos Recursively decapsulate the packet.
authored
109 -record(ipv6, {
4324dcf @msantos die trailing whitespace die!
authored
110 v = 6, class = 0, flow = 0,
d0b5376 @msantos Manually deprecated files with pkt
authored
111 len = 40, next = ?IPPROTO_TCP, hop = 0,
3a1efac @msantos Recursively decapsulate the packet.
authored
112 saddr, daddr
4324dcf @msantos die trailing whitespace die!
authored
113 }).
3a1efac @msantos Recursively decapsulate the packet.
authored
114
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
115 -record(tcp, {
116 sport = 0, dport = 0,
117 seqno = 0,
118 ackno = 0,
64255ec @msantos Set the default TCP offset to 5
authored
119 off = 5, cwr = 0, ece = 0, urg = 0, ack = 0,
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
120 psh = 0, rst = 0, syn = 0, fin = 0, win = 0,
a944075 @msantos Add defaults for records
authored
121 sum = 0, urp = 0,
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
122 opt = <<>>
4324dcf @msantos die trailing whitespace die!
authored
123 }).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
124
125 -record(udp, {
00e85c7 @msantos Adjust default values for records
authored
126 sport = 0, dport = 0, ulen = 8, sum = 0
4324dcf @msantos die trailing whitespace die!
authored
127 }).
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
128
129 -record(icmp, {
1d97e93 @msantos Specification for ECHO REPLY and defaults for icmp record
authored
130 type = ?ICMP_ECHO, code = 0, checksum = 0,
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
131 id = 0, sequence = 0,
132 gateway = {127,0,0,1},
b51a4a2 @msantos Include ICMP unused when constructing packet
authored
133 un = <<0:32>>,
7bd31ac @msantos Add record to binary conversion and ICMP types
authored
134 mtu = 0,
135 pointer = 0,
136 ts_orig = 0, ts_recv = 0, ts_tx = 0
0406018 @msantos Add licensing and do cleanup. In other words, do stuff.
authored
137 }).
138
6e10beb @laf0rge Add simplistic SCTP support (only DATA chunks are parsed in erlang recor...
laf0rge authored
139 -record(sctp, {
140 sport = 0, dport = 0, vtag = 0, sum = 0,
141 chunks = []
142 }).
143 -record(sctp_chunk, {
144 type = 0, flags = 0, len = 0, payload = 0
145 }).
146 -record(sctp_chunk_data, {
147 tsn = 0, sid = 0, ssn = 0, ppi = 0, data
148 }).
Something went wrong with that request. Please try again.