57 lines
1.7 KiB
C
57 lines
1.7 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_MOD 0
|
||
|
||
|
||
/*配置消息 */
|
||
typedef struct {
|
||
int port; /*认证服务器端口号*/
|
||
int timehorizon; /*用户认证时间范围*/
|
||
int failcount; /*用户认证时间范围*/
|
||
int locktime; /*锁定时间*/
|
||
int aging_time; /*老化时间*/
|
||
}auth_parameters_t;
|
||
|
||
typedef struct {
|
||
int resultcode;
|
||
char *message;
|
||
}configure_result_t;
|
||
|
||
/*全局变量初始化 失败为1 成功为0*/
|
||
int authparInit();
|
||
|
||
/*下发用户老化时间配置到内核态 */
|
||
int set_agingtimecfg_waitack(int *agingtime);
|
||
|
||
/*检查IP地址是否有效,端口号是否被占用 */
|
||
int _valid_port(int port);
|
||
|
||
/* iuput格式:{"type": 0, "data": {"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_chk(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
|
||
|