sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
dhcp.h
Go to the documentation of this file.
1
6
7
/*
8
* Copyright (c) 2001-2004 Leon Woestenberg <leon.woestenberg@gmx.net>
9
* Copyright (c) 2001-2004 Axon Digital Design B.V., The Netherlands.
10
* All rights reserved.
11
*
12
* Redistribution and use in source and binary forms, with or without modification,
13
* are permitted provided that the following conditions are met:
14
*
15
* 1. Redistributions of source code must retain the above copyright notice,
16
* this list of conditions and the following disclaimer.
17
* 2. Redistributions in binary form must reproduce the above copyright notice,
18
* this list of conditions and the following disclaimer in the documentation
19
* and/or other materials provided with the distribution.
20
* 3. The name of the author may not be used to endorse or promote products
21
* derived from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
24
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
26
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
28
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
31
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
32
* OF SUCH DAMAGE.
33
*
34
* This file is part of the lwIP TCP/IP stack.
35
*
36
* Author: Leon Woestenberg <leon.woestenberg@gmx.net>
37
*
38
*/
39
#ifndef LWIP_HDR_DHCP_H
40
#define LWIP_HDR_DHCP_H
41
42
#include "
lwip/opt.h
"
43
44
#if LWIP_DHCP
/* don't build if not configured for use in lwipopts.h */
45
46
#include "
lwip/netif.h
"
47
#include "
lwip/udp.h
"
48
49
#if LWIP_DHCP_DOES_ACD_CHECK
50
#include "
lwip/acd.h
"
51
#endif
/* LWIP_DHCP_DOES_ACD_CHECK */
52
53
#ifdef __cplusplus
54
extern
"C"
{
55
#endif
56
59
#ifdef DHCP_TIMEOUT_SIZE_T
60
typedef
DHCP_TIMEOUT_SIZE_T dhcp_timeout_t;
61
#else
/* DHCP_TIMEOUT_SIZE_T */
62
typedef
u16_t dhcp_timeout_t;
63
#endif
/* DHCP_TIMEOUT_SIZE_T*/
65
#ifndef DHCP_COARSE_TIMER_SECS
66
#define DHCP_COARSE_TIMER_SECS 60
67
#endif
/* DHCP_COARSE_TIMER_SECS */
69
#define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL)
71
#define DHCP_FINE_TIMER_MSECS 500
72
73
#define DHCP_BOOT_FILE_LEN 128U
74
75
#define DHCP_FLAG_SUBNET_MASK_GIVEN 0x01
76
#define DHCP_FLAG_EXTERNAL_MEM 0x02
77
78
/* AutoIP cooperation flags (struct dhcp.autoip_coop_state) */
79
typedef
enum
{
80
DHCP_AUTOIP_COOP_STATE_OFF = 0,
81
DHCP_AUTOIP_COOP_STATE_ON = 1
82
} dhcp_autoip_coop_state_enum_t;
83
84
struct
dhcp
85
{
87
u32_t xid;
89
u8_t pcb_allocated;
91
u8_t state;
93
u8_t tries;
95
u8_t flags;
96
97
dhcp_timeout_t request_timeout;
/* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */
98
dhcp_timeout_t t1_timeout;
/* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */
99
dhcp_timeout_t t2_timeout;
/* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */
100
dhcp_timeout_t t1_renew_time;
/* #ticks with period DHCP_COARSE_TIMER_SECS until next renew try */
101
dhcp_timeout_t t2_rebind_time;
/* #ticks with period DHCP_COARSE_TIMER_SECS until next rebind try */
102
dhcp_timeout_t lease_used;
/* #ticks with period DHCP_COARSE_TIMER_SECS since last received DHCP ack */
103
dhcp_timeout_t t0_timeout;
/* #ticks with period DHCP_COARSE_TIMER_SECS for lease time */
104
ip_addr_t server_ip_addr;
/* dhcp server address that offered this lease (ip_addr_t because passed to UDP) */
105
ip4_addr_t
offered_ip_addr;
106
ip4_addr_t
offered_sn_mask;
107
ip4_addr_t
offered_gw_addr;
108
109
u32_t offered_t0_lease;
/* lease period (in seconds) */
110
u32_t offered_t1_renew;
/* recommended renew time (usually 50% of lease period) */
111
u32_t offered_t2_rebind;
/* recommended rebind time (usually 87.5 of lease period) */
112
#if LWIP_DHCP_BOOTP_FILE
113
ip4_addr_t
offered_si_addr;
114
char
boot_file_name[DHCP_BOOT_FILE_LEN];
115
#endif
/* LWIP_DHCP_BOOTPFILE */
116
#if LWIP_DHCP_DOES_ACD_CHECK
118
struct
acd acd;
119
#endif
/* LWIP_DHCP_DOES_ACD_CHECK */
120
};
121
122
123
void
dhcp_set_struct(
struct
netif
*
netif
,
struct
dhcp *dhcp);
125
#define dhcp_remove_struct(netif) netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, NULL)
126
void
dhcp_cleanup(
struct
netif
*
netif
);
127
err_t dhcp_start(
struct
netif
*
netif
);
128
err_t dhcp_renew(
struct
netif
*
netif
);
129
err_t dhcp_release(
struct
netif
*
netif
);
130
void
dhcp_stop(
struct
netif
*
netif
);
131
void
dhcp_release_and_stop(
struct
netif
*
netif
);
132
void
dhcp_inform(
struct
netif
*
netif
);
133
void
dhcp_network_changed_link_up(
struct
netif
*
netif
);
134
135
u8_t dhcp_supplied_address(
const
struct
netif
*
netif
);
136
/* to be called every minute */
137
void
dhcp_coarse_tmr(
void
);
138
/* to be called every half second */
139
void
dhcp_fine_tmr(
void
);
140
141
#if LWIP_DHCP_GET_NTP_SRV
145
extern
void
dhcp_set_ntp_servers(u8_t num_ntp_servers,
const
ip4_addr_t
* ntp_server_addrs);
146
#endif
/* LWIP_DHCP_GET_NTP_SRV */
147
148
#define netif_dhcp_data(netif) ((struct dhcp*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP))
149
150
#ifdef __cplusplus
151
}
152
#endif
153
154
#endif
/* LWIP_DHCP */
155
156
#endif
/*LWIP_HDR_DHCP_H*/
acd.h
netif.h
opt.h
ip4_addr_t
struct ip4_addr ip4_addr_t
Definition
ps2ip_rpc.h:41
netif
Definition
tcpip.h:1271
udp.h
core
ps2ip
include
lwip_include
lwip
dhcp.h
Generated by
1.18.0