]> git.proxmox.com Git - ovs.git/blame - lib/dhcp.h
compat: Add ipv6 GRE and IPV6 Tunneling
[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
BP
30#define DHCP_HEADER_LEN 236
31struct dhcp_header {
32 uint8_t op; /* DHCP_BOOTREQUEST or DHCP_BOOTREPLY. */
33 uint8_t htype; /* ARP_HRD_ETHERNET (typically). */
34 uint8_t hlen; /* ETH_ADDR_LEN (typically). */
35 uint8_t hops; /* Hop count; set to 0 by client. */
dbba996b
BP
36 ovs_be32 xid; /* Transaction ID. */
37 ovs_be16 secs; /* Since client started address acquisition. */
38 ovs_be16 flags; /* DHCP_FLAGS_*. */
39 ovs_be32 ciaddr; /* Client IP, if it has a lease for one. */
40 ovs_be32 yiaddr; /* Client ("your") IP address. */
41 ovs_be32 siaddr; /* Next server IP address. */
42 ovs_be32 giaddr; /* Relay agent IP address. */
064af421
BP
43 uint8_t chaddr[16]; /* Client hardware address. */
44 char sname[64]; /* Optional server host name. */
45 char file[128]; /* Boot file name. */
46 /* Followed by variable-length options field. */
47};
48BUILD_ASSERT_DECL(DHCP_HEADER_LEN == sizeof(struct dhcp_header));
49
42814145
NS
50#define DHCP_OP_REQUEST 1
51#define DHCP_OP_REPLY 2
52
53#define DHCP_MSG_DISCOVER 1
54#define DHCP_MSG_OFFER 2
55#define DHCP_MSG_REQUEST 3
56#define DHCP_MSG_ACK 5
57
58#define DHCP_OPT_MSG_TYPE 53
59#define DHCP_OPT_END 255
60
064af421 61#endif /* dhcp.h */