1 /*
2  * Copyright (C) 2015-2018 Alibaba Group Holding Limited
3  */
4 
5 #ifndef __AWSS_SMARTCONFIG_H__
6 #define __AWSS_SMARTCONFIG_H__
7 
8 #include <stdint.h>
9 #include "os.h"
10 #include "zconfig_lib.h"
11 #include "zconfig_ieee80211.h"
12 #include "zconfig_protocol.h"
13 
14 #if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
15 extern "C" {
16 #endif
17 
18 /* invalid channel, neither 0, 0xff, nor 1-13 */
19 #define INVALID_CHANNEL   (0)
20 #define PAYLOAD_BITS_CNT  (7)
21 #define PAYLOAD_BITS_MASK ((1 << PAYLOAD_BITS_CNT) - 1)
22 
23 extern const uint8_t zconfig_fixed_offset[ZC_ENC_TYPE_MAX + 1][2];
24 extern const uint16_t zconfig_hint_frame[];
25 
26 uint8_t is_data_frame(uint16_t len);
27 uint8_t is_start_frame(uint16_t len);
28 uint8_t is_group_frame(uint16_t len);
29 uint8_t get_data_index(uint16_t len);
30 uint8_t get_group_index(uint16_t len);
31 
32 int zconfig_recv_completed(uint8_t tods);
33 int zconfig_get_ssid_passwd(uint8_t tods);
34 int package_cmp(uint8_t *package, uint8_t *src, uint8_t *dst, uint8_t tods,
35                 uint16_t len);
36 int package_save(uint8_t *package, uint8_t *src, uint8_t *dst, uint8_t tods,
37                  uint16_t len);
38 int awss_recv_callback_smartconfig(struct parser_res *res);
39 int awss_ieee80211_smartconfig_process(uint8_t *ieee80211, int len,
40                                        int link_type, struct parser_res *res,
41                                        signed char rssi);
42 int awss_recv_callback_mcast_smartconfig(struct parser_res *res);
43 int awss_ieee80211_mcast_smartconfig_process(uint8_t *ieee80211, int len,
44                                              int link_type,
45                                              struct parser_res *res,
46                                              signed char rssi);
47 
48 #if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
49 }
50 #endif
51 #endif
52