Fawkes API  Fawkes Development Version
queue_entry.h
1 
2 /***************************************************************************
3  * queue_entry.h - Protobuf stream protocol - send queue entry
4  *
5  * Created: Fri Feb 01 22:07:14 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_QUEUE_ENTRY_H_
38 #define _PROTOBUF_COMM_QUEUE_ENTRY_H_
39 
40 #include <array>
41 #include <boost/asio.hpp>
42 
43 namespace protobuf_comm {
44 
45 /** Outgoing queue entry. */
46 struct QueueEntry
47 {
48 public:
49  /** Constructor. */
51  {
52  frame_header.header_version = PB_FRAME_V2;
53  frame_header.cipher = PB_ENCRYPTION_NONE;
54  };
55  std::string serialized_message; ///< serialized protobuf message
56  frame_header_t frame_header; ///< Frame header (network byte order), never encrypted
57  frame_header_v1_t frame_header_v1; ///< Frame header (network byte order), never encrypted
58  message_header_t message_header; ///< Frame header (network byte order)
59  std::array<boost::asio::const_buffer, 3> buffers; ///< outgoing buffers
60  std::string encrypted_message; ///< encrypted buffer if encryption is used
61 };
62 
63 } // end namespace protobuf_comm
64 
65 #endif
protobuf_comm::QueueEntry::frame_header_v1
frame_header_v1_t frame_header_v1
Frame header (network byte order), never encrypted.
Definition: queue_entry.h:57
protobuf_comm::QueueEntry::message_header
message_header_t message_header
Frame header (network byte order)
Definition: queue_entry.h:58
protobuf_comm::QueueEntry
Outgoing queue entry.
Definition: queue_entry.h:47
protobuf_comm::QueueEntry::buffers
std::array< boost::asio::const_buffer, 3 > buffers
outgoing buffers
Definition: queue_entry.h:59
protobuf_comm::message_header_t
Network message header.
Definition: frame_header.h:98
protobuf_comm::frame_header_t
Network framing header.
Definition: frame_header.h:72
protobuf_comm::QueueEntry::QueueEntry
QueueEntry()
Constructor.
Definition: queue_entry.h:50
protobuf_comm::frame_header_v1_t
Old network message framing header.
Definition: frame_header.h:116
protobuf_comm::QueueEntry::frame_header
frame_header_t frame_header
Frame header (network byte order), never encrypted.
Definition: queue_entry.h:56
protobuf_comm::frame_header_t::cipher
uint8_t cipher
One of PB_ENCRYPTION_*.
Definition: frame_header.h:76
protobuf_comm::QueueEntry::encrypted_message
std::string encrypted_message
encrypted buffer if encryption is used
Definition: queue_entry.h:60
protobuf_comm::QueueEntry::serialized_message
std::string serialized_message
serialized protobuf message
Definition: queue_entry.h:54
protobuf_comm::frame_header_t::header_version
uint8_t header_version
Frame header version.
Definition: frame_header.h:74