libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
bsd.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include<libtransistor/types.h>
14 #include<sys/types.h>
15 #include<sys/socket.h>
16 #include<netinet/in.h>
17 #include<netdb.h>
18 #include<poll.h>
19 
20 extern result_t bsd_result;
21 extern int bsd_errno;
22 
24  struct addrinfo ai;
25  struct sockaddr_in addr;
26  char canonname[256];
27 };
28 
29 result_t bsd_init();
30 result_t bsd_init_ex(bool require_override, loader_config_socket_service_t service);
31 
32 const char *bsd_get_socket_service_name();
33 handle_t bsd_get_socket_service_handle();
34 loader_config_socket_service_t bsd_get_socket_service();
35 
36 int bsd_socket(int domain, int type, int protocol);
37 int bsd_recv(int socket, void *message, size_t length, int flags);
38 int bsd_send(int socket, const void *data, size_t length, int flags);
39 int bsd_sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len);
40 int bsd_accept(int socket, struct sockaddr *address, socklen_t *address_len);
41 int bsd_bind(int socket, const struct sockaddr *address, socklen_t address_len);
42 int bsd_connect(int socket, const struct sockaddr *address, socklen_t address_len);
43 int bsd_getsockname(int socket, struct sockaddr *address, socklen_t *address_len);
44 int bsd_listen(int socket, int backlog);
45 int bsd_setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
46 int bsd_shutdown(int socket, int how);
47 int bsd_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
48 int bsd_poll(struct pollfd *fds, int nfds, int timeout);
49 int bsd_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
50 int bsd_getaddrinfo_fixed(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo_fixed *res, int num_addrinfos);
51 void bsd_freeaddrinfo(struct addrinfo *res);
52 int bsd_close(int socket);
53 void bsd_finalize();
54 
55 result_t bsd_ai_pack(const struct addrinfo *ai, uint8_t *buf, size_t size);
56 result_t bsd_ai_unpack(struct addrinfo *ai, const uint8_t *buf, size_t size, int limit);
57 
58 #ifdef __cplusplus
59 }
60 #endif
Various system types.
Homebrew ABI configuration.
Definition: bsd.h:23
uint32_t result_t
Function result.
Definition: types.h:51
uint32_t handle_t
Resource handle.
Definition: types.h:38