libtins  4.0
constants.h
1 /*
2  * Copyright (c) 2017, Matias Fontanini
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following disclaimer
13  * in the documentation and/or other materials provided with the
14  * distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef TINS_CONSTANTS_H
31 #define TINS_CONSTANTS_H
32 
33 namespace Tins {
34 
38 namespace Constants {
40 struct IP {
42  enum e {
43  PROTO_IP = 0, // Dummy protocol for TCP.
44  PROTO_HOPOPTS = 0, // IPv6 Hop-by-Hop options.
45  PROTO_ICMP = 1, // Internet Control Message Protocol.
46  PROTO_IGMP = 2, // Internet Group Management Protocol.
47  PROTO_IPIP = 4, // IPIP tunnels (older KA9Q tunnels use 94).
48  PROTO_TCP = 6, // Transmission Control Protocol.
49  PROTO_EGP = 8, // Exterior Gateway Protocol.
50  PROTO_PUP = 12, // PUP protocol.
51  PROTO_UDP = 17, // User Datagram Protocol.
52  PROTO_IDP = 22, // XNS IDP protocol.
53  PROTO_TP = 29, // SO Transport Protocol Class 4.
54  PROTO_DCCP = 33, // Datagram Congestion Control Protocol.
55  PROTO_IPV6 = 41, // IPv6 header.
56  PROTO_ROUTING = 43, // IPv6 routing header.
57  PROTO_FRAGMENT = 44, // IPv6 fragmentation header.
58  PROTO_RSVP = 46, // Reservation Protocol.
59  PROTO_GRE = 47, // General Routing Encapsulation.
60  PROTO_ESP = 50, // encapsulating security payload.
61  PROTO_AH = 51, // authentication header.
62  PROTO_ICMPV6 = 58, // ICMPv6.
63  PROTO_NONE = 59, // IPv6 no next header.
64  PROTO_DSTOPTS = 60, // IPv6 destination options.
65  PROTO_MTP = 92, // Multicast Transport Protocol.
66  PROTO_ENCAP = 98, // Encapsulation Header.
67  PROTO_PIM = 103, // Protocol Independent Multicast.
68  PROTO_COMP = 108, // Compression Header Protocol.
69  PROTO_SCTP = 132, // Stream Control Transmission Protocol.
70  PROTO_UDPLITE = 136, // UDP-Lite protocol.
71  PROTO_RAW = 255 // Raw IP packets.
72  };
73 };
74 
75 struct Ethernet {
76  enum e {
77  UNKNOWN = 0,
78  SPRITE = 0x0500, // Sprite
79  IP = 0x0800, // IP
80  ARP = 0x0806, // Address resolution
81  MPLS = 0x8847, // MPLS
82  REVARP = 0x8035, // Reverse ARP
83  AT = 0x809B, // AppleTalk protocol
84  AARP = 0x80F3, // AppleTalk ARP
85  VLAN = 0x8100, // IEEE 802.1Q VLAN tagging
86  QINQ = 0x88a8, // IEEE 802.1ad VLAN tagging
87  OLD_QINQ = 0x9100, // IEEE 802.1ad VLAN tagging (old, deprecated, value)
88  IPX = 0x8137, // IPX
89  IPV6 = 0x86dd, // IP protocol version 6
90  PPPOED = 0x8863, // PPPoE Discovery
91  PPPOES = 0x8864, // PPPoE Session
92  EAPOL = 0x888e, // EAPOL
93  LOOPBACK = 0x9000 // used to test interfaces
94  };
95 };
96 
97 struct ARP {
98  enum e {
99  NETROM = 0, // From KA9Q: NET/ROM pseudo.
100  ETHER = 1, // Ethernet 10/100Mbps.
101  EETHER = 2, // Experimental Ethernet.
102  AX25 = 3, // AX.25 Level 2.
103  PRONET = 4, // PROnet token ring.
104  CHAOS = 5, // Chaosnet.
105  IEEE802 = 6, // IEEE 802.2 Ethernet/TR/TB.
106  ARCNET = 7, // ARCnet.
107  APPLETLK = 8, // APPLEtalk.
108  DLCI = 15, // Frame Relay DLCI.
109  ATM = 19, // ATM.
110  METRICOM = 23, // Metricom STRIP (new IANA id).
111  IEEE1394 = 24, // IEEE 1394 IPv4 - RFC 2734.
112  EUI64 = 27, // EUI-64.
113  INFINIBAND = 32, // InfiniBand.
114  SLIP = 256,
115  CSLIP = 257,
116  SLIP6 = 258,
117  CSLIP6 = 259,
118  RSRVD = 260, // Notional KISS type.
119  ADAPT = 264,
120  ROSE = 270,
121  X25 = 271, // CCITT X.25.
122  HWX25 = 272, // Boards with X.25 in firmware.
123  PPP = 512,
124  CISCO = 513, // Cisco HDLC.
125  HDLC = CISCO,
126  LAPB = 516, // LAPB.
127  DDCMP = 517, // Digital's DDCMP.
128  RAWHDLC = 518, // Raw HDLC.
129  TUNNEL = 768, // IPIP tunnel.
130  TUNNEL6 = 769, // IPIP6 tunnel.
131  FRAD = 770, // Frame Relay Access Device.
132  SKIP = 771, // SKIP vif.
133  LOOPBACK = 772, // Loopback device.
134  LOCALTLK = 773, // Localtalk device.
135  FDDI = 774, // Fiber Distributed Data Interface.
136  BIF = 775, // AP1000 BIF.
137  SIT = 776, // sit0 device - IPv6-in-IPv4.
138  IPDDP = 777, // IP-in-DDP tunnel.
139  IPGRE = 778, // GRE over IP.
140  PIMREG = 779, // PIMSM register interface.
141  HIPPI = 780, // High Performance Parallel I'face.
142  ASH = 781, // (Nexus Electronics) Ash.
143  ECONET = 782, // Acorn Econet.
144  IRDA = 783, // Linux-IrDA.
145  FCPP = 784, // Point to point fibrechanel.
146  FCAL = 785, // Fibrechanel arbitrated loop.
147  FCPL = 786, // Fibrechanel public loop.
148  FCFABRIC = 787, // Fibrechanel fabric.
149  IEEE802_TR = 800, // Magic type ident for TR.
150  IEEE80211 = 801, // IEEE 802.11.
151  IEEE80211_PRISM = 802, // IEEE 802.11 + Prism2 header.
152  IEEE80211_RADIOTAP = 803, // IEEE 802.11 + radiotap header.
153  IEEE802154 = 804, // IEEE 802.15.4 header.
154  IEEE802154_PHY = 805, // IEEE 802.15.4 PHY header.
155  VOID_TYPE = 0xFFFF, // Void type, nothing is known.
156  NONE = 0xFFFE // Zero header length.
157  };
158 };
159 
160 } // Constants
161 } // Tins
162 
163 #endif // TINS_CONSTANTS_H
Class that represents an IP PDU.
Definition: ip.h:63
Represents an MPLS PDU.
Definition: mpls.h:46
Represents an ARP PDU.
Definition: arp.h:50
The Tins namespace.
Definition: address_range.h:38
Definition: constants.h:75
Represents the EAP encapsulation over LAN.
Definition: eapol.h:56