[dhcp-agent-commits] dhcp-agent/src dhcp-server-lease-manager.c,NONE,1.1 dhcp-server-lease-manager.h
Status: Alpha
Brought to you by:
actmodern
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv27886/src Modified Files: dhcp-server-guile.c dhcp-server-guile.h Added Files: dhcp-server-lease-manager.c dhcp-server-lease-manager.h dhcp-server-lease.h Log Message: new lease manager, and update to guile bindings --- NEW FILE: dhcp-server-lease-manager.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-lease-manager.c,v 1.1 2003/07/29 02:38:14 actmodern Exp $ * * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * The lease manager. This is wrapped directly around dhcp-server-guile. * */ #include "dhcp-local.h" #include "dhcp-libutil.h" #include "dhcp-librawnet.h" #include "dhcp-server-conf.h" #include "dhcp-server.h" #include "dhcp-lease.h" #include "dhcp-server-lease-manager.h" #include "dhcp-server-guile.h" int lease_manager_initialize(void) { return dhcp_guile_initialize_leases(); } lease_definition_t *lease_manager_lease_available(const char *hostname, eth_addr_t mac_addr, ip_addr_t giaddr, dhcp_opt_t *client_id) { return NULL; } lease_definition_t *lease_manager_lookup_lease(ip_addr_t ip_addr, const char *hostname, eth_addr_t mac_addr, ip_addr_t giaddr, dhcp_opt_t *client_id) { return NULL; } lease_definition_t *lease_manager_acquire_lease(lease_definition_t *lease) { return NULL; } int lease_manager_release_lease(lease_definition_t *lease) { return 0; } void lease_expire(lease_definition_t *lease) { return; } --- NEW FILE: dhcp-server-lease-manager.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-lease-manager.h,v 1.1 2003/07/29 02:38:14 actmodern Exp $ * * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef DHCP_SERVER_LEASE_MANAGER_H #define DHCP_SERVER_LEASE_MANAGER_H extern int initialize_lease_manager(void); extern lease_definition_t *lease_manager_lease_available(const char *hostname, eth_addr_t mac_addr, ip_addr_t giaddr, dhcp_opt_t *client_id); extern lease_definition_t *lease_manager_lookup_lease(ip_addr_t ip_addr, const char *hostname, eth_addr_t mac_addr, ip_addr_t giaddr, dhcp_opt_t *client_id); extern lease_definition_t *lease_manager_acquire_lease(lease_definition_t *lease); extern int lease_manager_release_lease(lease_definition_t *lease); extern void lease_expire(lease_definition_t *lease); #endif /* DHCP_SERVER_LEASE_MANAGER_H */ --- NEW FILE: dhcp-server-lease.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-lease.h,v 1.1 2003/07/29 02:38:14 actmodern Exp $ * * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ Index: dhcp-server-guile.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-guile.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-server-guile.c 28 Jul 2003 00:33:54 -0000 1.1 --- dhcp-server-guile.c 29 Jul 2003 02:38:14 -0000 1.2 *************** *** 175,181 **** } ! /* get the next available lease. */ ! lease_definition_t *dhcp_guile_get_next_lease(const char *hostname, eth_addr_t mac_addr, ! ip_addr_t giaddr, list_t *client_options) { return NULL; --- 175,188 ---- } ! /* ask if any leases are available. */ ! lease_definition_t *dhcp_guile_lease_available(const char *hostname, eth_addr_t mac_addr, ! ip_addr_t giaddr, dhcp_opt_t *client_id) ! { ! return NULL; ! } ! ! /* lookup a lease: lookup a lease. */ ! lease_definition_t *dhcp_guile_lookup_lease(ip_addr_t ip_addr, const char *hostname, eth_addr_t mac_addr, ! ip_addr_t giaddr, dhcp_opt_t *client_id) { return NULL; *************** *** 183,191 **** /* get the next available lease. */ ! lease_definition_t *dhcp_guile_lease_lookup(ip_addr_t ip_addr) { return NULL; } void dhcp_guile_lease_expire(void) { --- 190,205 ---- /* get the next available lease. */ ! lease_definition_t *dhcp_guile_acquire_lease(lease_definition_t *definition) { return NULL; } + /* lookup an existing lease. */ + lease_definition_t *dhcp_guile_release_lease(lease_definition_t *definition) + { + return NULL; + } + + /* expire a lease. */ void dhcp_guile_lease_expire(void) { Index: dhcp-server-guile.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-guile.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-server-guile.h 28 Jul 2003 00:33:54 -0000 1.2 --- dhcp-server-guile.h 29 Jul 2003 02:38:14 -0000 1.3 *************** *** 32,39 **** } server_control_smob_t; extern int dhcp_guile_initialize_leases(void); ! extern lease_definition_t *dhcp_guile_get_next_lease(const char *hostname, eth_addr_t mac_addr, ! ip_addr_t giaddr, list_t *client_options); ! extern lease_definition_t *dhcp_guile_lease_lookup(ip_addr_t ip_addr); extern void dhcp_guile_lease_expire(void); --- 32,45 ---- } server_control_smob_t; + /* prototypes. */ + + extern void dhcp_guile_init(dhcp_server_control_t *sc); extern int dhcp_guile_initialize_leases(void); ! extern lease_definition_t *dhcp_guile_lease_available(const char *hostname, eth_addr_t mac_addr, ! ip_addr_t giaddr, dhcp_opt_t *client_id); ! extern lease_definition_t *dhcp_guile_lookup_lease(ip_addr_t ip_addr, const char *hostname, eth_addr_t mac_addr, ! ip_addr_t giaddr, dhcp_opt_t *client_id); ! extern lease_definition_t *dhcp_guile_acquire_lease(lease_definition_t *definition); ! extern lease_definition_t *dhcp_guile_release_lease(lease_definition_t *definition); extern void dhcp_guile_lease_expire(void); |