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"
|
|
|
|
|
|
|
|
|
|
#define FAIL_MIN_NUM 0 /*失败次数的最小值*/
|
|
|
|
|
#define LOCK_MIN_TIME 0 /*锁定的最小时间 */
|
|
|
|
|
#define HORIZON_MIN_VALUE 0 /*认证时间范围的最小值 */
|
|
|
|
|
|
2019-08-15 06:24:41 +00:00
|
|
|
|
#define AUTHPARA_CONFIG_MOD 0
|
|
|
|
|
|
2019-08-09 11:42:19 +00:00
|
|
|
|
|
|
|
|
|
/*配置消息 */
|
|
|
|
|
typedef struct {
|
|
|
|
|
int port; /*认证服务器端口号*/
|
|
|
|
|
int timehorizon; /*用户认证时间范围*/
|
|
|
|
|
int failcount; /*用户认证时间范围*/
|
|
|
|
|
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-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,
|
|
|
|
|
pointer input, int *input_len,
|
2019-08-09 11:42:19 +00:00
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
2019-08-15 06:24:41 +00:00
|
|
|
|
ret_code authpara_config_proc(uint source, uint config_type,
|
2019-08-09 11:42:19 +00:00
|
|
|
|
pointer input, int input_len,
|
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|