62 lines
2.1 KiB
C
62 lines
2.1 KiB
C
|
#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 /*认证时间范围的最小值 */
|
|||
|
|
|||
|
#define AUTHPARA_CONFIG_ADD 0
|
|||
|
#define AUTHPARA_CONFIG_MOD 1
|
|||
|
#define AUTHPARA_CONFIG_GET 2
|
|||
|
|
|||
|
/*配置消息 */
|
|||
|
typedef struct {
|
|||
|
uint32_t ip; /*认证服务器IP地址*/
|
|||
|
int port; /*认证服务器端口号*/
|
|||
|
int timehorizon; /*用户认证时间范围*/
|
|||
|
int failcount; /*用户认证时间范围*/
|
|||
|
int locktime; /*锁定时间*/
|
|||
|
int aging_time; /*老化时间*/
|
|||
|
}auth_parameters_t;
|
|||
|
|
|||
|
/*全局变量初始化 失败为1 成功为0*/
|
|||
|
int authparInit();
|
|||
|
|
|||
|
/*下发用户老化时间配置到内核态 */
|
|||
|
int set_agingtimecfg_waitack(int *agingtime);
|
|||
|
|
|||
|
/*检查IP地址是否有效,端口号是否被占用 */
|
|||
|
int _valid_ipv4_port(const char *str, int port);
|
|||
|
|
|||
|
/* iuput格式:{"type": 0, "data": {"ip": 1028737217,"port": 1010,"timehorizon": 10,"failcount": 20,"locktime":30, "aging_time":10}}*/
|
|||
|
ret_code authpara_config_json_parse(pointer input, uint *conf_type, auth_parameters_t *authpara_buff);
|
|||
|
|
|||
|
/*修改认证参数 */
|
|||
|
ret_code authpara_config_mod_chk(uint source,uint config_type,
|
|||
|
pointer input, int input_len,
|
|||
|
pointer output, int *output_len);
|
|||
|
|
|||
|
ret_code authpara_config_add_proc(uint source, uint config_type,
|
|||
|
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_proc(uint source, uint config_type,
|
|||
|
pointer input, int input_len,
|
|||
|
pointer output, int *output_len);
|
|||
|
|
|||
|
#endif
|
|||
|
|