secgateway/Platform/user/configm/config-server/web_config/auth_parameters.h

78 lines
2.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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 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
#define AUTHPARA_CONFIG_MOD 0
#define AUTHPARA_CONFIG_GET 1
/*配置消息 */
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);
/*获取json串类型*/
ret_code authpara_config_json_type(pointer input, uint *conf_type);
/* 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_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);
ret_code authpara_config_proc(uint source, uint config_type,
pointer input, int input_len,
pointer output, int *output_len);
#endif