summaryrefslogtreecommitdiff
path: root/accel-pptpd/ipdb.c
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-09-10 11:58:34 +0400
committerKozlov Dmitry <dima@server>2010-09-10 11:58:34 +0400
commitc471cd62571f654b92bad0bd9f431927758f4d45 (patch)
tree8f08d11522ae9b3d0e2c44d04746ca0f0e5ed22c /accel-pptpd/ipdb.c
parent35d38d2c3f3db22216d43604b8750ecb6089e525 (diff)
downloadaccel-ppp-c471cd62571f654b92bad0bd9f431927758f4d45.tar.gz
accel-ppp-c471cd62571f654b92bad0bd9f431927758f4d45.zip
ippool: implemented module ippool which gives IP address from configurable ranges
Diffstat (limited to 'accel-pptpd/ipdb.c')
-rw-r--r--accel-pptpd/ipdb.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/accel-pptpd/ipdb.c b/accel-pptpd/ipdb.c
index 7b679dc7..62a99e9f 100644
--- a/accel-pptpd/ipdb.c
+++ b/accel-pptpd/ipdb.c
@@ -3,23 +3,24 @@
static LIST_HEAD(ipdb_handlers);
-int __export ipdb_get(struct ppp_t *ppp, in_addr_t *addr, in_addr_t *peer_addr)
+__export struct ipdb_item_t *ipdb_get(struct ppp_t *ppp)
{
struct ipdb_t *ipdb;
+ struct ipdb_item_t *it;
- list_for_each_entry(ipdb, &ipdb_handlers, entry)
- if (!ipdb->get(ppp, addr, peer_addr))
- return 0;
+ list_for_each_entry(ipdb, &ipdb_handlers, entry) {
+ it = ipdb->get(ppp);
+ if (it)
+ return it;
+ }
- return -1;
+ return NULL;
}
-void __export ipdb_put(struct ppp_t *ppp, in_addr_t addr, in_addr_t peer_addr)
-{
- struct ipdb_t *ipdb;
- list_for_each_entry(ipdb, &ipdb_handlers, entry)
- if (ipdb->put)
- ipdb->put(ppp, addr, peer_addr);
+void __export ipdb_put(struct ppp_t *ppp, struct ipdb_item_t *it)
+{
+ if (it->owner->put)
+ it->owner->put(ppp, it);
}
void __export ipdb_register(struct ipdb_t *ipdb)