Diff for /embedaddon/dhcp/server/omapi.c between versions 1.1 and 1.1.1.1

version 1.1, 2012/02/21 22:30:18 version 1.1.1.1, 2012/10/09 09:06:55
Line 3 Line 3
    OMAPI object interfaces for the DHCP server. */     OMAPI object interfaces for the DHCP server. */
   
 /*  /*
 * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2010,2012 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1999-2003 by Internet Software Consortium   * Copyright (c) 1999-2003 by Internet Software Consortium
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
Line 480  isc_result_t dhcp_lease_destroy (omapi_object_t *h, co Line 480  isc_result_t dhcp_lease_destroy (omapi_object_t *h, co
 isc_result_t dhcp_lease_signal_handler (omapi_object_t *h,  isc_result_t dhcp_lease_signal_handler (omapi_object_t *h,
                                         const char *name, va_list ap)                                          const char *name, va_list ap)
 {  {
        struct lease *lease;        /* h should point to (struct lease *) */
         isc_result_t status;          isc_result_t status;
   
         if (h -> type != dhcp_type_lease)          if (h -> type != dhcp_type_lease)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         lease = (struct lease *)h;  
   
         if (!strcmp (name, "updated"))          if (!strcmp (name, "updated"))
                 return ISC_R_SUCCESS;                  return ISC_R_SUCCESS;
Line 985  isc_result_t dhcp_host_set_value  (omapi_object_t *h, Line 984  isc_result_t dhcp_host_set_value  (omapi_object_t *h,
   
         if (!omapi_ds_strcmp (name, "hardware-type")) {          if (!omapi_ds_strcmp (name, "hardware-type")) {
                 int type;                  int type;
                if (value && (value -> type == omapi_datatype_data &&                if ((value != NULL) &&
                              value -> u.buffer.len == sizeof type)) {                    ((value->type == omapi_datatype_data) &&
                        if (value -> u.buffer.len > sizeof type)                     (value->u.buffer.len == sizeof(type)))) {
                                return ISC_R_INVALIDARG;                        if (value->u.buffer.len > sizeof(type))
                        memcpy (&type,                                return (ISC_R_INVALIDARG);
                                value -> u.buffer.value,                        memcpy(&type, value->u.buffer.value,
                                value -> u.buffer.len);                               value->u.buffer.len);
                        type = ntohl (type);                        type = ntohl(type);
                } else if (value -> type == omapi_datatype_int)                } else if ((value != NULL) &&
                        type = value -> u.integer;                           (value->type == omapi_datatype_int))
                         type = value->u.integer;
                 else                  else
                        return ISC_R_INVALIDARG;                        return (ISC_R_INVALIDARG);
                host -> interface.hbuf [0] = type;                host->interface.hbuf[0] = type;
                return ISC_R_SUCCESS;                return (ISC_R_SUCCESS);
         }          }
   
         if (!omapi_ds_strcmp (name, "dhcp-client-identifier")) {          if (!omapi_ds_strcmp (name, "dhcp-client-identifier")) {
Line 1175  isc_result_t dhcp_host_get_value (omapi_object_t *h, o Line 1175  isc_result_t dhcp_host_get_value (omapi_object_t *h, o
   
 isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *file, int line)  isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *file, int line)
 {  {
         struct host_decl *host;  
   
         if (h -> type != dhcp_type_host)          if (h -> type != dhcp_type_host)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         host = (struct host_decl *)h;  
   
 #if defined (DEBUG_MEMORY_LEAKAGE) || \  #if defined (DEBUG_MEMORY_LEAKAGE) || \
                 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)                  defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
           struct host_decl *host = (struct host_decl *)h;
         if (host -> n_ipaddr)          if (host -> n_ipaddr)
                 host_dereference (&host -> n_ipaddr, file, line);                  host_dereference (&host -> n_ipaddr, file, line);
         if (host -> n_dynamic)          if (host -> n_dynamic)
Line 1388  isc_result_t dhcp_host_lookup (omapi_object_t **lp, Line 1386  isc_result_t dhcp_host_lookup (omapi_object_t **lp,
                                   tv -> value -> u.buffer.value,                                    tv -> value -> u.buffer.value,
                                   tv -> value -> u.buffer.len, MDL);                                    tv -> value -> u.buffer.len, MDL);
                 omapi_value_dereference (&tv, MDL);                  omapi_value_dereference (&tv, MDL);
                        
                 if (*lp && *lp != (omapi_object_t *)host) {                  if (*lp && *lp != (omapi_object_t *)host) {
                         omapi_object_dereference (lp, MDL);                          omapi_object_dereference (lp, MDL);
                         if (host)                          if (host)
Line 1594  isc_result_t dhcp_pool_set_value  (omapi_object_t *h, Line 1592  isc_result_t dhcp_pool_set_value  (omapi_object_t *h,
                                    omapi_data_string_t *name,                                     omapi_data_string_t *name,
                                    omapi_typed_data_t *value)                                     omapi_typed_data_t *value)
 {  {
        struct pool *pool;        /* h should point to (struct pool *) */
         isc_result_t status;          isc_result_t status;
   
         if (h -> type != dhcp_type_pool)          if (h -> type != dhcp_type_pool)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         pool = (struct pool *)h;  
   
         /* No values to set yet. */          /* No values to set yet. */
   
Line 1619  isc_result_t dhcp_pool_get_value (omapi_object_t *h, o Line 1616  isc_result_t dhcp_pool_get_value (omapi_object_t *h, o
                                   omapi_data_string_t *name,                                    omapi_data_string_t *name,
                                   omapi_value_t **value)                                    omapi_value_t **value)
 {  {
        struct pool *pool;        /* h should point to (struct pool *) */
         isc_result_t status;          isc_result_t status;
   
         if (h -> type != dhcp_type_pool)          if (h -> type != dhcp_type_pool)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         pool = (struct pool *)h;  
   
         /* No values to get yet. */          /* No values to get yet. */
   
Line 1640  isc_result_t dhcp_pool_get_value (omapi_object_t *h, o Line 1636  isc_result_t dhcp_pool_get_value (omapi_object_t *h, o
   
 isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line)  isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line)
 {  {
         struct pool *pool;  
 #if defined (DEBUG_MEMORY_LEAKAGE) || \  #if defined (DEBUG_MEMORY_LEAKAGE) || \
                 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)                  defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
         struct permit *pc, *pn;          struct permit *pc, *pn;
Line 1648  isc_result_t dhcp_pool_destroy (omapi_object_t *h, con Line 1643  isc_result_t dhcp_pool_destroy (omapi_object_t *h, con
   
         if (h -> type != dhcp_type_pool)          if (h -> type != dhcp_type_pool)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         pool = (struct pool *)h;  
   
 #if defined (DEBUG_MEMORY_LEAKAGE) || \  #if defined (DEBUG_MEMORY_LEAKAGE) || \
                 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)                  defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
           struct pool *pool = (struct pool *)h;
         if (pool -> next)          if (pool -> next)
                 pool_dereference (&pool -> next, file, line);                  pool_dereference (&pool -> next, file, line);
         if (pool -> group)          if (pool -> group)
Line 1692  isc_result_t dhcp_pool_destroy (omapi_object_t *h, con Line 1687  isc_result_t dhcp_pool_destroy (omapi_object_t *h, con
 isc_result_t dhcp_pool_signal_handler (omapi_object_t *h,  isc_result_t dhcp_pool_signal_handler (omapi_object_t *h,
                                        const char *name, va_list ap)                                         const char *name, va_list ap)
 {  {
        struct pool *pool;        /* h should point to (struct pool *) */
         isc_result_t status;          isc_result_t status;
         int updatep = 0;          int updatep = 0;
   
         if (h -> type != dhcp_type_pool)          if (h -> type != dhcp_type_pool)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         pool = (struct pool *)h;  
   
         /* Can't write pools yet. */          /* Can't write pools yet. */
   
Line 1718  isc_result_t dhcp_pool_stuff_values (omapi_object_t *c Line 1712  isc_result_t dhcp_pool_stuff_values (omapi_object_t *c
                                      omapi_object_t *id,                                       omapi_object_t *id,
                                      omapi_object_t *h)                                       omapi_object_t *h)
 {  {
        struct pool *pool;        /* h should point to (struct pool *) */
         isc_result_t status;          isc_result_t status;
   
         if (h -> type != dhcp_type_pool)          if (h -> type != dhcp_type_pool)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         pool = (struct pool *)h;  
   
         /* Can't stuff pool values yet. */          /* Can't stuff pool values yet. */
   
Line 1951  isc_result_t dhcp_class_get_value (omapi_object_t *h,  Line 1944  isc_result_t dhcp_class_get_value (omapi_object_t *h, 
   
 isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line)  isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line)
 {  {
         struct class *class;  
   
         if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass)          if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         class = (struct class *)h;  
   
 #if defined (DEBUG_MEMORY_LEAKAGE) || \  #if defined (DEBUG_MEMORY_LEAKAGE) || \
                 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)                  defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
           struct class *class = (struct class *)h;
         if (class -> nic)          if (class -> nic)
                 class_dereference (&class -> nic, file, line);                  class_dereference (&class -> nic, file, line);
         if (class -> superclass)          if (class -> superclass)
Line 2065  class_signal_handler(omapi_object_t *h, Line 2056  class_signal_handler(omapi_object_t *h,
   
         if (updatep)          if (updatep)
                 return ISC_R_SUCCESS;                  return ISC_R_SUCCESS;
        
         return ISC_R_NOTFOUND;          return ISC_R_NOTFOUND;
 }  }
   
Line 2083  isc_result_t dhcp_class_stuff_values (omapi_object_t * Line 2074  isc_result_t dhcp_class_stuff_values (omapi_object_t *
                                       omapi_object_t *id,                                        omapi_object_t *id,
                                       omapi_object_t *h)                                        omapi_object_t *h)
 {  {
        struct class *class;        /* h should point to (struct class *) */
         isc_result_t status;          isc_result_t status;
   
         if (h -> type != dhcp_type_class)          if (h -> type != dhcp_type_class)
                 return ISC_R_INVALIDARG;                  return ISC_R_INVALIDARG;
         class = (struct class *)h;  
   
         /* Can't stuff class values yet. */          /* Can't stuff class values yet. */
   

Removed from v.1.1  
changed lines
  Added in v.1.1.1.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>