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 <boost/asio.hpp>
41 #include <array>
42 
43 namespace protobuf_comm {
44 #if 0 /* just to make Emacs auto-indent happy */
45 }
46 #endif
47 
48 /** Outgoing queue entry. */
49 struct QueueEntry {
50 public:
51  /** Constructor. */
53  {
54  frame_header.header_version = PB_FRAME_V2;
55  frame_header.cipher = PB_ENCRYPTION_NONE;
56  };
57  std::string serialized_message; ///< serialized protobuf message
58  frame_header_t frame_header; ///< Frame header (network byte order), never encrypted
59  frame_header_v1_t frame_header_v1; ///< Frame header (network byte order), never encrypted
60  message_header_t message_header; ///< Frame header (network byte order)
61  std::array<boost::asio::const_buffer, 3> buffers; ///< outgoing buffers
62  std::string encrypted_message; ///< encrypted buffer if encryption is used
63 };
64 
65 
66 } // end namespace protobuf_comm
67 
68 #endif
Old network message framing header.
Definition: frame_header.h:117
Outgoing queue entry.
Definition: queue_entry.h:49
uint8_t cipher
One of PB_ENCRYPTION_*.
Definition: frame_header.h:78
Network framing header.
Definition: frame_header.h:74
std::array< boost::asio::const_buffer, 3 > buffers
outgoing buffers
Definition: queue_entry.h:61
frame_header_t frame_header
Frame header (network byte order), never encrypted.
Definition: queue_entry.h:58
QueueEntry()
Constructor.
Definition: queue_entry.h:52
uint8_t header_version
Frame header version.
Definition: frame_header.h:76
Network message header.
Definition: frame_header.h:99
frame_header_v1_t frame_header_v1
Frame header (network byte order), never encrypted.
Definition: queue_entry.h:59
message_header_t message_header
Frame header (network byte order)
Definition: queue_entry.h:60
std::string encrypted_message
encrypted buffer if encryption is used
Definition: queue_entry.h:62
std::string serialized_message
serialized protobuf message
Definition: queue_entry.h:56