Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25706/src
Modified Files:
dhcp-server-guile.c
Log Message:
now defining lease definitions at top level; returning NULL on false
Index: dhcp-server-guile.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-guile.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dhcp-server-guile.c 18 Aug 2003 04:10:57 -0000 1.10
--- dhcp-server-guile.c 18 Aug 2003 16:17:43 -0000 1.11
***************
*** 231,234 ****
--- 231,238 ----
void dhcp_guile_init(dhcp_server_control_t *sc)
{
+ list_t *lease_defs;
+ lease_definition_t *lease_def;
+ SCM scm_lease_defs = SCM_EOL;
+
/* initialize the server control smob. */
init_server_control_smob();
***************
*** 250,256 ****
lease_expire = scm_str2symbol("lease-expire");
- /* NOTE: defining at the top level should keep the garbage
- * collector from swallowing these symbols up. */
-
/* bind false to all the subroutines. */
--- 254,257 ----
***************
*** 267,270 ****
--- 268,283 ----
scm_c_define_gsubr("server-fatal-error-message", 1, 0, 1, scm_fatal_error_message);
+ /* bind to a top level list of all the lease definitions. */
+ lease_defs = server_conf_get_lease_defs(sc->server_conf);
+
+ /* cons up the lease definitions. */
+ list_rewind(lease_defs);
+ while((lease_def = list_next(lease_defs)) != NULL) {
+ scm_lease_defs = scm_cons(scm_lease_def_c2scm(lease_def), scm_lease_defs);
+ }
+
+ /* do lease defs binding. */
+ scm_c_define("lease-definitions", scm_lease_defs);
+
/* bind our server control object. */
scm_c_define("dhcp-server-control",
***************
*** 293,296 ****
--- 306,312 ----
scm_lease = scm_call_1(scm_variable_ref(lease_available), scm_client_info);
+ if(scm_lease == SCM_BOOL_F)
+ return NULL;
+
lease = scm_c_get_lease(scm_lease);
return lease;
***************
*** 307,310 ****
--- 323,329 ----
scm_lease = scm_call_2(scm_variable_ref(lease_lookup), scm_ip_addr, scm_client_info);
+
+ if(scm_lease == SCM_BOOL_F)
+ return NULL;
lease = scm_c_get_lease(scm_lease);
|