9 #include <sys/socket.h>
10 #include <sys/select.h>
14 #include "../kernel/tmem.h"
15 #include "../sf/service.h"
54 int bsdOpen(
const char *pathname,
int flags);
55 int bsdSelect(
int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout);
56 int bsdPoll(
struct pollfd *fds, nfds_t nfds,
int timeout);
57 int bsdSysctl(
const int *name,
unsigned int namelen,
void *oldp,
size_t *oldlenp,
const void *newp,
size_t newlen);
58 ssize_t bsdRecv(
int sockfd,
void *buf,
size_t len,
int flags);
59 ssize_t bsdRecvFrom(
int sockfd,
void *buf,
size_t len,
int flags,
struct sockaddr *src_addr, socklen_t *addrlen);
60 ssize_t bsdSend(
int sockfd,
const void* buf,
size_t len,
int flags);
61 ssize_t bsdSendTo(
int sockfd,
const void *buf,
size_t len,
int flags,
const struct sockaddr *dest_addr, socklen_t addrlen);
62 int bsdAccept(
int sockfd,
struct sockaddr *addr, socklen_t *addrlen);
63 int bsdBind(
int sockfd,
const struct sockaddr *addr, socklen_t addrlen);
64 int bsdConnect(
int sockfd,
const struct sockaddr *addr, socklen_t addrlen);
65 int bsdGetPeerName(
int sockfd,
struct sockaddr *addr, socklen_t *addrlen);
66 int bsdGetSockName(
int sockfd,
struct sockaddr *addr, socklen_t *addrlen);
67 int bsdGetSockOpt(
int sockfd,
int level,
int optname,
void *optval, socklen_t *optlen);
68 int bsdListen(
int sockfd,
int backlog);
73 int bsdSetSockOpt(
int sockfd,
int level,
int optname,
const void *optval, socklen_t optlen);
74 int bsdShutdown(
int sockfd,
int how);
75 int bsdShutdownAllSockets(
int how);
76 ssize_t bsdWrite(
int fd,
const void *buf,
size_t count);
77 ssize_t bsdRead(
int fd,
void *buf,
size_t count);
81 int bsdRecvMMsg(
int sockfd,
void *buf,
size_t size,
unsigned int vlen,
int flags,
struct timespec *timeout);
82 int bsdSendMMsg(
int sockfd,
void *buf,
size_t size,
unsigned int vlen,
int flags);
Result bsdInitialize(const BsdInitConfig *config, u32 num_sessions, u32 service_type)
Initialize the BSD service.
int bsdDuplicateSocket(int sockfd)
Duplicate a socket (bsd:s).
int bsdFcntl(int fd, int cmd, int flags)
Made non-variadic for convenience.
int bsdSocket(int domain, int type, int protocol)
Creates a socket.
const BsdInitConfig * bsdGetDefaultInitConfig(void)
Fetch the default configuration for bsdInitialize.
__thread int g_bsdErrno
Last errno, per-thread.
int bsdIoctl(int fd, int request, void *data)
Made non-variadic for convenience.
Service * bsdGetServiceSession(void)
Gets the Service object for the actual BSD service session.
void bsdExit(void)
Exit the BSD service.
int bsdSocketExempt(int domain, int type, int protocol)
Like bsdSocket but the newly created socket is immediately shut down.
__thread Result g_bsdResult
Last Switch "result", per-thread.
Configuration structure for bsdInitalize.
Definition: bsd.h:18
u32 udp_rx_buf_size
Size of the UDP receive buffer (typically 0xA500 bytes).
Definition: bsd.h:30
u32 sb_efficiency
Number of buffers for each socket (standard values range from 1 to 8).
Definition: bsd.h:32
u32 tcp_tx_buf_max_size
Maximum size of the TCP transfer (send) buffer. If it is 0, the size of the buffer is fixed to its in...
Definition: bsd.h:26
size_t tmem_buffer_size
Size of the user-provided transfer memory backing buffer. Must be large enough and page-aligned.
Definition: bsd.h:22
u32 udp_tx_buf_size
Size of the UDP transfer (send) buffer (typically 0x2400 bytes).
Definition: bsd.h:29
u32 tcp_rx_buf_size
Size of the TCP receive buffer (initial or fixed).
Definition: bsd.h:25
u32 version
Observed 1 on [2.0.0+] LibAppletWeb, 2 on [3.0.0+].
Definition: bsd.h:19
void * tmem_buffer
User-provided buffer to use as backing for transfer memory. If NULL, a buffer will be allocated autom...
Definition: bsd.h:21
u32 tcp_rx_buf_max_size
Maximum size of the TCP receive buffer. If it is 0, the size of the buffer is fixed to its initial va...
Definition: bsd.h:27
u32 tcp_tx_buf_size
Size of the TCP transfer (send) buffer (initial or fixed).
Definition: bsd.h:24
Service object structure.
Definition: service.h:14
u32 Result
Function error code result type.
Definition: types.h:44
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21