client-c  0.6.3
kaa_common.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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 
22 #ifndef KAA_COMMON_H_
23 #define KAA_COMMON_H_
24 
25 #include "kaa_error.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
32 /*
33  * Standard error handling macros
34  */
35 #define KAA_RETURN_IF_ERR(E) \
36  { if (E) return E; }
37 
38 #define KAA_RETURN_IF_NIL(p, E) \
39  { if (!(p)) return E; }
40 
41 #define KAA_RETURN_IF_NIL2(p1, p2, E) \
42  { if (!(p1) || !(p2)) return E; }
43 
44 #define KAA_RETURN_IF_NIL3(p1, p2, p3, E) \
45  { if (!(p1) || !(p2) || !(p3)) return E; }
46 
47 #define KAA_RETURN_IF_NIL4(p1, p2, p3, p4, E) \
48  { if (!(p1) || !(p2) || !(p3) || !(p4)) return E; }
49 
50 #define KAA_RETURN_IF_NIL5(p1, p2, p3, p4, p5,E) \
51  { if (!(p1) || !(p2) || !(p3) || !(p4) || !(p5)) return E; }
52 
53 
57 typedef enum {
64 
68 typedef struct {
69  uint32_t id;
70  uint16_t version;
72 
77 typedef struct {
78  uint32_t id;
82 
83 /*
84  * Endpoint ID
85  */
86 #define KAA_ENDPOINT_ID_LENGTH 20
88 typedef const uint8_t* kaa_endpoint_id_p;
89 
90 
91 
92 #ifdef __cplusplus
93 } /* extern "C" */
94 #endif
95 #endif /* KAA_COMMON_H_ */
uint8_t kaa_endpoint_id[KAA_ENDPOINT_ID_LENGTH]
Definition: kaa_common.h:87
#define KAA_ENDPOINT_ID_LENGTH
Definition: kaa_common.h:86
Identifier used to uniquely represent transport protocol.
Definition: kaa_common.h:68
kaa_service_t
Types of Kaa platform services.
Definition: kaa_common.h:57
Kaa error codes.
uint16_t connection_data_len
Definition: kaa_common.h:79
const uint8_t * kaa_endpoint_id_p
Definition: kaa_common.h:88
char * connection_data
Definition: kaa_common.h:80
Connection parameters used by transport channels to establish connection both to Bootstrap and Operat...
Definition: kaa_common.h:77