12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #ifndef __YY_AUTHENTICATION_MANAGE_FILE_H__
- #define __YY_AUTHENTICATION_MANAGE_FILE_H__
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- #ifdef _WIN32
- #ifdef YY_DLL_IMPLEMENT
- #define YY_AUTHERNTICATION_EXTERN __declspec(dllexport)
- #else
- #define YY_AUTHERNTICATION_EXTERN __declspec(dllimport)
- #endif
- #else
- #define YY_AUTHERNTICATION_EXTERN /* nothing */
- #endif
- #define LOCAL_CONFIG_BUF 128
- typedef struct tm_local_config
- {
- char code[LOCAL_CONFIG_BUF];
- char duration[LOCAL_CONFIG_BUF];
- char max_bandwidth[LOCAL_CONFIG_BUF];
- char expire_date[LOCAL_CONFIG_BUF];
- char activate_date[LOCAL_CONFIG_BUF];
- char server_date[LOCAL_CONFIG_BUF];
- char low_bound_bandwidth[LOCAL_CONFIG_BUF];
- char server_key[LOCAL_CONFIG_BUF];
- char status[LOCAL_CONFIG_BUF];
- int productId;
- int category;
- int bandwidth;
- int active_state; /* 0:no_active;1:active;2:expire */
- int client_number;
- }stLocalConfig;
- typedef struct offline_cfg_s{
- char sn[32];
- int productId;
- int duration;
- time_t activateDate;
- time_t endDate;
- int clientNum; /*typhoon client number*/
- int bandwidth;
- int category;
- int traffic; /*GB*/
- int originTraffic; /*GB*/
- int appClientNum; /*application client number*/
- char expire_date[LOCAL_CONFIG_BUF];
- char activate_date[LOCAL_CONFIG_BUF];
- }offline_cfg_t;
- /*
- tm_read_config read configuration from local config file
- @file_path : local configuration file absolute path
- @pOutConfig: configuration information
- return : 0 OK
- non-zeor failed
- */
- YY_AUTHERNTICATION_EXTERN int tm_read_file(char *pbuff, int buff_len, int *out_len);
- YY_AUTHERNTICATION_EXTERN int tm_parse_file(stLocalConfig *pOutConfig, char *pfile);
- YY_AUTHERNTICATION_EXTERN int tm_read_config(stLocalConfig *pOutConfig);
- YY_AUTHERNTICATION_EXTERN int tm_set_caPath(char *caPath);
- YY_AUTHERNTICATION_EXTERN int tm_delete_license_file();
- int tm_build_json(char *pOut, stLocalConfig *pConfig);
- int tm_write_json_to_file(char *pJson);
- /*
- tm_write_config write configuration into local config file
- @pOutConfig: configuration information
- @file_path : local configuration file absolute path
- return : 0 OK
- non-zeor failed
- */
- YY_AUTHERNTICATION_EXTERN int tm_write_config(stLocalConfig *pConfig);
- YY_AUTHERNTICATION_EXTERN int write_offline_config(offline_cfg_t *pConfig);
- #ifdef __cplusplus
- }
- #endif
- #endif
|