!379 修改inet_addr等宏为函数,外层调用可不包含lwip头文件

Merge pull request !379 from 刘建东/cherry-pick-1635579054
This commit is contained in:
openharmony_ci 2021-10-30 08:57:44 +00:00 committed by Gitee
commit 792b131d55
2 changed files with 21 additions and 3 deletions

View File

@ -43,9 +43,6 @@
(ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
/* directly map this to the lwip internal functions */
#define inet_addr(cp) ipaddr_addr(cp)
#define inet_aton(cp, addr) ip4addr_aton(cp, (ip4_addr_t*)addr)
#define inet_ntoa(addr) ip4addr_ntoa((const ip4_addr_t*)&(addr))
#define inet_ntoa_r(addr, buf, buflen) ip4addr_ntoa_r((const ip4_addr_t*)&(addr), buf, buflen)
#endif /* LWIP_IPV4 */
#if LWIP_IPV6

View File

@ -161,6 +161,27 @@ int inet_pton(int af, const char *src, void *dst)
return lwip_inet_pton(af, src, dst);
}
#ifndef LWIP_INET_ADDR_FUNC
in_addr_t inet_addr(const char *cp)
{
return ipaddr_addr(cp);
}
#endif
#ifndef LWIP_INET_NTOA_FUNC
char *inet_ntoa(struct in_addr addr)
{
return ip4addr_ntoa((const ip4_addr_t*)&(addr));
}
#endif
#ifndef LWIP_INET_ATON_FUNC
int inet_aton(const char *cp, struct in_addr *addr)
{
return ip4addr_aton(cp, (ip4_addr_t*)addr);
}
#endif
int ioctlsocket(int s, long cmd, void *argp)
{
return lwip_ioctl(s, cmd, argp);