1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. 3 */ 4 #ifndef EXT_AUTHENTICATION_H 5 #define EXT_AUTHENTICATION_H 6 7 #ifdef EXT_AUTHENTICATION_SUPPORT 8 #include <stdbool.h> 9 #include <stdio.h> 10 11 #define TYPE_OFFSET 4 12 #define IFNAME_LENGTH 2 13 #define BUF_SIZE 2048 14 #define PARAM_LEN 30 15 #define BASE64_NUM 3 16 17 enum Ifname { 18 IFNAME_UNKNOWN = 0, 19 IFNAME_WIFI0 = 1, 20 IFNAME_ETH0 = 2, 21 IFNAME_SIZE = 3 22 }; 23 24 extern const char* g_ifnameToString[]; 25 26 bool reg_ext_auth(int code, int type, int ifname); 27 bool un_reg_ext_auth(int code, int type); 28 int get_ext_auth(int code, int type); 29 30 // 递增的数字标识符 31 int get_authentication_idx(); 32 void add_authentication_idx(); 33 34 uint8_t* get_eap_data(); 35 int get_eap_data_len(); 36 void clear_eap_data(); 37 void set_eap_data(uint8_t* eapData, int eapDataLen); 38 39 struct eap_sm; 40 void set_eap_sm(struct eap *eapSm); 41 struct eap_sm* get_eap_sm(); 42 43 struct eap_ssl_data; 44 struct encrypt_data{ 45 struct eap_ssl_data *ssl; 46 int eapType; 47 int version; 48 unsigned char id; 49 }; 50 51 void set_encrypt_data(struct eap_ssl_data *ssl, int eapType, int version, unsigned char id); 52 void set_encrypt_eap_type(int eapType); 53 struct encrypt_data* get_encrypt_data(); 54 55 int get_code(); 56 void set_code(int code); 57 #endif /* EXT_AUTHENTICATION_SUPPORT */ 58 #endif /* EXT_AUTHENTICATION_H */