• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
3  *
4  * UniProton is licensed under Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *          http://license.coscl.org.cn/MulanPSL2
8  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11  * See the Mulan PSL v2 for more details.
12  * Create: 2022-09-21
13  * Description: 网络
14  */
15 #include "lwip/netdb.h"
16 
17 #if LWIP_DNS && LWIP_SOCKET
18 
gethostbyname(const char * name)19 struct hostent *gethostbyname(const char *name)
20 {
21     if (name == NULL) {
22         return NULL;
23     }
24     return lwip_gethostbyname(name);
25 }
26 
gethostbyname_r(const char * name,struct hostent * ret,char * buf,size_t buflen,struct hostent ** result,int * h_errnop)27 int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen,
28                                 struct hostent **result, int *h_errnop)
29 {
30     return lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop);
31 }
32 
freeaddrinfo(struct addrinfo * res)33 void freeaddrinfo(struct addrinfo *res)
34 {
35     lwip_freeaddrinfo(res);
36 }
37 
getaddrinfo(const char * restrict nodename,const char * restrict servname,const struct addrinfo * restrict hints,struct addrinfo ** restrict res)38 int getaddrinfo(const char *restrict nodename, const char *restrict servname,
39                             const struct addrinfo *restrict hints, struct addrinfo **restrict res)
40 {
41     return lwip_getaddrinfo(nodename, servname, hints, res);
42 }
43 
44 #endif
45