summaryrefslogtreecommitdiff
path: root/accel-pppd/ipdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/ipdb.c')
-rw-r--r--accel-pppd/ipdb.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/accel-pppd/ipdb.c b/accel-pppd/ipdb.c
index a08d3be..8054e6b 100644
--- a/accel-pppd/ipdb.c
+++ b/accel-pppd/ipdb.c
@@ -5,13 +5,15 @@
static LIST_HEAD(ipdb_handlers);
-__export struct ipdb_item_t *ipdb_get(struct ppp_t *ppp)
+struct ipv4db_item_t __export *ipdb_get_ipv4(struct ppp_t *ppp)
{
struct ipdb_t *ipdb;
- struct ipdb_item_t *it;
+ struct ipv4db_item_t *it;
list_for_each_entry(ipdb, &ipdb_handlers, entry) {
- it = ipdb->get(ppp);
+ if (!ipdb->get_ipv4)
+ continue;
+ it = ipdb->get_ipv4(ppp);
if (it)
return it;
}
@@ -19,12 +21,35 @@ __export struct ipdb_item_t *ipdb_get(struct ppp_t *ppp)
return NULL;
}
-void __export ipdb_put(struct ppp_t *ppp, struct ipdb_item_t *it)
+void __export ipdb_put_ipv4(struct ppp_t *ppp, struct ipv4db_item_t *it)
{
- if (it->owner->put)
- it->owner->put(ppp, it);
+ if (it->owner->put_ipv4)
+ it->owner->put_ipv4(ppp, it);
}
+struct ipv6db_item_t __export *ipdb_get_ipv6(struct ppp_t *ppp)
+{
+ struct ipdb_t *ipdb;
+ struct ipv6db_item_t *it;
+
+ list_for_each_entry(ipdb, &ipdb_handlers, entry) {
+ if (!ipdb->get_ipv6)
+ continue;
+ it = ipdb->get_ipv6(ppp);
+ if (it)
+ return it;
+ }
+
+ return NULL;
+}
+
+void __export ipdb_put_ipv6(struct ppp_t *ppp, struct ipv6db_item_t *it)
+{
+ if (it->owner->put_ipv4)
+ it->owner->put_ipv6(ppp, it);
+}
+
+
void __export ipdb_register(struct ipdb_t *ipdb)
{
list_add_tail(&ipdb->entry, &ipdb_handlers);