FreeNOS
|
Network Device abstract class. More...
#include <NetworkDevice.h>
Public Member Functions | |
NetworkDevice (const u32 inode, NetworkServer &server) | |
Constructor. More... | |
virtual | ~NetworkDevice () |
Destructor. More... | |
virtual FileSystem::Result | initialize () |
Initialize the device. More... | |
const Size | getMaximumPacketSize () const |
Get maximum packet size. More... | |
virtual FileSystem::Result | getAddress (Ethernet::Address *address)=0 |
Read ethernet address. More... | |
virtual FileSystem::Result | setAddress (const Ethernet::Address *address)=0 |
Set ethernet address. 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 | transmit (NetworkQueue::Packet *packet)=0 |
Add a network packet to the transmit queue. 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... | |
Protected Attributes | |
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... | |
Network Device abstract class.
Definition at line 41 of file NetworkDevice.h.
NetworkDevice::NetworkDevice | ( | const u32 | inode, |
NetworkServer & | server | ||
) |
Constructor.
inode | Inode number |
server | NetworkServer reference |
Definition at line 20 of file NetworkDevice.cpp.
References m_arp, m_eth, m_icmp, m_ipv4, m_server, and m_udp.
|
virtual |
Destructor.
Definition at line 38 of file NetworkDevice.cpp.
|
pure virtual |
Read ethernet address.
address | Ethernet address reference for output |
Implemented in Sun8iEmac, and Loopback.
Referenced by Ethernet::initialize().
const Size NetworkDevice::getMaximumPacketSize | ( | ) | const |
Get maximum packet size.
Definition at line 69 of file NetworkDevice.cpp.
References m_maximumPacketSize.
Referenced by NetworkProtocol::getMaximumPacketSize().
NetworkQueue * NetworkDevice::getReceiveQueue | ( | ) |
NetworkQueue * NetworkDevice::getTransmitQueue | ( | ) |
Get transmit queue.
Definition at line 79 of file NetworkDevice.cpp.
References m_transmit.
Referenced by Ethernet::getTransmitPacket().
|
virtual |
Initialize the device.
Reimplemented from Device.
Reimplemented in Sun8iEmac, and Loopback.
Definition at line 42 of file NetworkDevice.cpp.
References ERROR, Device::initialize(), UDP::initialize(), ICMP::initialize(), Ethernet::initialize(), IPV4::initialize(), ARP::initialize(), m_arp, m_eth, m_icmp, m_ipv4, m_udp, IPV4::setARP(), Ethernet::setARP(), IPV4::setICMP(), ARP::setIP(), Ethernet::setIP(), IPV4::setUDP(), and FileSystem::Success.
Referenced by Loopback::initialize(), and Sun8iEmac::initialize().
|
virtual |
Process a received network packet.
packet | Network packet received by the device |
offset | Network packet payload offset |
Definition at line 92 of file NetworkDevice.cpp.
References DEBUG, m_eth, and Ethernet::process().
Referenced by Sun8iEmac::receive(), and Loopback::transmit().
|
pure virtual |
Set ethernet address.
address | New ethernet address to set |
Implemented in Sun8iEmac, and Loopback.
Referenced by Ethernet::setAddress().
|
virtual |
Start DMA processing.
Reimplemented in Sun8iEmac.
Definition at line 101 of file NetworkDevice.cpp.
References DEBUG, and FileSystem::Success.
Referenced by NetworkServer::retryRequests().
|
pure virtual |
Add a network packet to the transmit queue.
packet | Pointer to the packet to transmit |
Implemented in Sun8iEmac, and Loopback.
Referenced by UDP::sendPacket(), ICMP::sendPacket(), ARP::sendReply(), and ARP::sendRequest().
void NetworkDevice::unregisterSockets | ( | const ProcessID | pid | ) |
Remove sockets for a process.
pid | ProcessID to remove sockets for |
Definition at line 84 of file NetworkDevice.cpp.
References DEBUG, m_icmp, m_udp, UDP::unregisterSockets(), and ICMP::unregisterSockets().
Referenced by NetworkServer::onProcessTerminated().
|
protected |
Definition at line 148 of file NetworkDevice.h.
Referenced by initialize(), and NetworkDevice().
|
protected |
Definition at line 146 of file NetworkDevice.h.
Referenced by initialize(), NetworkDevice(), and process().
|
protected |
Definition at line 152 of file NetworkDevice.h.
Referenced by initialize(), NetworkDevice(), and unregisterSockets().
|
protected |
Definition at line 150 of file NetworkDevice.h.
Referenced by Loopback::initialize(), initialize(), and NetworkDevice().
|
protected |
Maximum size of each packet.
Definition at line 138 of file NetworkDevice.h.
Referenced by getMaximumPacketSize(), and Sun8iEmac::resetReceive().
|
protected |
Definition at line 140 of file NetworkDevice.h.
Referenced by getReceiveQueue(), and Sun8iEmac::resetReceive().
|
protected |
Definition at line 144 of file NetworkDevice.h.
Referenced by NetworkDevice().
|
protected |
Definition at line 142 of file NetworkDevice.h.
Referenced by getTransmitQueue(), Sun8iEmac::interrupt(), and Loopback::transmit().
|
protected |
Definition at line 154 of file NetworkDevice.h.
Referenced by initialize(), NetworkDevice(), and unregisterSockets().