File indexing completed on 2024-11-10 12:23:50

0001 /*
0002     This file is part of the KDE Libraries
0003     SPDX-FileCopyrightText: 2001 Malte Starostik <malte@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 /* See RFC 2131 for details */
0009 
0010 #ifndef __dhcp_h__
0011 #define __dhcp_h__
0012 
0013 #include <config-kpac.h>
0014 
0015 #if HAVE_STDINT_H
0016 #include <stdint.h>
0017 #endif
0018 
0019 #define DHCP_OPT_LEN 312
0020 
0021 struct dhcp_msg {
0022 #define DHCP_BOOTREQUEST 1
0023 #define DHCP_BOOTREPLY 2
0024     uint8_t op; /* operation */
0025     uint8_t htype; /* hwaddr type */
0026     uint8_t hlen; /* hwaddr len */
0027     uint8_t hops;
0028     uint32_t xid; /* transaction id */
0029     uint16_t secs; /* seconds since protocol start */
0030 #define DHCP_BROADCAST 1
0031     uint16_t flags;
0032     uint32_t ciaddr; /* client IP */
0033     uint32_t yiaddr; /* "your" IP */
0034     uint32_t siaddr; /* server IP */
0035     uint32_t giaddr; /* gateway IP */
0036     uint8_t chaddr[16]; /* client hwaddr */
0037     uint8_t sname[64]; /* server name */
0038     uint8_t file[128]; /* bootstrap file */
0039     uint8_t options[DHCP_OPT_LEN];
0040 };
0041 
0042 /* first four bytes in options */
0043 #define DHCP_MAGIC1 0x63
0044 #define DHCP_MAGIC2 0x82
0045 #define DHCP_MAGIC3 0x53
0046 #define DHCP_MAGIC4 0x63
0047 
0048 /* DHCP message types */
0049 #define DHCP_DISCOVER 1
0050 #define DHCP_OFFER 2
0051 #define DHCP_REQUEST 3
0052 #define DHCP_DECLINE 4
0053 #define DHCP_ACK 5
0054 #define DHCP_NAK 6
0055 #define DHCP_RELEASE 7
0056 #define DHCP_INFORM 8
0057 
0058 /* option types */
0059 #define DHCP_OPT_MSGTYPE 0x35
0060 #define DHCP_OPT_PARAMREQ 0x37
0061 #define DHCP_OPT_WPAD 0xfc
0062 #define DHCP_OPT_END 0xff
0063 
0064 #endif