FreeNOS
|
Loopback network device implementation. More...
#include <Loopback.h>
Public Member Functions | |
Loopback (const u32 inode, NetworkServer &server) | |
Constructor. More... | |
virtual | ~Loopback () |
Destructor. More... | |
virtual FileSystem::Result | initialize () |
Initialize the device. More... | |
virtual FileSystem::Result | getAddress (Ethernet::Address *address) |
Read ethernet address. More... | |
virtual FileSystem::Result | setAddress (const Ethernet::Address *address) |
Set ethernet address. More... | |
virtual FileSystem::Result | transmit (NetworkQueue::Packet *pkt) |
Transmit one network packet. More... | |
Public Member Functions inherited from NetworkDevice | |
NetworkDevice (const u32 inode, NetworkServer &server) | |
Constructor. More... | |
virtual | ~NetworkDevice () |
Destructor. More... | |
const Size | getMaximumPacketSize () const |
Get maximum packet size. More... | |
NetworkQueue * | getReceiveQueue () |
Get receive queue. More... | |
NetworkQueue * | getTransmitQueue () |
Get transmit queue. More... | |
void | unregisterSockets (const ProcessID pid) |
Remove sockets for a process. More... | |
virtual FileSystem::Result | process (const NetworkQueue::Packet *packet, const Size offset=0) |
Process a received network packet. More... | |
virtual FileSystem::Result | startDMA () |
Start DMA processing. More... | |
Public Member Functions inherited from Device | |
Device (const u32 inode, const FileSystem::FileType type) | |
Constructor. More... | |
virtual | ~Device () |
Destructor. More... | |
virtual const String & | getIdentifier () const |
Get unique device identifier. More... | |
virtual FileSystem::Result | interrupt (const Size vector) |
Called when an interrupt has been triggered for this device. 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 | read (IOBuffer &buffer, Size &size, const Size offset) |
Read bytes from the file. More... | |
virtual FileSystem::Result | write (IOBuffer &buffer, Size &size, const Size offset) |
Write bytes to the file. 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 | |
Ethernet::Address | m_address |
Ethernet address for the loopback device. More... | |
Additional Inherited Members | |
Protected Attributes inherited from NetworkDevice | |
Size | m_maximumPacketSize |
Maximum size of each packet. More... | |
NetworkQueue | m_receive |
NetworkQueue | m_transmit |
NetworkServer & | m_server |
Ethernet * | m_eth |
ARP * | m_arp |
IPV4 * | m_ipv4 |
ICMP * | m_icmp |
UDP * | m_udp |
Protected Attributes inherited from Device | |
String | m_identifier |
Unique identifier for this Device. 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... | |
Loopback network device implementation.
Definition at line 36 of file Loopback.h.
Loopback::Loopback | ( | const u32 | inode, |
NetworkServer & | server | ||
) |
Constructor.
inode | Inode number |
server | NetworkServer reference |
Definition at line 20 of file Loopback.cpp.
References Ethernet::Address::addr, DEBUG, and m_address.
|
virtual |
|
virtual |
Read ethernet address.
address | Ethernet address reference for output |
Implements NetworkDevice.
Definition at line 56 of file Loopback.cpp.
References MemoryBlock::copy(), DEBUG, m_address, and FileSystem::Success.
|
virtual |
Initialize the device.
Reimplemented from NetworkDevice.
Definition at line 39 of file Loopback.cpp.
References DEBUG, ERROR, NetworkDevice::initialize(), FileSystem::IOError, NetworkDevice::m_ipv4, IPV4::setAddress(), FileSystem::Success, and IPV4::toAddress().
|
virtual |
Set ethernet address.
address | New ethernet address to set |
Implements NetworkDevice.
Definition at line 64 of file Loopback.cpp.
References MemoryBlock::copy(), DEBUG, m_address, and FileSystem::Success.
|
virtual |
Transmit one network packet.
pkt | Network packet buffer |
Implements NetworkDevice.
Definition at line 72 of file Loopback.cpp.
References DEBUG, NetworkDevice::m_transmit, NetworkDevice::process(), NetworkQueue::release(), and NetworkQueue::Packet::size.
|
private |
Ethernet address for the loopback device.
Definition at line 89 of file Loopback.h.
Referenced by getAddress(), Loopback(), and setAddress().