sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
netdb.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
11#define LIBCGLUE_SYS_SOCKET_NO_ALIASES
12#define LIBCGLUE_ARPA_INET_NO_ALIASES
13#include <ps2sdkapi.h>
14#include <netdb.h>
15
16#include "ps2sdkapi.h"
17
18struct hostent *gethostbyaddr(const void *addr, int len, int type)
19{
20 if (_libcglue_fdman_socket_ops == NULL || _libcglue_fdman_socket_ops->gethostbyaddr == NULL)
21 {
22 return NULL;
23 }
24
25 return _libcglue_fdman_socket_ops->gethostbyaddr(addr, len, type);
26}
27
28struct hostent *gethostbyname(const char *name)
29{
30 if (_libcglue_fdman_socket_ops == NULL || _libcglue_fdman_socket_ops->gethostbyname == NULL)
31 {
32 return NULL;
33 }
34
35 return _libcglue_fdman_socket_ops->gethostbyname(name);
36}
37
38int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
39{
40 if (_libcglue_fdman_socket_ops == NULL || _libcglue_fdman_socket_ops->gethostbyname_r == NULL)
41 {
42 if (h_errnop != NULL)
43 {
44 *h_errnop = NO_RECOVERY;
45 }
46 return -1;
47 }
48
49 return _libcglue_fdman_socket_ops->gethostbyname_r(name, ret, buf, buflen, result, h_errnop);
50}
51
52void freeaddrinfo(struct addrinfo *ai)
53{
54 if (_libcglue_fdman_socket_ops == NULL || _libcglue_fdman_socket_ops->freeaddrinfo == NULL)
55 {
56 return;
57 }
58
59 return _libcglue_fdman_socket_ops->freeaddrinfo(ai);
60}
61
62int getaddrinfo(const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res)
63{
64 if (_libcglue_fdman_socket_ops == NULL || _libcglue_fdman_socket_ops->getaddrinfo == NULL)
65 {
66 return EAI_FAIL;
67 }
68
69 return _libcglue_fdman_socket_ops->getaddrinfo(nodename, servname, hints, res);
70}