summaryrefslogtreecommitdiff
path: root/server/omapi.c
diff options
context:
space:
mode:
authorDavid Hankins <dhankins@isc.org>2006-02-24 23:16:32 +0000
committerDavid Hankins <dhankins@isc.org>2006-02-24 23:16:32 +0000
commit88cd8aca9efa1e5b867ac498b98e972638f7aee8 (patch)
tree8d3015eda99ca77265ed79d15b6e1f0200f6bab3 /server/omapi.c
parentb43c87ad595026da002f7acca54bf24318d9fed2 (diff)
downloadisc-dhcp-88cd8aca9efa1e5b867ac498b98e972638f7aee8.tar.gz
- Merge changes between 3.0.3RC1 and 3.0.4-BETA-3 into HEAD (silence
robie).
Diffstat (limited to 'server/omapi.c')
-rw-r--r--server/omapi.c69
1 files changed, 43 insertions, 26 deletions
diff --git a/server/omapi.c b/server/omapi.c
index 74deaf75..41e87f47 100644
--- a/server/omapi.c
+++ b/server/omapi.c
@@ -3,7 +3,7 @@
OMAPI object interfaces for the DHCP server. */
/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2006 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
@@ -41,7 +41,7 @@
#ifndef lint
static char copyright[] =
-"$Id: omapi.c,v 1.54 2005/09/30 17:57:32 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: omapi.c,v 1.55 2006/02/24 23:16:32 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -482,6 +482,7 @@ isc_result_t dhcp_lease_stuff_values (omapi_object_t *c,
omapi_object_t *id,
omapi_object_t *h)
{
+ u_int32_t bouncer;
struct lease *lease;
isc_result_t status;
@@ -604,63 +605,79 @@ isc_result_t dhcp_lease_stuff_values (omapi_object_t *c,
return status;
}
+ /* TIME values may be 64-bit, depending on system architecture.
+ * OMAPI must be system independent, both in terms of transmitting
+ * bytes on the wire in network byte order, and in terms of being
+ * readable and usable by both systems.
+ *
+ * XXX: In a future feature release, a put_int64() should be made
+ * to exist, and perhaps a put_time() wrapper that selects which
+ * to use based upon sizeof(TIME). In the meantime, use existing,
+ * 32-bit, code.
+ */
+ bouncer = (u_int32_t)lease->ends;
+ status = omapi_connection_put_name(c, "ends");
+ if (status != ISC_R_SUCCESS)
+ return status;
+ status = omapi_connection_put_uint32(c, sizeof(bouncer));
+ if (status != ISC_R_SUCCESS)
+ return status;
+ status = omapi_connection_put_uint32(c, bouncer);
+ if (status != ISC_R_SUCCESS)
+ return status;
- status = omapi_connection_put_name (c, "ends");
+ bouncer = (u_int32_t)lease->starts;
+ status = omapi_connection_put_name(c, "starts");
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_uint32 (c, sizeof (TIME));
+ status = omapi_connection_put_uint32(c, sizeof(bouncer));
if (status != ISC_R_SUCCESS)
return status;
- status = (omapi_connection_copyin
- (c, (const unsigned char *)&(lease -> ends), sizeof(TIME)));
+ status = omapi_connection_put_uint32(c, bouncer);
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_name (c, "starts");
+ bouncer = (u_int32_t)lease->tstp;
+ status = omapi_connection_put_name(c, "tstp");
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_uint32 (c, sizeof (TIME));
+ status = omapi_connection_put_uint32(c, sizeof(bouncer));
if (status != ISC_R_SUCCESS)
return status;
- status = (omapi_connection_copyin
- (c,
- (const unsigned char *)&(lease -> starts), sizeof (TIME)));
+ status = omapi_connection_put_uint32(c, bouncer);
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_name (c, "tstp");
+ bouncer = (u_int32_t)lease->tsfp;
+ status = omapi_connection_put_name(c, "tsfp");
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_uint32 (c, sizeof (TIME));
+ status = omapi_connection_put_uint32(c, sizeof(bouncer));
if (status != ISC_R_SUCCESS)
return status;
- status = (omapi_connection_copyin
- (c,
- (const unsigned char *)&(lease -> tstp), sizeof (TIME)));
+ status = omapi_connection_put_uint32(c, bouncer);
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_name (c, "tsfp");
+ bouncer = (u_int32_t)lease->atsfp;
+ status = omapi_connection_put_name(c, "atsfp");
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_uint32 (c, sizeof (TIME));
+ status = omapi_connection_put_uint32(c, sizeof(bouncer));
if (status != ISC_R_SUCCESS)
return status;
- status = (omapi_connection_copyin
- (c,
- (const unsigned char *)&(lease -> tsfp), sizeof (TIME)));
+ status = omapi_connection_put_uint32(c, bouncer);
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_name (c, "cltt");
+ bouncer = (u_int32_t)lease->cltt;
+ status = omapi_connection_put_name(c, "cltt");
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_uint32 (c, sizeof (TIME));
+ status = omapi_connection_put_uint32(c, sizeof(bouncer));
if (status != ISC_R_SUCCESS)
return status;
- status = (omapi_connection_copyin
- (c,
- (const unsigned char *)&(lease -> cltt), sizeof (TIME)));
+ status = omapi_connection_put_uint32(c, bouncer);
if (status != ISC_R_SUCCESS)
return status;