forked from iqiyi/dpvs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipset.h
58 lines (47 loc) · 1.42 KB
/
ipset.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* DPVS is a software load balancer (Virtual Server) based on DPDK.
*
* Copyright (C) 2017 iQIYI (www.iqiyi.com).
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __DPVS_IPSET_H__
#define __DPVS_IPSET_H__
#include <arpa/inet.h>
#include <rte_mbuf.h>
#include <rte_byteorder.h>
#include "list.h"
#include "netif.h"
#include "conf/common.h"
#include "flow.h"
#define RTE_LOGTYPE_IPSET RTE_LOGTYPE_USER1
#define IPSET_CFG_FILE_NAME "/etc/gfwip.conf"
#define IPSET_CFG_MEMBERS "members:"
struct ipset_addr {
int af;
union inet_addr addr;
};
struct ipset_entry {
struct list_head list;
struct ipset_addr daddr;
};
int ipset_init(void);
int ipset_add(int af, union inet_addr *dest);
int ipset_del(int af, union inet_addr *dest);
int ipset_term(void);
struct ipset_entry *ipset_addr_lookup(int af, union inet_addr *dest);
#ifdef CONFIG_DPVS_IPSET_DEBUG
int ipset_list(void);
int ipset_test(void);
#endif
#endif