xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/infineon/bcmdhd/include/bcmdhcp.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Fundamental constants relating to DHCP Protocol
3  *
4  * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
5  *
6  * Copyright (C) 1999-2017, Broadcom Corporation
7  *
8  *      Unless you and Broadcom execute a separate written software license
9  * agreement governing use of this software, this software is licensed to you
10  * under the terms of the GNU General Public License version 2 (the "GPL"),
11  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12  * following added to such license:
13  *
14  *      As a special exception, the copyright holders of this software give you
15  * permission to link this software with independent modules, and to copy and
16  * distribute the resulting executable under terms of your choice, provided that
17  * you also meet, for each linked independent module, the terms and conditions of
18  * the license of that module.  An independent module is a module which is not
19  * derived from this software.  The special exception does not apply to any
20  * modifications of the software.
21  *
22  *      Notwithstanding the above, under no circumstances may you combine this
23  * software in any way with any other Broadcom software provided under a license
24  * other than the GPL, without Broadcom's express prior written consent.
25  *
26  *
27  * <<Broadcom-WL-IPTag/Open:>>
28  *
29  * $Id$
30  */
31 
32 #ifndef _bcmdhcp_h_
33 #define _bcmdhcp_h_
34 
35 /* DHCP params */
36 #define DHCP_TYPE_OFFSET	0	/* DHCP type (request|reply) offset */
37 #define DHCP_TID_OFFSET		4	/* DHCP transition id offset */
38 #define DHCP_FLAGS_OFFSET	10	/* DHCP flags offset */
39 #define DHCP_CIADDR_OFFSET	12	/* DHCP client IP address offset */
40 #define DHCP_YIADDR_OFFSET	16	/* DHCP your IP address offset */
41 #define DHCP_GIADDR_OFFSET	24	/* DHCP relay agent IP address offset */
42 #define DHCP_CHADDR_OFFSET	28	/* DHCP client h/w address offset */
43 #define DHCP_OPT_OFFSET		236	/* DHCP options offset */
44 
45 #define DHCP_OPT_MSGTYPE	53	/* DHCP message type */
46 #define DHCP_OPT_MSGTYPE_REQ	3
47 #define DHCP_OPT_MSGTYPE_ACK	5	/* DHCP message type - ACK */
48 
49 #define DHCP_OPT_CODE_OFFSET	0	/* Option identifier */
50 #define DHCP_OPT_LEN_OFFSET	1	/* Option data length */
51 #define DHCP_OPT_DATA_OFFSET	2	/* Option data */
52 
53 #define DHCP_OPT_CODE_CLIENTID	61	/* Option identifier */
54 
55 #define DHCP_TYPE_REQUEST	1	/* DHCP request (discover|request) */
56 #define DHCP_TYPE_REPLY		2	/* DHCP reply (offset|ack) */
57 
58 #define DHCP_PORT_SERVER	67	/* DHCP server UDP port */
59 #define DHCP_PORT_CLIENT	68	/* DHCP client UDP port */
60 
61 #define DHCP_FLAG_BCAST	0x8000	/* DHCP broadcast flag */
62 
63 #define DHCP_FLAGS_LEN	2	/* DHCP flags field length */
64 
65 #define DHCP6_TYPE_SOLICIT	1	/* DHCP6 solicit */
66 #define DHCP6_TYPE_ADVERTISE	2	/* DHCP6 advertise */
67 #define DHCP6_TYPE_REQUEST	3	/* DHCP6 request */
68 #define DHCP6_TYPE_CONFIRM	4	/* DHCP6 confirm */
69 #define DHCP6_TYPE_RENEW	5	/* DHCP6 renew */
70 #define DHCP6_TYPE_REBIND	6	/* DHCP6 rebind */
71 #define DHCP6_TYPE_REPLY	7	/* DHCP6 reply */
72 #define DHCP6_TYPE_RELEASE	8	/* DHCP6 release */
73 #define DHCP6_TYPE_DECLINE	9	/* DHCP6 decline */
74 #define DHCP6_TYPE_RECONFIGURE	10	/* DHCP6 reconfigure */
75 #define DHCP6_TYPE_INFOREQ	11	/* DHCP6 information request */
76 #define DHCP6_TYPE_RELAYFWD	12	/* DHCP6 relay forward */
77 #define DHCP6_TYPE_RELAYREPLY	13	/* DHCP6 relay reply */
78 
79 #define DHCP6_TYPE_OFFSET	0	/* DHCP6 type offset */
80 
81 #define	DHCP6_MSG_OPT_OFFSET	4	/* Offset of options in client server messages */
82 #define	DHCP6_RELAY_OPT_OFFSET	34	/* Offset of options in relay messages */
83 
84 #define	DHCP6_OPT_CODE_OFFSET	0	/* Option identifier */
85 #define	DHCP6_OPT_LEN_OFFSET	2	/* Option data length */
86 #define	DHCP6_OPT_DATA_OFFSET	4	/* Option data */
87 
88 #define	DHCP6_OPT_CODE_CLIENTID	1	/* DHCP6 CLIENTID option */
89 #define	DHCP6_OPT_CODE_SERVERID	2	/* DHCP6 SERVERID option */
90 
91 #define DHCP6_PORT_SERVER	547	/* DHCP6 server UDP port */
92 #define DHCP6_PORT_CLIENT	546	/* DHCP6 client UDP port */
93 
94 #endif	/* #ifndef _bcmdhcp_h_ */
95