00001 #ifndef _DHCP_H
00002 #define _DHCP_H
00003
00004 /*
00005 * Copyright (C) 2001-2002 by egnite Software GmbH. All rights reserved.
00006 *
00007 * Redistribution and use in source and binary forms, with or without
00008 * modification, are permitted provided that the following conditions
00009 * are met:
00010 *
00011 * 1. Redistributions of source code must retain the above copyright
00012 * notice, this list of conditions and the following disclaimer.
00013 * 2. Redistributions in binary form must reproduce the above copyright
00014 * notice, this list of conditions and the following disclaimer in the
00015 * documentation and/or other materials provided with the distribution.
00016 * 3. All advertising materials mentioning features or use of this
00017 * software must display the following acknowledgement:
00018 *
00019 * This product includes software developed by egnite Software GmbH
00020 * and its contributors.
00021 *
00022 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00023 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00026 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00029 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00030 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033 * SUCH DAMAGE.
00034 *
00035 * For additional information see http://www.ethernut.de/
00036 *
00037 * -
00038 * Portions Copyright (c) 1983, 1993 by
00039 * The Regents of the University of California. All rights reserved.
00040 *
00041 * Redistribution and use in source and binary forms, with or without
00042 * modification, are permitted provided that the following conditions
00043 * are met:
00044 * 1. Redistributions of source code must retain the above copyright
00045 * notice, this list of conditions and the following disclaimer.
00046 * 2. Redistributions in binary form must reproduce the above copyright
00047 * notice, this list of conditions and the following disclaimer in the
00048 * documentation and/or other materials provided with the distribution.
00049 * 3. All advertising materials mentioning features or use of this software
00050 * must display the following acknowledgement:
00051 * This product includes software developed by the University of
00052 * California, Berkeley and its contributors.
00053 * 4. Neither the name of the University nor the names of its contributors
00054 * may be used to endorse or promote products derived from this software
00055 * without specific prior written permission.
00056 *
00057 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00058 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00059 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00060 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00061 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00062 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00063 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00064 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00065 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00066 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00067 * SUCH DAMAGE.
00068 * -
00069 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
00070 *
00071 * Permission to use, copy, modify, and distribute this software for any
00072 * purpose with or without fee is hereby granted, provided that the above
00073 * copyright notice and this permission notice appear in all copies, and that
00074 * the name of Digital Equipment Corporation not be used in advertising or
00075 * publicity pertaining to distribution of the document or software without
00076 * specific, written prior permission.
00077 *
00078 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
00079 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
00080 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
00081 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
00082 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
00083 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
00084 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00085 * SOFTWARE.
00086 */
00087
00088 /*
00089 * $Log: dhcp.h,v $
00090 * Revision 1.1 2002/08/01 17:34:29 harald
00091 * First check in
00092 *
00093 */
00094
00095 /*!
00096 * \addtogroup xgDhcp
00097 */
00098 /*@{*/
00099
00100 #define DHCP_SERVERPORT 67
00101 #define DHCP_CLIENTPORT 68
00102
00103 #define DHCPOPT_PAD 0
00104 #define DHCPOPT_NETMASK 1
00105 #define DHCPOPT_GATEWAY 3
00106 #define DHCPOPT_DNS 6
00107 #define DHCPOPT_HOSTNAME 12
00108 #define DHCPOPT_DOMAIN 15
00109 #define DHCPOPT_BROADCAST 28
00110 #define DHCPOPT_REQUESTIP 50
00111 #define DHCPOPT_LEASETIME 51
00112 #define DHCPOPT_MSGTYPE 53
00113 #define DHCPOPT_SID 54
00114 #define DHCPOPT_RENEWALTIME 58
00115 #define DHCPOPT_REBINDTIME 59
00116 #define DHCPOPT_END 255
00117
00118 #define DHCP_DISCOVER 1
00119 #define DHCP_OFFER 2
00120 #define DHCP_REQUEST 3
00121 #define DHCP_DECLINE 4
00122 #define DHCP_ACK 5
00123 #define DHCP_NAK 6
00124 #define DHCP_RELEASE 7
00125 #define DHCP_INFORM 8
00126
00127 typedef struct bootp {
00128 u_char bp_op; /*!< \brief Packet opcode type: 1=request, 2=reply */
00129 u_char bp_htype; /*!< \brief Hardware address type: 1=Ethernet */
00130 u_char bp_hlen; /*!< \brief Hardware address length: 6 for Ethernet */
00131 u_char bp_hops; /*!< \brief Gateway hops */
00132 u_long bp_xid; /*!< \brief Transaction ID */
00133 u_short bp_secs; /*!< \brief Seconds since boot began */
00134 u_short bp_flags; /*!< \brief RFC1532 broadcast, etc. */
00135 u_long bp_ciaddr; /*!< \brief Client IP address */
00136 u_long bp_yiaddr; /*!< \brief 'Your' IP address */
00137 u_long bp_siaddr; /*!< \brief Server IP address */
00138 u_long bp_giaddr; /*!< \brief Gateway IP address */
00139 u_char bp_chaddr[16]; /*!< \brief Client hardware address */
00140 char bp_sname[64]; /*!< \brief Server host name */
00141 char bp_file[128]; /*!< \brief Boot file name */
00142 u_char bp_options[312]; /*!< \brief Vendor-specific area */
00143 } BOOTPHDR;
00144
00145 /*@}*/
00146
00147 extern int DhcpQuery(void);
00148
00149 #endif