Fawkes API
Fawkes Development Version
frame_header.h
1
2
/***************************************************************************
3
* frame_header.h - Basic framing header or each message
4
*
5
* Created: Mon Jan 21 12:05:03 2013
6
* Copyright 2013 Tim Niemueller [www.niemueller.de]
7
****************************************************************************/
8
9
/* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* - Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* - Redistributions in binary form must reproduce the above copyright
16
* notice, this list of conditions and the following disclaimer in
17
* the documentation and/or other materials provided with the
18
* distribution.
19
* - Neither the name of the authors nor the names of its contributors
20
* may be used to endorse or promote products derived from this
21
* software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34
* OF THE POSSIBILITY OF SUCH DAMAGE.
35
*/
36
37
#ifndef __PROTOBUF_COMM_FRAME_HEADER_H_
38
#define __PROTOBUF_COMM_FRAME_HEADER_H_
39
40
#include <cstdint>
41
42
namespace
protobuf_comm
{
43
#if 0
/* just to make Emacs auto-indent happy */
44
}
45
#endif
46
47
#pragma pack(push,4)
48
49
#define PB_ENCRYPTION_NONE 0x00
50
#define PB_ENCRYPTION_AES_128_ECB 0x01
51
#define PB_ENCRYPTION_AES_128_CBC 0x02
52
#define PB_ENCRYPTION_AES_256_ECB 0x03
53
#define PB_ENCRYPTION_AES_256_CBC 0x04
54
55
/** Network frame header version to use.
56
* V1 is the old version which for example is required to communicate with the
57
* LLSF Referee Box before RC2014
58
* V2 supports data encryption.
59
*/
60
typedef
enum
{
61
PB_FRAME_V1 = 1,
///< Version 1
62
PB_FRAME_V2 = 2
///< Version 2
63
} frame_header_version_t;
64
65
/** Network framing header.
66
* Header that is prepended to all messages. The payload size does
67
* not include the size of the header. All numbers are given in
68
* network byte order (big endian). The encryption type can be set if
69
* encryption is used. If the mode requires an initialization vector
70
* (IV) it is appended directly after the frame header (and not
71
* counted in the payload size).
72
* @author Tim Niemueller
73
*/
74
typedef
struct
{
75
/// Frame header version
76
uint8_t
header_version
;
77
/// One of PB_ENCRYPTION_*
78
uint8_t
cipher
;
79
/// reserved for future use
80
uint8_t
reserved_2
;
81
/// reserved for future use
82
uint8_t
reserved_3
;
83
/// payload size in bytes
84
/// includes message and
85
/// header, _not_ IV
86
uint32_t
payload_size
;
87
}
frame_header_t
;
88
89
/** Network message header.
90
* Header that is prepended to all messages.
91
* The component ID can be used to route a message to a particular
92
* software component. The component then can use the message type to
93
* determine how the message must be parse the payload. It is appended
94
* immediately following the header. The payload size does not include
95
* the size of the header.
96
* All numbers are given in network byte order (big endian).
97
* @author Tim Niemueller
98
*/
99
typedef
struct
{
100
/// component id
101
uint16_t
component_id
;
102
/// message type
103
uint16_t
msg_type
;
104
}
message_header_t
;
105
106
107
/** Old network message framing header.
108
* Header that is prepended to all messages.
109
* The component ID can be used to route a message to a particular
110
* software component. The component then can use the message type to
111
* determine how the message must be parse the payload. It is appended
112
* immediately following the header. The payload size does not include
113
* the size of the header.
114
* All numbers are given in network byte order (big endian).
115
* @author Tim Niemueller
116
*/
117
typedef
struct
{
118
/** component id */
119
uint16_t
component_id
;
120
/** message type */
121
uint16_t
msg_type
;
122
/** payload size in bytes */
123
uint32_t
payload_size
;
124
}
frame_header_v1_t
;
125
126
#pragma pack(pop)
127
128
}
// end namespace protobuf_comm
129
130
#endif
protobuf_comm::frame_header_t::reserved_2
uint8_t reserved_2
reserved for future use
Definition:
frame_header.h:80
protobuf_comm::message_header_t::msg_type
uint16_t msg_type
message type
Definition:
frame_header.h:103
protobuf_comm::frame_header_v1_t
Old network message framing header.
Definition:
frame_header.h:117
protobuf_comm::frame_header_v1_t::payload_size
uint32_t payload_size
payload size in bytes
Definition:
frame_header.h:123
protobuf_comm::frame_header_t::cipher
uint8_t cipher
One of PB_ENCRYPTION_*.
Definition:
frame_header.h:78
protobuf_comm::frame_header_t::reserved_3
uint8_t reserved_3
reserved for future use
Definition:
frame_header.h:82
protobuf_comm
Definition:
communicator.h:47
protobuf_comm::frame_header_t
Network framing header.
Definition:
frame_header.h:74
protobuf_comm::frame_header_t::payload_size
uint32_t payload_size
payload size in bytes includes message and header, not IV
Definition:
frame_header.h:86
protobuf_comm::frame_header_v1_t::component_id
uint16_t component_id
component id
Definition:
frame_header.h:119
protobuf_comm::frame_header_t::header_version
uint8_t header_version
Frame header version.
Definition:
frame_header.h:76
protobuf_comm::frame_header_v1_t::msg_type
uint16_t msg_type
message type
Definition:
frame_header.h:121
protobuf_comm::message_header_t
Network message header.
Definition:
frame_header.h:99
protobuf_comm::message_header_t::component_id
uint16_t component_id
component id
Definition:
frame_header.h:101
src
libs
protobuf_comm
frame_header.h
Generated by
1.8.13