dhcp6_lease.h

00001 /* @file dhcp6_lease.h
00002  *
00003  *  Representation of DHCPv6 lease options for libdhcp
00004  *
00005  * @author Jason Vas Dias<jvdias@redhat.com>
00006  */
00007 /*
00008  *  Copyright(C) Jason Vas Dias<jvdias@redhat.com> Red Hat Inc. May 2006
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation at 
00013  *           http://www.fsf.org/licensing/licenses/gpl.txt
00014  *  and included in this software distribution as the "LICENSE" file.
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU General Public License for more details.
00020  */
00021 
00022 #ifndef _DHCP6_LEASE_H
00023 #define _DHCP6_LEASE_H
00024 
00025 #include  <sys/types.h>
00026 #include  <netinet/in.h>
00027 #include  <stdint.h>
00028 
00029 #include  <sys/queue.h>    /* glibc list macros */
00030 
00031 /** @addtogroup DHCPv6_lease 
00032  *  @{
00033  */
00034 
00035 /** 
00036  *  DHCPv6 address types.
00037  */
00038 enum dhcpv6_address_type_e
00039 {
00040     DHCPv6_ADDRESS,           /**< permanent lease address */
00041     DHCPv6_TEMPORARY_ADDRESS, /**< temporary address given with delegated prefix */
00042     DHCPv6_DELEGATED_PREFIX   /**< delegated prefix to configure radvd(8) with */
00043 }   DHCPv6_address_type;
00044 
00045 /**
00046  *  DHCPv6 address type.
00047  *  There may be multiple DHCPv6 addresses per lease,
00048  *  each of which may have different prefix length,
00049  *  and lifetimes.
00050  */
00051 typedef
00052 struct dhcp6_lease_address_s
00053 {
00054     struct in6_addr address;        /**< the IPv6 lease address bytes */
00055     uint8_t         prefix_length;  /**< lease address prefix length */ 
00056     uint8_t         type;           /**< lease address type */
00057     uint16_t        status;         /**< lease address status */
00058     time_t          time_acquired;  /**< time lease address acquired */
00059     time_t          valid_lifetime; /**< valid lifetime of lease address */
00060     time_t          prefer_lifetime;/**< prefer lifetime of lease address */
00061     STAILQ_ENTRY    ( dhcp6_lease_address_s ) link; /**< next lease address */
00062 }   DHCPv6_lease_address;
00063 
00064 
00065 /**
00066  * DHCPv6 lease address list type.
00067  */
00068 typedef
00069 STAILQ_HEAD( dhcp6_lease_address_list_s, dhcp6_lease_address_s ) 
00070 DHCPv6_lease_address_list;
00071 
00072 /**
00073  * DHCPv6 DNS server IPv6 address list element type.
00074  */
00075 typedef
00076 struct ipv6_address_s
00077 {
00078     struct in6_addr address;
00079     STAILQ_ENTRY( ipv6_address_s ) link;
00080 }   IPv6_address;
00081 
00082 /**
00083  * DHCPv6 DNS server IPv6 address list type.
00084  */
00085 typedef 
00086 STAILQ_HEAD( ipv6_address_list_s, ipv6_address_s )
00087 IPv6_address_list;
00088 
00089 
00090 /**
00091  * DHCPv6 lease type
00092  */
00093 typedef 
00094 struct dhcp6_lease_s
00095 {
00096     DHCPv6_lease_address_list addresses;  /**< list of lease addresses */
00097     time_t   renew_time;                  /**< time lease should be renewed */
00098     time_t   rebind_time;                 /**< time lease must be rebound */
00099     char     *search_list;                /**< dns domain name search list, if sent */
00100     IPv6_address_list dns;                /**< domain name servers */ 
00101     char     *if_name;                    /**< interface name      */
00102     uint32_t  if_index;                   /**< interface index    */
00103     uint32_t iaid;                        /**< DHCPv6 lease identifier */ 
00104     uint8_t     *client_duid;             /**< DHCPv6 client identifier */
00105     uint8_t     *server_duid;             /**< DHCPv6 server identifier */
00106     uint16_t     client_duid_len;         /**< DHCPv6 client identifier length*/
00107     uint16_t     server_duid_len;         /**< DHCPv6 server identifier length*/
00108     struct in6_addr server_address;       /**< DHCPv6 server address */
00109 } DHCPv6_lease;
00110 
00111 struct dhcp6_optinfo;           /**< defined in dhcpv6's dhcp6.h */
00112 
00113 extern DHCPv6_lease *dhcpv6_lease ( struct dhcp6_optinfo * );/**<
00114   * call this with the dhcp6_optinfo * returned to the
00115   * libdhcp callback on the DHC6_BOUND state to construct
00116   * a DHCPv6_lease .
00117   */
00118 
00119 extern void dhcpv6_lease_free( DHCPv6_lease * ); /**<
00120   * frees all resources associated with the DHCPv6_lease
00121   */
00122 
00123 extern int dhcpv6_pack_lease( DHCPv6_lease* lease, uint8_t* buf, uint32_t len); /**<
00124   * packs the DHCPv6_lease in a buffer of length len, suitable for IPC 
00125   * / mmap'ed file storage.
00126   */
00127 
00128 extern DHCPv6_lease *dhcpv6_unpack_lease( uint8_t* buf ); /**<
00129   * unpacks the DHCPv6_lease from a buffer created by dhcpv6_pack_lease()
00130   */
00131 
00132 /**@}*/
00133 
00134 #endif

Generated on Thu Aug 10 21:26:25 2006 for libdhcp by  doxygen 1.4.7