Public Member Functions | Private Attributes
Loopback Class Reference

Loopback network device implementation. More...

#include <Loopback.h>

Inheritance diagram for Loopback:
NetworkDevice Device File

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...
NetworkQueuegetReceiveQueue ()
 Get receive queue. More...
NetworkQueuegetTransmitQueue ()
 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 StringgetIdentifier () 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
- 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...

Detailed Description

Loopback network device implementation.

Definition at line 36 of file Loopback.h.

Constructor & Destructor Documentation

◆ Loopback()

Loopback::Loopback ( const u32  inode,
NetworkServer server 


inodeInode number
serverNetworkServer reference

Definition at line 20 of file Loopback.cpp.

References Ethernet::Address::addr, DEBUG, and m_address.

◆ ~Loopback()

Loopback::~Loopback ( )


Definition at line 34 of file Loopback.cpp.

References DEBUG.

Member Function Documentation

◆ getAddress()

FileSystem::Result Loopback::getAddress ( Ethernet::Address address)

Read ethernet address.

addressEthernet address reference for output
Result code

Implements NetworkDevice.

Definition at line 56 of file Loopback.cpp.

References MemoryBlock::copy(), DEBUG, m_address, and FileSystem::Success.

◆ initialize()

FileSystem::Result Loopback::initialize ( )

Initialize the device.

Result code

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().

◆ setAddress()

FileSystem::Result Loopback::setAddress ( const Ethernet::Address address)

Set ethernet address.

addressNew ethernet address to set
Result code

Implements NetworkDevice.

Definition at line 64 of file Loopback.cpp.

References MemoryBlock::copy(), DEBUG, m_address, and FileSystem::Success.

◆ transmit()

FileSystem::Result Loopback::transmit ( NetworkQueue::Packet pkt)

Transmit one network packet.

pktNetwork 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.

Field Documentation

◆ m_address

Ethernet::Address Loopback::m_address

Ethernet address for the loopback device.

Definition at line 89 of file Loopback.h.

Referenced by getAddress(), Loopback(), and setAddress().

The documentation for this class was generated from the following files: