SOCU:getaddrinfo

SOCU:getaddrinfo

 int socu_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res, addrinfo_3ds_t *info, s32 info_count, s32 * count)

This function will store each result entry in the form of the following structure :

struct addrinfo_3ds_t
{
   s32                     ai_flags;
   s32                     ai_family;
   s32                     ai_socktype;
   s32                     ai_protocol;
   u32                     ai_addrlen;
   char                    ai_canonname[256];
   struct sockaddr_storage ai_addr;
};

Its size is 0x130.

Note that the command will simply fill whatever it can, but never issue any error if there isn’t enough memory provided to store those entries. However, the count of entries will always hold the correct value, that way you can reallocate memory and call the function again.

Request #

Index WordDescription
0Header code [0x00F0106]
10 if node is NULL, strlen(node)+1 otherwise
20 if service is NULL, strlen(service)+1 otherwise
30 if hints is NULL, sizeof(struct addrinfo) otherwise
4sizeof(addrinfo_3ds_t) * info_count
5(value used for word 1) <<14 | 5 << 10 | 2 // IPC_Desc_StaticBuffer(cmdbuf[1], 5)
6node
7(value used for word 2) <<14 | 6 << 10 | 2 // IPC_Desc_StaticBuffer(cmdbuf[2], 6)
8service
9(value used for word 3) <<14 | 7 << 10 | 2 // IPC_Desc_StaticBuffer(cmdbuf[3], 7)
10hints

Thread Static Buffers #

Index WordDescription
0(sizeof(addrinfo_3ds_t) * info_count) <<14 // IPC_Desc_StaticBuffer(sizeof(addrinfo_3ds_t) * info_count, 0)
1info

Response #

Index WordDescription
0Header code
1Result code
2POSIX return value
3count (number of entries available)

Known error codes #

Error nameValue
EAI_FAMILY-303
EAI_MEMORY-304
EAI_NONAME-305
EAI_SOCKTYPE-307