feat: e100e Ethernet driver, ramdisk reorganization, shell rewrite, web server/client, and more
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Socket.hpp
|
||||
* Socket descriptor table for userspace TCP access
|
||||
* Socket descriptor table for userspace TCP/UDP access
|
||||
* Copyright (c) 2025 Daniel Hammer
|
||||
*/
|
||||
|
||||
@@ -14,11 +14,14 @@ namespace Net::Socket {
|
||||
static constexpr int SOCK_UDP = 2;
|
||||
static constexpr int MAX_SOCKETS = 64;
|
||||
|
||||
struct UdpSocketState;
|
||||
|
||||
struct SocketEntry {
|
||||
bool Active;
|
||||
int Type;
|
||||
int OwnerPid;
|
||||
Tcp::Connection* TcpConn;
|
||||
UdpSocketState* UdpState;
|
||||
uint16_t LocalPort;
|
||||
};
|
||||
|
||||
@@ -45,6 +48,14 @@ namespace Net::Socket {
|
||||
// Receive data from a connected socket. Returns bytes received, 0 on close, or -1.
|
||||
int Recv(int fd, uint8_t* buf, uint32_t maxLen, int pid);
|
||||
|
||||
// Send a UDP datagram to a specific destination. Returns bytes sent or -1.
|
||||
int SendTo(int fd, const uint8_t* data, uint32_t len,
|
||||
uint32_t destIp, uint16_t destPort, int pid);
|
||||
|
||||
// Receive a UDP datagram, returning source info. Returns bytes received or -1.
|
||||
int RecvFrom(int fd, uint8_t* buf, uint32_t maxLen,
|
||||
uint32_t* srcIp, uint16_t* srcPort, int pid);
|
||||
|
||||
// Close a socket.
|
||||
void Close(int fd, int pid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user