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