]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/libsystemd-network/dhcp-protocol.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright (C) 2013 Intel Corporation. All rights reserved.
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include <netinet/ip.h>
25 #include <netinet/udp.h>
29 #include "sparse-endian.h"
50 typedef struct DHCPMessage DHCPMessage
;
58 typedef struct DHCPPacket DHCPPacket
;
60 #define DHCP_IP_SIZE (int32_t)(sizeof(struct iphdr))
61 #define DHCP_IP_UDP_SIZE (int32_t)(sizeof(struct udphdr) + DHCP_IP_SIZE)
62 #define DHCP_MESSAGE_SIZE (int32_t)(sizeof(DHCPMessage))
63 #define DHCP_DEFAULT_MIN_SIZE 576 /* the minimum internet hosts must be able to receive */
64 #define DHCP_MIN_OPTIONS_SIZE DHCP_DEFAULT_MIN_SIZE - DHCP_IP_UDP_SIZE - DHCP_MESSAGE_SIZE
65 #define DHCP_MAGIC_COOKIE (uint32_t)(0x63825363)
68 DHCP_PORT_SERVER
= 67,
69 DHCP_PORT_CLIENT
= 68,
74 DHCP_STATE_SELECTING
= 1,
75 DHCP_STATE_INIT_REBOOT
= 2,
76 DHCP_STATE_REBOOTING
= 3,
77 DHCP_STATE_REQUESTING
= 4,
79 DHCP_STATE_RENEWING
= 6,
80 DHCP_STATE_REBINDING
= 7,
81 DHCP_STATE_STOPPED
= 8,
84 typedef enum DHCPState DHCPState
;
104 DHCP_OVERLOAD_FILE
= 1,
105 DHCP_OVERLOAD_SNAME
= 2,
108 #define DHCP_MAX_FQDN_LENGTH 255
111 DHCP_FQDN_FLAG_S
= (1 << 0),
112 DHCP_FQDN_FLAG_O
= (1 << 1),
113 DHCP_FQDN_FLAG_E
= (1 << 2),
114 DHCP_FQDN_FLAG_N
= (1 << 3),