20 #ifndef NET_SYSCALLS_H 21 #define NET_SYSCALLS_H 25 #include "pedigree/kernel/process/Mutex.h" 26 #include "pedigree/kernel/utilities/List.h" 27 #include "pedigree/kernel/utilities/String.h" 28 #include "pedigree/kernel/utilities/Tree.h" 30 #include "modules/subsys/posix/UnixFilesystem.h" 33 #include <sys/types.h> 60 virtual int connect(
const struct sockaddr *address, socklen_t addrlen) = 0;
62 virtual ssize_t sendto_msg(
const struct msghdr *msghdr) = 0;
63 virtual ssize_t recvfrom_msg(
struct msghdr *msghdr) = 0;
65 virtual ssize_t sendto(
66 const void *buffer,
size_t bufferlen,
int flags,
67 const struct sockaddr *address, socklen_t addrlen);
68 virtual ssize_t recvfrom(
69 void *buffer,
size_t bufferlen,
int flags,
struct sockaddr *address,
72 virtual int listen(
int backlog) = 0;
73 virtual int bind(
const struct sockaddr *address, socklen_t addrlen) = 0;
74 virtual int accept(
struct sockaddr *address, socklen_t *addrlen) = 0;
76 virtual int shutdown(
int how);
79 getpeername(
struct sockaddr *address, socklen_t *address_len) = 0;
81 getsockname(
struct sockaddr *address, socklen_t *address_len) = 0;
83 virtual int setsockopt(
84 int level,
int optname,
const void *optvalue, socklen_t optlen) = 0;
86 getsockopt(
int level,
int optname,
void *optvalue, socklen_t *optlen) = 0;
88 virtual bool canPoll()
const;
89 virtual bool poll(
bool &read,
bool &write,
bool &error,
Semaphore *waiter);
92 virtual bool monitor(
Thread *pThread,
Event *pEvent);
93 virtual bool unmonitor(
Event *pEvent);
107 int getProtocol()
const 117 bool isBlocking()
const;
119 void setBlocking(
bool blocking);
139 virtual int connect(
const struct sockaddr *address, socklen_t addrlen);
141 virtual ssize_t sendto_msg(
const struct msghdr *msghdr);
142 virtual ssize_t recvfrom_msg(
struct msghdr *msghdr);
144 virtual int listen(
int backlog);
145 virtual int bind(
const struct sockaddr *address, socklen_t addrlen);
146 virtual int accept(
struct sockaddr *address, socklen_t *addrlen);
148 virtual int shutdown(
int how);
150 virtual int getpeername(
struct sockaddr *address, socklen_t *address_len);
151 virtual int getsockname(
struct sockaddr *address, socklen_t *address_len);
154 setsockopt(
int level,
int optname,
const void *optvalue, socklen_t optlen);
156 getsockopt(
int level,
int optname,
void *optvalue, socklen_t *optlen);
158 virtual bool canPoll()
const;
159 virtual bool poll(
bool &read,
bool &write,
bool &error,
Semaphore *waiter);
166 netconnCallback(
struct netconn *conn,
enum netconn_evt evt, uint16_t len);
167 static void lwipToSyscallError(
err_t err);
169 struct netconn *m_Socket;
196 virtual int connect(
const struct sockaddr *address, socklen_t addrlen);
198 virtual ssize_t sendto_msg(
const struct msghdr *msghdr);
199 virtual ssize_t recvfrom_msg(
struct msghdr *msghdr);
201 virtual int listen(
int backlog);
202 virtual int bind(
const struct sockaddr *address, socklen_t addrlen);
203 virtual int accept(
struct sockaddr *address, socklen_t *addrlen);
205 virtual int shutdown(
int how);
207 virtual int getpeername(
struct sockaddr *address, socklen_t *address_len);
208 virtual int getsockname(
struct sockaddr *address, socklen_t *address_len);
211 setsockopt(
int level,
int optname,
const void *optvalue, socklen_t optlen);
213 getsockopt(
int level,
int optname,
void *optvalue, socklen_t *optlen);
215 virtual bool canPoll()
const;
216 virtual bool poll(
bool &read,
bool &write,
bool &error,
Semaphore *waiter);
219 virtual bool monitor(
Thread *pThread,
Event *pEvent);
220 virtual bool unmonitor(
Event *pEvent);
232 UnixSocket::SocketType getSocketType()
const;
242 struct netconnMetadata *getNetconnMetadata(
struct netconn *conn);
244 int posix_socket(
int domain,
int type,
int protocol);
245 int posix_socketpair(
int domain,
int type,
int protocol,
int sv[2]);
246 int posix_connect(
int sock,
const struct sockaddr *address, socklen_t addrlen);
248 ssize_t posix_send(
int sock,
const void *buff,
size_t bufflen,
int flags);
249 ssize_t posix_sendto(
250 int sock,
const void *buff,
size_t bufflen,
int flags,
251 struct sockaddr *address, socklen_t addrlen);
252 ssize_t posix_recv(
int sock,
void *buff,
size_t bufflen,
int flags);
253 ssize_t posix_recvfrom(
254 int sock,
void *buff,
size_t bufflen,
int flags,
struct sockaddr *address,
257 int posix_listen(
int sock,
int backlog);
258 int posix_bind(
int sock,
const struct sockaddr *address, socklen_t addrlen);
259 int posix_accept(
int sock,
struct sockaddr *address, socklen_t *addrlen);
261 int posix_shutdown(
int socket,
int how);
263 int posix_getpeername(
264 int socket,
struct sockaddr *address, socklen_t *address_len);
265 int posix_getsockname(
266 int socket,
struct sockaddr *address, socklen_t *address_len);
268 int posix_setsockopt(
269 int sock,
int level,
int optname,
const void *optvalue, socklen_t optlen);
270 int posix_getsockopt(
271 int sock,
int level,
int optname,
void *optvalue, socklen_t *optlen);
273 int posix_sethostname(
const char *name,
size_t len);
275 ssize_t posix_sendmsg(
int sockfd,
const struct msghdr *msg,
int flags);
276 ssize_t posix_recvmsg(
int sockfd,
struct msghdr *msg,
int flags);