fixed windows endian include
[anytun.git] / src / plainPacket.h
bloba66f3fca20fce2a70bbd25a2f0af1d1df3246c09
1 /*
2 * anytun
4 * The secure anycast tunneling protocol (satp) defines a protocol used
5 * for communication between any combination of unicast and anycast
6 * tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
7 * mode and allows tunneling of every ETHER TYPE protocol (e.g.
8 * ethernet, ip, arp ...). satp directly includes cryptography and
9 * message authentication based on the methodes used by SRTP. It is
10 * intended to deliver a generic, scaleable and secure solution for
11 * tunneling and relaying of packets of any protocol.
14 * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
15 * Christian Pointner <satp@wirdorange.org>
17 * This file is part of Anytun.
19 * Anytun is free software: you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License version 3 as
21 * published by the Free Software Foundation.
23 * Anytun is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with anytun. If not, see <http://www.gnu.org/licenses/>.
32 #ifndef _PLAIN_PACKET_H_
33 #define _PLAIN_PACKET_H_
35 #include "datatypes.h"
36 #include "buffer.h"
38 #include "networkAddress.h"
40 class Cipher;
41 /**
42 * plain SATP packet class<br>
43 * includes payload_type and payload
46 #define PAYLOAD_TYPE_TAP 0x6558
47 #define PAYLOAD_TYPE_TUN 0x0000
48 #define PAYLOAD_TYPE_TUN4 0x0800
49 #define PAYLOAD_TYPE_TUN6 0x86DD
51 class PlainPacket : public Buffer
53 public:
54 /**
55 * Packet constructor
56 * @param the length of the payload
57 * @param allow reallocation of buffer
59 PlainPacket(u_int32_t payload_length, bool allow_realloc = false);
61 /**
62 * Packet destructor
64 ~PlainPacket() {};
66 /**
67 * Get the payload type
68 * @return the id of the payload type
70 payload_type_t getPayloadType() const;
72 /**
73 * Set the payload type
74 * @param payload_type payload type id
76 void setPayloadType(payload_type_t payload_type);
78 /**
79 * Get the length of the payload
80 * @return the length of the payload
82 u_int32_t getPayloadLength() const;
84 /**
85 * Set the length of the payload
86 * @param length length of the payload
88 void setPayloadLength(u_int32_t payload_length);
90 /**
91 * Get the the payload
92 * @return the Pointer to the payload
94 u_int8_t* getPayload();
96 // NetworkAddress getSrcAddr() const;
97 NetworkAddress getDstAddr() const;
99 private:
100 PlainPacket();
101 PlainPacket(const PlainPacket &src);
103 void reinit();
105 payload_type_t* payload_type_;
106 u_int8_t* payload_;
109 #endif