Go to the documentation of this file.
56 hdr->
type <<
" code = " << hdr->
code <<
" id = " << hdr->
id);
98 ERROR(
"failed to allocate ICMP socket");
105 ERROR(
"failed to insert ICMP socket");
110 filepath <<
"/icmp/" << pos;
117 ERROR(
"failed to register ICMP socket to NetworkServer: result = " << (
int) result);
128 DEBUG(
"pid = " << pid);
137 path <<
"/icmp/" << i;
141 ERROR(
"failed to unregister ICMPSocket at " << *path <<
142 " for PID " << pid <<
": result = " << (
int) result);
151 const Size payloadSize)
154 " header.id = " <<
readBe16(&headerInput->
id) <<
" header.seq = " <<
166 ERROR(
"failed to get transmit packet: result = " << (
int) result);
178 const Size needed = pkt->
size + payloadSize;
179 const Size amount = needed > maximum ? maximum - pkt->
size : needed - pkt->
size;
Internet Control Message Protocol (ICMP) factory.
Network protocol abstraction class.
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
const u32 readBe32(const void *data)
Read 32-bit big endian integer.
const u16 readBe16(const void *data)
Read 16-bit big endian integer.
u32 getNextInode()
Get next unused inode.
Network Device abstract class.
NetworkProtocol & m_parent
Parent upper-layer protocol instance.
static const u16 checksum(const void *buffer, const Size length)
Calculate IP checksum.
static const Size MaxIcmpSockets
ICMPSocket * createSocket(String &path, const ProcessID pid)
Creates an ICMP socket.
u32 ProcessID
Process Identification Number.
FileSystem::Result unregisterFile(const char *path)
Remove a File from the FileSystemServer.
virtual FileSystem::Result process(const NetworkQueue::Packet *pkt, const Size offset)
Process incoming network packet.
NetworkDevice & m_device
Network device instance.
ProcessID getProcessID() const
Get owner ProcessID.
void write16(void *data, const u16 input)
Write 16-bit integer (no conversion)
FileSystem::Result sendPacket(const IPV4::Address ip, const Header *header, const void *payload, const Size payloadSize)
Send packet.
void setReply(const ICMP::Header *reply)
Set ICMP reply.
virtual ~ICMP()
Destructor.
const IPV4::Address getAddress() const
Get associated IP host.
#define DEBUG(msg)
Output a debug message to standard output.
virtual FileSystem::Result initialize()
Perform initialization.
virtual const Size getMaximumPacketSize() const
Get maximum packet size.
SystemDescriptorHeader header
virtual Size size() const
Size of the Index.
void unregisterSockets(const ProcessID pid)
Remove sockets for a process.
unsigned int Size
Any sane size indicator cannot go negative.
virtual T * get(const Size position) const
Returns the item at the given position.
FileSystem::Result registerDirectory(Directory *dir, const char *path)
Register a new Directory.
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.
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.
Index< ICMPSocket, MaxIcmpSockets > m_sockets
Represents a network packet.
virtual bool insert(Size &position, T *item)
Adds the given item, if possible.
struct ICMP::Header Header
Packet header format.
Internet Control Message Protocol (ICMP) socket.
FileSystem::Result registerFile(File *file, const char *path)
Register a new File.