]> git.proxmox.com Git - mirror_ovs.git/blame - lib/dhcp.h
ovsdb-idl: Fix iteration over tracked rows with no actual data.
[mirror_ovs.git] / lib / dhcp.h
CommitLineData
064af421 1/*
e0edde6f 2 * Copyright (c) 2008, 2011 Nicira, Inc.
064af421 3 *
a14bc59f
BP
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
064af421 7 *
a14bc59f
BP
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
064af421
BP
15 */
16
17#ifndef DHCP_H
18#define DHCP_H 1
19
20#include <stdint.h>
21#include "packets.h"
22#include "util.h"
23
c2fea58c
JP
24/* Ports used by DHCP. */
25#define DHCP_SERVER_PORT 67 /* Port used by DHCP server. */
26#define DHCP_CLIENT_PORT 68 /* Port used by DHCP client. */
27
42814145
NS
28#define DHCP_MAGIC_COOKIE 0x63825363
29
064af421 30#define DHCP_HEADER_LEN 236
a550795a 31OVS_PACKED(
064af421
BP
32struct dhcp_header {
33 uint8_t op; /* DHCP_BOOTREQUEST or DHCP_BOOTREPLY. */
34 uint8_t htype; /* ARP_HRD_ETHERNET (typically). */
35 uint8_t hlen; /* ETH_ADDR_LEN (typically). */
36 uint8_t hops; /* Hop count; set to 0 by client. */
dbba996b
BP
37 ovs_be32 xid; /* Transaction ID. */
38 ovs_be16 secs; /* Since client started address acquisition. */
39 ovs_be16 flags; /* DHCP_FLAGS_*. */
40 ovs_be32 ciaddr; /* Client IP, if it has a lease for one. */
41 ovs_be32 yiaddr; /* Client ("your") IP address. */
42 ovs_be32 siaddr; /* Next server IP address. */
43 ovs_be32 giaddr; /* Relay agent IP address. */
064af421
BP
44 uint8_t chaddr[16]; /* Client hardware address. */
45 char sname[64]; /* Optional server host name. */
46 char file[128]; /* Boot file name. */
47 /* Followed by variable-length options field. */
a550795a 48});
064af421
BP
49BUILD_ASSERT_DECL(DHCP_HEADER_LEN == sizeof(struct dhcp_header));
50
42814145
NS
51#define DHCP_OP_REQUEST 1
52#define DHCP_OP_REPLY 2
53
54#define DHCP_MSG_DISCOVER 1
55#define DHCP_MSG_OFFER 2
56#define DHCP_MSG_REQUEST 3
57#define DHCP_MSG_ACK 5
fcc3c93f 58#define DHCP_MSG_NAK 6
42814145 59
fcc3c93f
GS
60#define DHCP_OPT_PAD 0
61#define DHCP_OPT_REQ_IP 50
42814145
NS
62#define DHCP_OPT_MSG_TYPE 53
63#define DHCP_OPT_END 255
64
064af421 65#endif /* dhcp.h */