client-c  0.7.0
kaatcp_common.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2015 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 KAATCP_COMMON_H_
18 #define KAATCP_COMMON_H_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include "../../platform/defaults.h"
25 
26 #define KAATCP_PROTOCOL_NAME_MAX_SIZE 10
27 
28 #define FIRST_BIT 0x80
29 #define MAX_MESSAGE_TYPE_LENGTH 0x0F
30 #define MAX_MESSAGE_LENGTH 0x0FFFFFFF
31 #define PROTOCOL_VERSION 0x01
32 
33 #define KAA_SYNC_HEADER_LENGTH 12
34 #define KAA_SYNC_ZIPPED_BIT 0x02
35 #define KAA_SYNC_ENCRYPTED_BIT 0x04
36 #define KAA_SYNC_REQUEST_BIT 0x01
37 #define KAA_SYNC_SYNC_BIT 0x10
38 #define KAA_SYNC_BOOTSTRAP_BIT 0x20
39 
40 #define KAA_BOOTSTRAP_RSA_PKSC8 0x01
41 #define KAA_BOOTSTRAP_CHANNEL_HTTP 0x01
42 #define KAA_BOOTSTRAP_CHANNEL_HTTPLP 0x02
43 #define KAA_BOOTSTRAP_CHANNEL_KAATCP 0x03
44 
45 #define KAA_CONNECT_FLAGS 0x02
46 #define KAA_CONNECT_HEADER_LENGTH 18
47 
48 #define KAA_CONNECT_KEY_AES_RSA 0x11
49 #define KAA_CONNECT_SIGNATURE_SHA1 0x01
50 
51 #define KAA_TCP_NAME "Kaatcp"
52 #define KAA_TCP_NAME_LENGTH 6
53 
54 typedef enum {
62 
63 typedef enum {
72 
73 typedef struct {
75  char protocol_name[KAATCP_PROTOCOL_NAME_MAX_SIZE];
76 
78 
79  uint8_t connect_flags;
80 
81  uint32_t next_ptorocol_id;
82 
84  uint8_t signature_flags;
85 
86  uint16_t keep_alive;
87 
89  char *session_key;
90 
92  char *signature;
93 
95  char *sync_request;
96 
98 
99 typedef enum {
108 
109 typedef struct {
110  uint16_t return_code;
112 
113 typedef enum {
118 
119 typedef struct {
120  uint16_t reason;
122 
123 typedef struct {
125  char protocol_name[KAATCP_PROTOCOL_NAME_MAX_SIZE];
126 
128  uint16_t message_id;
129  uint8_t flags;
131 
132 typedef struct {
134 
138 
139 #ifdef __cplusplus
140 } /* extern "C" */
141 #endif
142 #endif /* KAATCP_COMMON_H_ */
uint8_t connect_flags
Definition: kaatcp_common.h:79
uint16_t return_code
uint8_t signature_flags
Definition: kaatcp_common.h:84
kaatcp_connack_code_t
Definition: kaatcp_common.h:99
uint8_t session_key_flags
Definition: kaatcp_common.h:83
size_t sync_request_size
kaatcp_error_t
Definition: kaatcp_common.h:54
uint16_t protocol_name_length
Definition: kaatcp_common.h:74
kaatcp_kaasync_header_t sync_header
kaatcp_message_type_t
Definition: kaatcp_common.h:63
kaatcp_disconnect_reason_t
size_t sync_request_size
Definition: kaatcp_common.h:94
#define KAATCP_PROTOCOL_NAME_MAX_SIZE
Definition: kaatcp_common.h:26
uint16_t keep_alive
Definition: kaatcp_common.h:86
size_t session_key_size
Definition: kaatcp_common.h:88
uint8_t protocol_version
Definition: kaatcp_common.h:77
uint32_t next_ptorocol_id
Definition: kaatcp_common.h:81