add lwIP TCP/IP stack as a runtime driver, native socket syscalls, SysGetMemoryStatus replacing CatchAllDebugBucket, fix timeGetTime to return milliseconds, fix SysSleep to interpret argument as milliseconds, SysGetTick now returns microseconds, harden all syscalls against bad user pointers with CopyFromUser/CopyToUser/MmProbeUser throughout, add networking test apps, port-forward 8080 in runa.bat, split LWIP_DRIVER_CFLAGS, add settings.ini to deploy, remove ethernet.c stub
This commit is contained in:
1 parent
18b4dd0f61
commit
df13b8056c
365 files changed
+143263
-1362
No files matched your search
@@ -18,6 +18,21 @@
|
||||
#ifdef ENOSYS
|
||||
#undef ENOSYS
|
||||
#endif
|
||||
#ifdef EWOULDBLOCK
|
||||
#undef EWOULDBLOCK
|
||||
#endif
|
||||
#ifdef EINPROGRESS
|
||||
#undef EINPROGRESS
|
||||
#endif
|
||||
#ifdef ETIMEDOUT
|
||||
#undef ETIMEDOUT
|
||||
#endif
|
||||
#ifdef ECONNRESET
|
||||
#undef ECONNRESET
|
||||
#endif
|
||||
#ifdef ENOTSOCK
|
||||
#undef ENOTSOCK
|
||||
#endif
|
||||
extern int errno; // defined in posix_fd.c; single global in v1
|
||||
|
||||
#define EPERM 1
|
||||
@@ -37,7 +52,12 @@ extern int errno; // defined in posix_fd.c; single global in v1
|
||||
#define ENOSPC 28
|
||||
#define ERANGE 34
|
||||
#define EAGAIN 35
|
||||
#define EWOULDBLOCK EAGAIN
|
||||
#define ENOSYS 38
|
||||
#define ENOTSOCK 88
|
||||
#define EINPROGRESS 115
|
||||
#define ETIMEDOUT 116
|
||||
#define ECONNRESET 104
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// open() flags
|
||||
@@ -64,6 +84,117 @@ typedef int32_t off_t;
|
||||
typedef uint32_t mode_t;
|
||||
typedef int64_t ssize_t;
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Sockets
|
||||
// ---------------------------------------------------------------------------
|
||||
typedef uint16_t sa_family_t;
|
||||
typedef uint16_t in_port_t;
|
||||
typedef uint32_t in_addr_t;
|
||||
typedef uint32_t socklen_t;
|
||||
|
||||
#define AF_INET 2
|
||||
#define PF_INET AF_INET
|
||||
#define SOCK_STREAM 1
|
||||
#define SOCK_DGRAM 2
|
||||
#define SOCK_RAW 3
|
||||
#define IPPROTO_ICMP 1
|
||||
#define IPPROTO_TCP 6
|
||||
#define IPPROTO_UDP 17
|
||||
|
||||
#define SHUT_RD 0
|
||||
#define SHUT_WR 1
|
||||
#define SHUT_RDWR 2
|
||||
|
||||
#define SOL_SOCKET 1
|
||||
#define SO_RCVTIMEO 1
|
||||
#define SO_SNDTIMEO 2
|
||||
#define SO_NONBLOCK 3
|
||||
|
||||
#define INADDR_ANY ((in_addr_t)0x00000000u)
|
||||
#define INADDR_NONE ((in_addr_t)0xFFFFFFFFu)
|
||||
|
||||
struct in_addr {
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
|
||||
struct sockaddr {
|
||||
sa_family_t sa_family;
|
||||
char sa_data[14];
|
||||
};
|
||||
|
||||
struct sockaddr_in {
|
||||
sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
char sin_zero[8];
|
||||
};
|
||||
|
||||
struct hostent {
|
||||
char* h_name;
|
||||
char** h_aliases;
|
||||
int h_addrtype;
|
||||
int h_length;
|
||||
char** h_addr_list;
|
||||
};
|
||||
#define h_addr h_addr_list[0]
|
||||
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
socklen_t ai_addrlen;
|
||||
struct sockaddr* ai_addr;
|
||||
char* ai_canonname;
|
||||
struct addrinfo* ai_next;
|
||||
};
|
||||
|
||||
#define AI_PASSIVE 0x0001
|
||||
|
||||
struct pollfd {
|
||||
int fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
|
||||
#define POLLIN 0x0001
|
||||
#define POLLOUT 0x0002
|
||||
#define POLLERR 0x0004
|
||||
#define POLLHUP 0x0008
|
||||
#define POLLNVAL 0x0010
|
||||
|
||||
typedef unsigned long nfds_t;
|
||||
|
||||
typedef struct timeval {
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
} timeval;
|
||||
|
||||
__declspec(dllexport) uint16_t htons(uint16_t x);
|
||||
__declspec(dllexport) uint16_t ntohs(uint16_t x);
|
||||
__declspec(dllexport) uint32_t htonl(uint32_t x);
|
||||
__declspec(dllexport) uint32_t ntohl(uint32_t x);
|
||||
__declspec(dllexport) in_addr_t inet_addr(const char* text);
|
||||
__declspec(dllexport) char* inet_ntoa(struct in_addr in);
|
||||
|
||||
__declspec(dllexport) int socket(int domain, int type, int protocol);
|
||||
__declspec(dllexport) int bind(int fd, const struct sockaddr* addr, socklen_t addrlen);
|
||||
__declspec(dllexport) int listen(int fd, int backlog);
|
||||
__declspec(dllexport) int accept(int fd, struct sockaddr* addr, socklen_t* addrlen);
|
||||
__declspec(dllexport) int connect(int fd, const struct sockaddr* addr, socklen_t addrlen);
|
||||
__declspec(dllexport) ssize_t send(int fd, const void* buf, size_t len, int flags);
|
||||
__declspec(dllexport) ssize_t recv(int fd, void* buf, size_t len, int flags);
|
||||
__declspec(dllexport) ssize_t sendto(int fd, const void* buf, size_t len, int flags, const struct sockaddr* dest, socklen_t destlen);
|
||||
__declspec(dllexport) ssize_t recvfrom(int fd, void* buf, size_t len, int flags, struct sockaddr* src, socklen_t* srclen);
|
||||
__declspec(dllexport) int shutdown(int fd, int how);
|
||||
__declspec(dllexport) int setsockopt(int fd, int level, int optname, const void* optval, socklen_t optlen);
|
||||
__declspec(dllexport) int getsockopt(int fd, int level, int optname, void* optval, socklen_t* optlen);
|
||||
__declspec(dllexport) int poll(struct pollfd* fds, nfds_t nfds, int timeout);
|
||||
__declspec(dllexport) struct hostent* gethostbyname(const char* name);
|
||||
__declspec(dllexport) int getaddrinfo(const char* node, const char* service, const struct addrinfo* hints, struct addrinfo** res);
|
||||
__declspec(dllexport) void freeaddrinfo(struct addrinfo* res);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// pthread types
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user