|
FreeNOS
|
Internet Control Message Protocol (ICMP) socket. More...
#include <ICMPSocket.h>
Public Member Functions | |
| ICMPSocket (const u32 inode, ICMP *icmp, const ProcessID pid) | |
| Constructor. More... | |
| virtual | ~ICMPSocket () |
| Destructor. More... | |
| const IPV4::Address | getAddress () const |
| Get associated IP host. More... | |
| virtual FileSystem::Result | read (IOBuffer &buffer, Size &size, const Size offset) |
| Read ICMP response. More... | |
| virtual FileSystem::Result | write (IOBuffer &buffer, Size &size, const Size offset) |
| Send ICMP request. More... | |
| virtual FileSystem::Result | process (const NetworkQueue::Packet *pkt) |
| Process incoming network packet. More... | |
| void | setReply (const ICMP::Header *reply) |
| Set ICMP reply. More... | |
Public Member Functions inherited from NetworkSocket | |
| NetworkSocket (const u32 inode, const Size packetSize, const ProcessID pid) | |
| Constructor. More... | |
| virtual | ~NetworkSocket () |
| Destructor. More... | |
| ProcessID | getProcessID () const |
| Get owner ProcessID. More... | |
Public Member Functions inherited from File | |
| File (const u32 inode, const FileSystem::FileType type=FileSystem::RegularFile, const UserID uid=ZERO, const GroupID gid=ZERO) | |
| Constructor function. More... | |
| virtual | ~File () |
| Destructor function. More... | |
| u32 | getInode () const |
| Get inode number. More... | |
| FileSystem::FileType | getType () const |
| Retrieve our filetype. More... | |
| virtual FileSystem::Result | status (FileSystem::FileStat &st) |
| Retrieve file statistics. More... | |
| virtual bool | canRead () const |
| Check if the File has data ready for reading. More... | |
| virtual bool | canWrite () const |
| Check if the File can be written to. More... | |
Private Attributes | |
| ICMP * | m_icmp |
| ICMP protocol instance. More... | |
| ICMP::Header | m_reply |
| Reply. More... | |
| bool | m_gotReply |
Additional Inherited Members | |
Protected Attributes inherited from NetworkSocket | |
| const ProcessID | m_pid |
| ProcessID which owns this socket. More... | |
| NetworkQueue | m_receive |
| Receive queue. More... | |
| NetworkQueue | m_transmit |
| Transmit queue. More... | |
| NetworkClient::SocketInfo | m_info |
| Socket connection. More... | |
Protected Attributes inherited from File | |
| const u32 | m_inode |
| Inode number. More... | |
| const FileSystem::FileType | m_type |
| Type of this file. More... | |
| UserID | m_uid |
| Owner of the file. More... | |
| GroupID | m_gid |
| Group of the file. More... | |
| FileSystem::FileModes | m_access |
| Access permissions. More... | |
| Size | m_size |
| Size of the file, in bytes. More... | |
Internet Control Message Protocol (ICMP) socket.
ICMP sockets are associated with one IP-host and receive packets from that host and allow sending packets to that host.
Definition at line 42 of file ICMPSocket.h.
Constructor.
| inode | Inode number |
| icmp | ICMP object pointer |
| pid | ProcessID owning this socket |
Definition at line 25 of file ICMPSocket.cpp.
References m_gotReply, m_icmp, NetworkSocket::m_info, and MemoryBlock::set().
|
virtual |
Destructor.
Definition at line 35 of file ICMPSocket.cpp.
| const IPV4::Address ICMPSocket::getAddress | ( | ) | const |
Get associated IP host.
Definition at line 39 of file ICMPSocket.cpp.
References NetworkClient::SocketInfo::address, and NetworkSocket::m_info.
Referenced by ICMP::process().
|
virtual |
Process incoming network packet.
| pkt | Incoming packet pointer |
Implements NetworkSocket.
Definition at line 82 of file ICMPSocket.cpp.
References DEBUG, and FileSystem::Success.
|
virtual |
Read ICMP response.
| buffer | Input/Output buffer to output bytes to. |
| size | Maximum number of bytes to read on input. On output, the actual number of bytes read. |
| offset | Offset inside the file to start reading. |
Reimplemented from File.
Definition at line 44 of file ICMPSocket.cpp.
References DEBUG, m_gotReply, m_reply, FileSystem::RetryAgain, FileSystem::Success, and IOBuffer::write().
| void ICMPSocket::setReply | ( | const ICMP::Header * | reply | ) |
Set ICMP reply.
| reply | ICMP reply header |
Definition at line 89 of file ICMPSocket.cpp.
References MemoryBlock::copy(), DEBUG, header, m_gotReply, and m_reply.
Referenced by ICMP::process().
|
virtual |
Send ICMP request.
| buffer | Input/Output buffer to input bytes from. |
| size | Maximum number of bytes to write on input. On output, the actual number of bytes written. |
| offset | Offset inside the file to start writing. |
Reimplemented from File.
Definition at line 61 of file ICMPSocket.cpp.
References NetworkClient::SocketInfo::address, DEBUG, header, m_icmp, NetworkSocket::m_info, IOBuffer::read(), ICMP::sendPacket(), FileSystem::Success, and ZERO.
|
private |
Definition at line 120 of file ICMPSocket.h.
Referenced by ICMPSocket(), read(), and setReply().
|
private |
ICMP protocol instance.
Definition at line 116 of file ICMPSocket.h.
Referenced by ICMPSocket(), and write().
|
private |
1.8.17