]> git.proxmox.com Git - mirror_ovs.git/blob - lib/dhcp.h
ovsdb-idl: Fix iteration over tracked rows with no actual data.
[mirror_ovs.git] / lib / dhcp.h
1 /*
2 * Copyright (c) 2008, 2011 Nicira, Inc.
3 *
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:
7 *
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.
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
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
28 #define DHCP_MAGIC_COOKIE 0x63825363
29
30 #define DHCP_HEADER_LEN 236
31 OVS_PACKED(
32 struct 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. */
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. */
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. */
48 });
49 BUILD_ASSERT_DECL(DHCP_HEADER_LEN == sizeof(struct dhcp_header));
50
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
58 #define DHCP_MSG_NAK 6
59
60 #define DHCP_OPT_PAD 0
61 #define DHCP_OPT_REQ_IP 50
62 #define DHCP_OPT_MSG_TYPE 53
63 #define DHCP_OPT_END 255
64
65 #endif /* dhcp.h */