1 /******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
4 * This program and the accompanying materials
5 * are made available under the terms of the BSD License
6 * which accompanies this distribution, and is available at
7 * http://www.opensource.org/licenses/bsd-license.php
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
19 #include <netlib/mtftp.h>
21 #include <netlib/tftp.h>
25 * A header for BootP/DHCP-messages.
26 * For more information see RFC 951 / RFC 2131.
29 uint8_t op; /**< Identifies is it request (1) or reply (2) */
30 uint8_t htype; /**< HW address type (ethernet usually) */
31 uint8_t hlen; /**< HW address length */
32 uint8_t hops; /**< This info used by relay agents (not used) */
33 uint32_t xid; /**< This ID is used to match queries and replies */
34 uint16_t secs; /**< Unused */
35 uint16_t unused; /**< Unused */
36 uint32_t ciaddr; /**< Client IP address (if client knows it) */
37 uint32_t yiaddr; /**< "Your" (client) IP address */
38 uint32_t siaddr; /**< Next server IP address (TFTP server IP) */
39 uint32_t giaddr; /**< Gateway IP address (used by relay agents) */
40 uint8_t chaddr[16]; /**< Client HW address */
41 uint8_t sname[64]; /**< Server host name (TFTP server name) */
42 uint8_t file[128]; /**< Boot file name */
43 uint8_t vend[64]; /**< Optional parameters field (DHCP-options) */
46 void dhcpv4_generate_transaction_id(void);
47 int bootp(char *ret_buffer, filename_ip_t *, unsigned int);
48 int dhcpv4(char *ret_buffer, filename_ip_t *);
49 void dhcp_send_release(int fd);
51 /* Handles DHCP-packets, which are detected by receive_ether. */
52 extern int8_t handle_dhcp(int fd, uint8_t * packet, int32_t packetsize);