client-c  0.7.0
kaatcp_parser.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_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 
58 
59 
60 
62  , const kaatcp_parser_handlers_t *handlers);
63 
65 
67  , const char *buf
68  , size_t buf_size);
69 
71 
72 #ifdef __cplusplus
73 } /* extern "C" */
74 #endif
75 #endif /* KAATCP_PARSER_H_ */
#define KAATCP_PARSER_MAX_MESSAGE_LENGTH
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
kaatcp_parser_handlers_t handlers
Definition: kaatcp_parser.h:56
kaatcp_error_t
Definition: kaatcp_common.h:54
uint32_t length_multiplier
Definition: kaatcp_parser.h:53
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)
on_kaasync_message_fn kaasync_handler
Definition: kaatcp_parser.h:44
on_disconnect_message_fn disconnect_handler
Definition: kaatcp_parser.h:43
kaatcp_message_type_t
Definition: kaatcp_common.h:63
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
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
void kaatcp_parser_kaasync_destroy(kaatcp_kaasync_t *message)