summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2011-08-28 22:36:56 +0400
committerKozlov Dmitry <xeb@mail.ru>2011-08-28 22:36:56 +0400
commit3e9cb77429b07a0317c7f394c22cf5cb78b59136 (patch)
tree86b2da9dd443801b3eaf1712552fac4fbc1373ff
parent6459c6085f7324404717418448fa8c04ffd46c20 (diff)
downloadaccel-ppp-3e9cb77429b07a0317c7f394c22cf5cb78b59136.tar.gz
accel-ppp-3e9cb77429b07a0317c7f394c22cf5cb78b59136.zip
ipdb: implement delegation prefix allocation
-rw-r--r--accel-pppd/ipdb.c22
-rw-r--r--accel-pppd/ipdb.h15
2 files changed, 37 insertions, 0 deletions
diff --git a/accel-pppd/ipdb.c b/accel-pppd/ipdb.c
index fccf9f4..f87d478 100644
--- a/accel-pppd/ipdb.c
+++ b/accel-pppd/ipdb.c
@@ -49,6 +49,28 @@ void __export ipdb_put_ipv6(struct ppp_t *ppp, struct ipv6db_item_t *it)
it->owner->put_ipv6(ppp, it);
}
+struct ipv6db_prefix_t __export *ipdb_get_ipv6_prefix(struct ppp_t *ppp)
+{
+ struct ipdb_t *ipdb;
+ struct ipv6db_prefix_t *it;
+
+ list_for_each_entry(ipdb, &ipdb_handlers, entry) {
+ if (!ipdb->get_ipv6_prefix)
+ continue;
+ it = ipdb->get_ipv6_prefix(ppp);
+ if (it)
+ return it;
+ }
+
+ return NULL;
+}
+
+void __export ipdb_put_ipv6_prefix(struct ppp_t *ppp, struct ipv6db_prefix_t *it)
+{
+ if (it->owner->put_ipv6_prefix)
+ it->owner->put_ipv6_prefix(ppp, it);
+}
+
void __export ipdb_register(struct ipdb_t *ipdb)
{
diff --git a/accel-pppd/ipdb.h b/accel-pppd/ipdb.h
index 1fcaf61..2781bd0 100644
--- a/accel-pppd/ipdb.h
+++ b/accel-pppd/ipdb.h
@@ -29,21 +29,36 @@ struct ipv6db_item_t
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 ppp_t *ppp);
void (*put_ipv4)(struct ppp_t *ppp, struct ipv4db_item_t *);
+
struct ipv6db_item_t *(*get_ipv6)(struct ppp_t *ppp);
void (*put_ipv6)(struct ppp_t *ppp, struct ipv6db_item_t *);
+
+ struct ipv6db_prefix_t *(*get_ipv6_prefix)(struct ppp_t *ppp);
+ void (*put_ipv6_prefix)(struct ppp_t *ppp, struct ipv6db_prefix_t *);
};
struct ipv4db_item_t *ipdb_get_ipv4(struct ppp_t *ppp);
void ipdb_put_ipv4(struct ppp_t *ppp, struct ipv4db_item_t *);
+
struct ipv6db_item_t *ipdb_get_ipv6(struct ppp_t *ppp);
void ipdb_put_ipv6(struct ppp_t *ppp, struct ipv6db_item_t *);
+struct ipv6db_prefix_t __export *ipdb_get_ipv6_prefix(struct ppp_t *ppp);
+void __export ipdb_put_ipv6_prefix(struct ppp_t *ppp, struct ipv6db_prefix_t *it);
+
void ipdb_register(struct ipdb_t *);
#endif