2019-08-09 11:42:19 +00:00
|
|
|
|
#ifndef AUTH_PARAMETERS_H_
|
|
|
|
|
#define AUTH_PARAMETERS_H_
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
#include <net/if.h>
|
|
|
|
|
#include "rpc_common.h"
|
|
|
|
|
|
2019-09-09 12:01:48 +00:00
|
|
|
|
#define FAIL_MIN_NUM 1 /*失败次数的最小值*/
|
|
|
|
|
#define FAIL_MAX_NUM 10000 /*失败次数的最大值*/
|
|
|
|
|
#define LOCK_MIN_TIME 1 /*锁定的最小时间 */
|
|
|
|
|
#define LOCK_MAX_TIME 10000 /*锁定的最大时间 */
|
|
|
|
|
#define HORIZON_MIN_VALUE 1 /*认证时间范围的最小值 */
|
|
|
|
|
#define HORIZON_MAX_VALUE 10000 /*认证时间范围的最大值 */
|
|
|
|
|
#define AGINGTIME_MIN_NUM 1 /*老化时间的最小值*/
|
|
|
|
|
#define AGINGTIME_MAX_NUM 10000 /*老化时间的最大值*/
|
|
|
|
|
#define PARA_DPORT_MIN_NUM 1024
|
|
|
|
|
#define PARA_DPORT_MAX_NUM 65535
|
2019-08-09 11:42:19 +00:00
|
|
|
|
|
2019-08-15 06:24:41 +00:00
|
|
|
|
#define AUTHPARA_CONFIG_MOD 0
|
2019-09-05 11:12:53 +00:00
|
|
|
|
#define AUTHPARA_CONFIG_GET 1
|
2019-08-15 06:24:41 +00:00
|
|
|
|
|
2019-08-09 11:42:19 +00:00
|
|
|
|
|
|
|
|
|
/*配置消息 */
|
|
|
|
|
typedef struct {
|
|
|
|
|
int port; /*认证服务器端口号*/
|
|
|
|
|
int timehorizon; /*用户认证时间范围*/
|
2019-09-02 07:40:32 +00:00
|
|
|
|
int failcount; /*用户认证失败次数*/
|
2019-08-09 11:42:19 +00:00
|
|
|
|
int locktime; /*锁定时间*/
|
|
|
|
|
int aging_time; /*老化时间*/
|
|
|
|
|
}auth_parameters_t;
|
|
|
|
|
|
2019-08-15 06:24:41 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
int resultcode;
|
|
|
|
|
char *message;
|
|
|
|
|
}configure_result_t;
|
|
|
|
|
|
2019-08-09 11:42:19 +00:00
|
|
|
|
/*全局变量初始化 失败为1 成功为0*/
|
|
|
|
|
int authparInit();
|
|
|
|
|
|
|
|
|
|
/*下发用户老化时间配置到内核态 */
|
|
|
|
|
int set_agingtimecfg_waitack(int *agingtime);
|
|
|
|
|
|
|
|
|
|
/*检查IP地址是否有效,端口号是否被占用 */
|
2019-08-15 06:24:41 +00:00
|
|
|
|
int _valid_port(int port);
|
2019-08-09 11:42:19 +00:00
|
|
|
|
|
2019-09-05 11:12:53 +00:00
|
|
|
|
/*获取json串类型*/
|
|
|
|
|
ret_code authpara_config_json_type(pointer input, uint *conf_type);
|
|
|
|
|
|
2019-08-15 06:24:41 +00:00
|
|
|
|
/* iuput格式:{"type": 0, "data": {"port": 1010,"timehorizon": 10,"failcount": 20,"locktime":30, "aging_time":10}}*/
|
2019-08-09 11:42:19 +00:00
|
|
|
|
ret_code authpara_config_json_parse(pointer input, uint *conf_type, auth_parameters_t *authpara_buff);
|
|
|
|
|
|
2019-08-09 12:49:17 +00:00
|
|
|
|
/*检查增加的参数格式是否正确 */
|
2019-08-15 06:24:41 +00:00
|
|
|
|
ret_code authpara_config_chk(uint source, uint *config_type,
|
2019-09-05 11:12:53 +00:00
|
|
|
|
pointer input, int *input_len,
|
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
/*修改认证参数*/
|
|
|
|
|
ret_code authpara_config_mod_proc(uint source, uint config_type,
|
|
|
|
|
pointer input, int input_len,
|
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
/*查询认证参数*/
|
|
|
|
|
ret_code authpara_config_get_proc(uint source, uint config_type,
|
|
|
|
|
pointer input, int input_len,
|
|
|
|
|
pointer output, int *output_len);
|
2019-08-09 11:42:19 +00:00
|
|
|
|
|
2019-08-15 06:24:41 +00:00
|
|
|
|
ret_code authpara_config_proc(uint source, uint config_type,
|
2019-09-05 11:12:53 +00:00
|
|
|
|
pointer input, int input_len,
|
|
|
|
|
pointer output, int *output_len);
|
2019-08-09 11:42:19 +00:00
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|