57 ERROR(
"failed to allocate UDP socket");
63 ERROR(
"failed to insert UDP socket");
68 filepath <<
"/udp/" << pos;
74 ERROR(
"failed to register UDP socket: result = " << (
int) result);
84 DEBUG(
"pid = " << pid);
106 path <<
"/udp/" << i;
110 ERROR(
"failed to unregister UDPSocket at " << *path <<
111 " for PID " << pid <<
": result = " << (
int) result);
123 DEBUG(
"port = " << port);
133 (*sock)->process(pkt);
147 " port = " << dest->
port <<
" size = " << size);
156 ERROR(
"failed to get transmit packet: result = " << (
int) result);
171 const Size needed = pkt->
size + size;
174 needed > maximum ? maximum : needed, offset);
191 DEBUG(
"port = " << port);
208 for (;remain > 0; remain -=
sizeof(
u16), ptr++)
210 if (remain ==
sizeof(
u8))
245 sum = (sum >> 16) + (sum & 0xffff);
u32 getNextInode()
Get next unused inode.
FileSystem::Result unregisterFile(const char *path)
Remove a File from the FileSystemServer.
const char * getMountPath() const
Get mount path.
FileSystem::Result registerDirectory(Directory *dir, const char *path)
Register a new Directory.
FileSystem::Result registerFile(File *file, const char *path)
Register a new File.
Iterate through a HashTable.
virtual bool hasCurrent() const
Check if there is a current item.
virtual const V * get(const K &key) const
Returns the first value for the given key.
virtual bool insert(const K &key, const V &value)
Inserts the given item to the HashTable.
Abstract Input/Output buffer.
FileSystem::Result read(void *buffer, const Size size, const Size offset=ZERO)
Read bytes from the I/O buffer.
static const String toString(const Address address)
Convert address to string.
virtual bool insert(Size &position, T *item)
Adds the given item, if possible.
virtual bool remove(const Size position)
Removes the item at the given position.
Network Device abstract class.
virtual FileSystem::Result transmit(NetworkQueue::Packet *packet)=0
Add a network packet to the transmit queue.
Network protocol abstraction class.
NetworkProtocol & m_parent
Parent upper-layer protocol instance.
NetworkDevice & m_device
Network device instance.
virtual FileSystem::Result getTransmitPacket(NetworkQueue::Packet **pkt, const void *address, const Size addressSize, const Identifier protocol, const Size payloadSize)
Get a new packet for transmission.
NetworkServer & m_server
Network server instance.
virtual const Size getMaximumPacketSize() const
Get maximum packet size.
ProcessID getProcessID() const
Get owner ProcessID.
User Datagram Protocol (UDP).
User Datagram Protocol (UDP) socket.
static const u16 checksum(const IPV4::Header *ip, const Header *header, const Size datalen)
Calculate ICMP checksum.
FileSystem::Result sendPacket(const NetworkClient::SocketInfo *src, const NetworkClient::SocketInfo *dest, IOBuffer &buffer, const Size size, const Size offset)
Send packet.
UDPFactory * m_factory
Factory for creating new UDP sockets.
UDPSocket * createSocket(String &path, const ProcessID pid)
Creates an UDP socket.
static const ulong calculateSum(const u16 *ptr, const Size bytes)
Calculate sum of artibrary data.
void unregisterSockets(const ProcessID pid)
Remove sockets for a process.
FileSystem::Result bind(UDPSocket *sock, const u16 port)
Bind to UDP port.
virtual FileSystem::Result initialize()
Perform initialization.
Index< UDPSocket, MaxUdpSockets > m_sockets
Contains all UDP sockets.
virtual ~UDP()
Destructor.
static const Size MaxUdpSockets
HashTable< u16, UDPSocket * > m_ports
Maps UDP ports to UDP sockets.
virtual FileSystem::Result process(const NetworkQueue::Packet *pkt, const Size offset)
Process incoming network packet.
u32 ProcessID
Process Identification Number.
const u32 read32(const void *data)
Read 32-bit integer (no conversion)
#define ERROR(msg)
Output an error message.
#define be16_to_cpu(x)
Big endian 16-bit to CPU byte order.
unsigned long ulong
Unsigned long number.
unsigned int uint
Unsigned integer number.
const u16 read16(const void *data)
Read 16-bit integer (no conversion)
unsigned short u16
Unsigned 16-bit number.
void write16(void *data, const u16 input)
Write 16-bit integer (no conversion)
unsigned int Size
Any sane size indicator cannot go negative.
const u8 read8(const void *data)
Read 8-bit integer.
void writeBe16(void *data, const u16 input)
Write 16-bit big endian integer.
#define DEBUG(msg)
Output a debug message to standard output.
unsigned char u8
Unsigned 8-bit number.
Result
Result code for filesystem Actions.
Represents a network packet.