Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
75829169
Commit
75829169
authored
Jul 28, 2021
by
Johny Mattsson
Browse files
Support building without IPv6 enabled.
parent
c8e1c44c
Changes
2
Show whitespace changes
Inline
Side-by-side
components/base_nodemcu/include/ip_fmt.h
View file @
75829169
...
@@ -46,10 +46,13 @@ void macstr (char *out, const uint8_t *mac);
...
@@ -46,10 +46,13 @@ void macstr (char *out, const uint8_t *mac);
#define IP_STR_SZ (8*4+7+1)
#define IP_STR_SZ (8*4+7+1)
void
ipstr
(
char
*
out
,
const
ip_addr_t
*
ip
);
void
ipstr
(
char
*
out
,
const
ip_addr_t
*
ip
);
void
ip4str
(
char
*
out
,
const
ip4_addr_t
*
ip
);
void
ip4str
(
char
*
out
,
const
ip4_addr_t
*
ip
);
void
ip6str
(
char
*
out
,
const
ip6_addr_t
*
ip
);
void
ipstr_esp
(
char
*
out
,
const
esp_ip_addr_t
*
ip
);
void
ipstr_esp
(
char
*
out
,
const
esp_ip_addr_t
*
ip
);
void
ip4str_esp
(
char
*
out
,
const
esp_ip4_addr_t
*
ip
);
void
ip4str_esp
(
char
*
out
,
const
esp_ip4_addr_t
*
ip
);
#ifdef CONFIG_LWIP_IPV6
void
ip6str
(
char
*
out
,
const
ip6_addr_t
*
ip
);
void
ip6str_esp
(
char
*
out
,
const
esp_ip6_addr_t
*
ip
);
void
ip6str_esp
(
char
*
out
,
const
esp_ip6_addr_t
*
ip
);
#endif
#endif
#endif
components/base_nodemcu/ip_fmt.c
View file @
75829169
...
@@ -41,27 +41,35 @@ void macstr (char *str, const uint8_t *mac)
...
@@ -41,27 +41,35 @@ void macstr (char *str, const uint8_t *mac)
}
}
void
ipstr
(
char
*
out
,
const
ip_addr_t
*
ip
)
void
ip4str
(
char
*
out
,
const
ip4_addr_t
*
ip
)
{
{
if
(
ip
->
type
==
IPADDR_TYPE_V4
)
ip4addr_ntoa_r
(
ip
,
out
,
IP_STR_SZ
);
ip4str
(
out
,
&
ip
->
u_addr
.
ip4
);
else
if
(
ip
->
type
==
IPADDR_TYPE_V6
)
ip6str
(
out
,
&
ip
->
u_addr
.
ip6
);
}
}
void
ip4str
(
char
*
out
,
const
ip4_addr_t
*
ip
)
void
ip4str_esp
(
char
*
out
,
const
esp_ip4_addr_t
*
ip
)
{
{
ip4addr_ntoa
_r
(
ip
,
out
,
IP_STR_SZ
);
esp_
ip4addr_ntoa
(
ip
,
out
,
IP_STR_SZ
);
}
}
#ifdef CONFIG_LWIP_IPV6
void
ipstr
(
char
*
out
,
const
ip_addr_t
*
ip
)
{
if
(
ip
->
type
==
IPADDR_TYPE_V4
)
ip4str
(
out
,
&
ip
->
u_addr
.
ip4
);
else
if
(
ip
->
type
==
IPADDR_TYPE_V6
)
ip6str
(
out
,
&
ip
->
u_addr
.
ip6
);
}
void
ip6str
(
char
*
out
,
const
ip6_addr_t
*
ip
)
void
ip6str
(
char
*
out
,
const
ip6_addr_t
*
ip
)
{
{
ip6addr_ntoa_r
(
ip
,
out
,
IP_STR_SZ
);
ip6addr_ntoa_r
(
ip
,
out
,
IP_STR_SZ
);
}
}
void
ipstr_esp
(
char
*
out
,
const
esp_ip_addr_t
*
ip
)
void
ipstr_esp
(
char
*
out
,
const
esp_ip_addr_t
*
ip
)
{
{
if
(
ip
->
type
==
ESP_IPADDR_TYPE_V4
)
if
(
ip
->
type
==
ESP_IPADDR_TYPE_V4
)
...
@@ -70,14 +78,21 @@ void ipstr_esp (char *out, const esp_ip_addr_t *ip)
...
@@ -70,14 +78,21 @@ void ipstr_esp (char *out, const esp_ip_addr_t *ip)
ip6str
(
out
,
&
ip
->
u_addr
.
ip6
);
ip6str
(
out
,
&
ip
->
u_addr
.
ip6
);
}
}
void
ip6str_esp
(
char
*
out
,
const
esp_ip6_addr_t
*
ip
)
void
ip4str_esp
(
char
*
out
,
const
esp_ip4_addr_t
*
ip
)
{
{
esp_
ip
4
addr_ntoa
(
ip
,
out
,
IP_STR_SZ
);
ip
6
addr_ntoa
_r
((
ip6_addr_t
*
)
ip
,
out
,
IP_STR_SZ
);
}
}
#else
void
ip
6
str
_esp
(
char
*
out
,
const
esp_
ip
6
_addr_t
*
ip
)
void
ipstr
(
char
*
out
,
const
ip_addr_t
*
ip
)
{
{
ip
6addr_ntoa_r
((
ip6_addr_t
*
)
ip
,
out
,
IP_STR_SZ
);
ip
4str
(
out
,
ip
);
}
}
void
ipstr_esp
(
char
*
out
,
const
esp_ip_addr_t
*
ip
)
{
ip4str_esp
(
out
,
ip
);
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment