Kaa client C SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
kaatcp_parser.h
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 KAATCP_PARSER_H_
18 #define KAATCP_PARSER_H_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include "kaatcp_common.h"
25 
26 
27 typedef void (*on_connack_message_fn)(void *context, kaatcp_connack_t message);
28 typedef void (*on_disconnect_message_fn)(void *context, kaatcp_disconnect_t message);
29 typedef void (*on_kaasync_message_fn)(void *context, kaatcp_kaasync_t *message);
30 typedef void (*on_pingresp_message_fn)(void *context);
31 
32 
33 
34 typedef enum {
39 
40 typedef struct {
47 
48 typedef struct {
51  uint32_t message_length;
55  char *payload;
56 
59 
60 
61 
63  , const kaatcp_parser_handlers_t *handlers);
64 
66 
68  , const char *buf
69  , size_t buf_size);
70 
72 
73 #ifdef __cplusplus
74 } /* extern "C" */
75 #endif
76 #endif /* KAATCP_PARSER_H_ */
kaatcp_error_t kaatcp_parser_process_buffer(kaatcp_parser_t *parser, const char *buf, size_t buf_size)
kaatcp_message_type_t message_type
Definition: kaatcp_parser.h:50
Definition: kaatcp_parser.h:37
kaatcp_parser_handlers_t handlers
Definition: kaatcp_parser.h:57
Definition: kaatcp_common.h:113
Definition: kaatcp_common.h:124
kaatcp_error_t
Definition: kaatcp_common.h:57
uint32_t length_multiplier
Definition: kaatcp_parser.h:53
void * handlers_context
Definition: kaatcp_parser.h:41
void(* on_pingresp_message_fn)(void *context)
Definition: kaatcp_parser.h:30
on_pingresp_message_fn pingresp_handler
Definition: kaatcp_parser.h:45
uint32_t processed_payload_length
Definition: kaatcp_parser.h:52
kaatcp_error_t kaatcp_parser_reset(kaatcp_parser_t *parser)
char * payload
Definition: kaatcp_parser.h:55
on_kaasync_message_fn kaasync_handler
Definition: kaatcp_parser.h:44
Definition: kaatcp_common.h:137
on_disconnect_message_fn disconnect_handler
Definition: kaatcp_parser.h:43
Definition: kaatcp_parser.h:40
uint32_t payload_buffer_size
Definition: kaatcp_parser.h:54
kaatcp_message_type_t
Definition: kaatcp_common.h:66
void(* on_kaasync_message_fn)(void *context, kaatcp_kaasync_t *message)
Definition: kaatcp_parser.h:29
kaatcp_parser_state_t
Definition: kaatcp_parser.h:34
Definition: kaatcp_parser.h:35
uint32_t message_length
Definition: kaatcp_parser.h:51
void(* on_connack_message_fn)(void *context, kaatcp_connack_t message)
Definition: kaatcp_parser.h:27
kaatcp_error_t kaatcp_parser_init(kaatcp_parser_t *parser, const kaatcp_parser_handlers_t *handlers)
kaatcp_parser_state_t state
Definition: kaatcp_parser.h:49
void(* on_disconnect_message_fn)(void *context, kaatcp_disconnect_t message)
Definition: kaatcp_parser.h:28
on_connack_message_fn connack_handler
Definition: kaatcp_parser.h:42
Definition: kaatcp_parser.h:36
Definition: kaatcp_parser.h:48
void kaatcp_parser_kaasync_destroy(kaatcp_kaasync_t *message)