summaryrefslogtreecommitdiff
path: root/accel-pppd/ipdb.h
blob: 69cb12f3c6e95674c80b9ab09304e37bed84b1c5 (plain)
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
59
60
61
62
63
64
65
66
#ifndef IPDB_H
#define IPDB_H

#include <netinet/in.h>

#include "ppp.h"
#include "list.h"

struct ipv4db_item_t
{
	struct ipdb_t *owner;
	in_addr_t addr;
	in_addr_t peer_addr;
	int mask;
};

struct ipv6db_addr_t
{
	struct list_head entry;
	struct in6_addr addr;
	int prefix_len;
	int flag_auto:1;
};

struct ipv6db_item_t
{
	struct ipdb_t *owner;
	uint64_t intf_id;
	uint64_t peer_intf_id;
	struct list_head addr_list;
};

struct ipv6db_prefix_t
{
	struct ipdb_t *owner;
	struct list_head prefix_list;
};


struct ipdb_t
{
	struct list_head entry;
	
	struct ipv4db_item_t *(*get_ipv4)(struct ap_session *ses);
	void (*put_ipv4)(struct ap_session *ses, struct ipv4db_item_t *);

	struct ipv6db_item_t *(*get_ipv6)(struct ap_session *ses);
	void (*put_ipv6)(struct ap_session *ses, struct ipv6db_item_t *);

	struct ipv6db_prefix_t *(*get_ipv6_prefix)(struct ap_session *ses);
	void (*put_ipv6_prefix)(struct ap_session *ses, struct ipv6db_prefix_t *);
};

struct ipv4db_item_t *ipdb_get_ipv4(struct ap_session *ses);
void ipdb_put_ipv4(struct ap_session *ses, struct ipv4db_item_t *);

struct ipv6db_item_t *ipdb_get_ipv6(struct ap_session *ses);
void ipdb_put_ipv6(struct ap_session *ses, struct ipv6db_item_t *);

struct ipv6db_prefix_t __export *ipdb_get_ipv6_prefix(struct ap_session *ses);
void __export ipdb_put_ipv6_prefix(struct ap_session *ses, struct ipv6db_prefix_t *it);

void ipdb_register(struct ipdb_t *);

#endif