92 lines
2.6 KiB
C
92 lines
2.6 KiB
C
#ifndef FREEAUTH_H_
|
|
#define FREEAUTH_H_
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.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 "../../../../common/rpc/rpc_common.h"
|
|
|
|
#define DPORT_MIN_NUM 0
|
|
#define DPORT_MAX_NUM 65535
|
|
#define RULE_MAX_NUM 10
|
|
|
|
#define FREEAUTH_CONFIG_ADD 0
|
|
#define FREEAUTH_CONFIG_MOD 1
|
|
#define FREEAUTH_CONFIG_DEL 2
|
|
#define FREEAUTH_CONFIG_GET 3
|
|
|
|
|
|
/*配置消息 */
|
|
typedef struct {
|
|
uint32_t sip;
|
|
uint32_t dip;
|
|
int dport;
|
|
char name[32];
|
|
}freeauth_configure_t;
|
|
|
|
typedef struct {
|
|
int resultcode;
|
|
char *message;
|
|
}authfree_result_t;
|
|
|
|
|
|
/*全局变量初始化 失败为1 成功为0*/
|
|
int authfreeInit(freeauth_configure_t **localuser);
|
|
|
|
|
|
/* 判断IPv4格式是否正确*/
|
|
int isIpV4Addr(const char *ipAddr);
|
|
|
|
|
|
/*下发配置到内核态 */
|
|
int set_freeauthcfg_waitack(freeauth_configure_t *struct_freeauth);
|
|
|
|
|
|
/*检查增加的参数格式是否正确 */
|
|
ret_code freeauth_config_add_chk(uint source,uint config_type,
|
|
pointer input, int input_len,
|
|
pointer output, int *output_len);
|
|
|
|
/*删除的时候以免认证规则名作为参数,检查免认证规则名是否存在 */
|
|
ret_code freeauth_config_del_chk(uint source,uint config_type,
|
|
pointer input, int input_len,
|
|
pointer output, int *output_len);
|
|
|
|
/*修改 查询要修改的内容是否存在 */
|
|
ret_code freeauth_config_mod_chk(uint source,uint config_type,
|
|
pointer input, int input_len,
|
|
pointer output, int *output_len);
|
|
|
|
/*chk data格式 */
|
|
ret_code freeauth_config_chk(uint source,uint *config_type,
|
|
pointer input, int *input_len,
|
|
pointer output, int *output_len);
|
|
|
|
|
|
ret_code freeauth_config_add_proc(uint source, uint config_type,
|
|
pointer input, int input_len,
|
|
pointer output, int *output_len);
|
|
|
|
|
|
ret_code freeauth_config_mod_proc(uint source, uint config_type,
|
|
pointer input, int input_len,
|
|
pointer output, int *output_len);
|
|
|
|
|
|
ret_code freeauth_config_del_proc(uint source, uint config_type,
|
|
pointer input, int input_len,
|
|
pointer output, int *output_len);
|
|
|
|
|
|
ret_code freeauth_config_proc(uint source, uint config_type,
|
|
pointer input, int input_len,
|
|
pointer output, int *output_len);
|
|
|
|
#endif |