client-cpp  0.10.0
KaaTcpCommon.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef KAATCPCOMMON_HPP_
18 #define KAATCPCOMMON_HPP_
19 
20 #include <cstdint>
21 
22 namespace kaa {
23 
24 enum class KaaTcpMessageType: std::uint8_t
25 {
26  MESSAGE_UNKNOWN = 0x00,
27  MESSAGE_CONNECT = 0x01,
28  MESSAGE_CONNACK = 0x02,
29  MESSAGE_PINGREQ = 0x0C,
30  MESSAGE_PINGRESP = 0x0D,
31  MESSAGE_DISCONNECT = 0x0E,
32  MESSAGE_KAASYNC = 0x0F
33 };
34 
36 {
37 public:
38  static const std::uint8_t FIRST_BIT = 0x80;
39  static const std::uint8_t MAX_MESSAGE_TYPE_LENGTH = 0x0F;
40  static const std::uint32_t MAX_MESSAGE_LENGTH = 0x0FFFFFFF;
41  static const std::uint8_t PROTOCOL_VERSION = 0x01;
42 
43  static const std::uint8_t KAA_SYNC_HEADER_LENGTH = 12;
44  static const std::uint8_t KAA_SYNC_ZIPPED_BIT = 0x02;
45  static const std::uint8_t KAA_SYNC_ENCRYPTED_BIT = 0x04;
46  static const std::uint8_t KAA_SYNC_REQUEST_BIT = 0x01;
47 
48  static const std::uint8_t KAA_CONNECT_HEADER_LENGTH = 18;
49  static const std::uint8_t KAA_CONNECT_SESSION_KEY_FLAGS = 0x11;
50  static const std::uint8_t KAA_CONNECT_SIGNATURE_FLAGS = 0x01;
51 
52  static const char * const KAA_TCP_NAME;
53  static const std::uint16_t KAA_TCP_NAME_LENGTH = 6;
54 
55  static std::uint8_t createBasicHeader(std::uint8_t messageType, std::uint32_t length, char *message);
56 
57 };
58 
59 }
60 
61 
62 
63 #endif /* KAATCPCOMMON_HPP_ */
static const std::uint8_t KAA_SYNC_ZIPPED_BIT
static const std::uint8_t KAA_SYNC_REQUEST_BIT
static const std::uint8_t KAA_CONNECT_SESSION_KEY_FLAGS
static const std::uint32_t MAX_MESSAGE_LENGTH
static const std::uint8_t KAA_CONNECT_HEADER_LENGTH
static const std::uint8_t KAA_SYNC_HEADER_LENGTH
static const std::uint8_t KAA_CONNECT_SIGNATURE_FLAGS
static const std::uint8_t KAA_SYNC_ENCRYPTED_BIT
static const std::uint8_t FIRST_BIT
static const std::uint8_t MAX_MESSAGE_TYPE_LENGTH
static const std::uint8_t PROTOCOL_VERSION
static const std::uint16_t KAA_TCP_NAME_LENGTH
static const char *const KAA_TCP_NAME
static std::uint8_t createBasicHeader(std::uint8_t messageType, std::uint32_t length, char *message)
KaaTcpMessageType