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