netdev-dpdk: fix mbuf leaks
[cascardo/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_HEADER_LEN 236
29 struct dhcp_header {
30     uint8_t op;                 /* DHCP_BOOTREQUEST or DHCP_BOOTREPLY. */
31     uint8_t htype;              /* ARP_HRD_ETHERNET (typically). */
32     uint8_t hlen;               /* ETH_ADDR_LEN (typically). */
33     uint8_t hops;               /* Hop count; set to 0 by client. */
34     ovs_be32 xid;               /* Transaction ID. */
35     ovs_be16 secs;              /* Since client started address acquisition. */
36     ovs_be16 flags;             /* DHCP_FLAGS_*. */
37     ovs_be32 ciaddr;            /* Client IP, if it has a lease for one. */
38     ovs_be32 yiaddr;            /* Client ("your") IP address. */
39     ovs_be32 siaddr;            /* Next server IP address. */
40     ovs_be32 giaddr;            /* Relay agent IP address. */
41     uint8_t chaddr[16];         /* Client hardware address. */
42     char sname[64];             /* Optional server host name. */
43     char file[128];             /* Boot file name. */
44     /* Followed by variable-length options field. */
45 };
46 BUILD_ASSERT_DECL(DHCP_HEADER_LEN == sizeof(struct dhcp_header));
47
48 #endif /* dhcp.h */