2019-07-01 07:39:28 +00:00
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
/*配置消息 */
|
|
|
|
|
typedef struct {
|
|
|
|
|
uint32_t sip;
|
|
|
|
|
uint32_t dip;
|
|
|
|
|
int dport;
|
|
|
|
|
char name[32];
|
|
|
|
|
}freeauth_configure_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*全局变量初始化 失败为1 成功为0*/
|
2019-07-02 11:48:55 +00:00
|
|
|
|
int authfreeInit(freeauth_configure_t *localuser);
|
2019-07-01 07:39:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 判断IPv4格式是否正确*/
|
|
|
|
|
int isIpV4Addr(const char *ipAddr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*下发配置到内核态 */
|
|
|
|
|
int set_freeauthcfg_waitack(freeauth_configure_t *struct_freeauth);
|
|
|
|
|
|
|
|
|
|
/*判断免认证规则源IP地址、目的IP地址是否有效,判断端口号是否有效 */
|
2019-07-06 06:27:30 +00:00
|
|
|
|
ret_code freeauth_config_chk(uint source, uint *config_type,
|
|
|
|
|
pointer input, int *input_len,
|
2019-07-01 07:39:28 +00:00
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*免认证规则有效,将免认证规则通过netlink下发到内核态 */
|
2019-07-02 11:48:55 +00:00
|
|
|
|
ret_code freeauth_config_proc(uint source, uint config_type,
|
2019-07-01 07:39:28 +00:00
|
|
|
|
pointer input, int input_len,
|
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
#endif
|