FreeNOS
|
Network protocol abstraction class. More...
#include <NetworkProtocol.h>
Public Member Functions | |
NetworkProtocol (NetworkServer &server, NetworkDevice &device, NetworkProtocol &parent) | |
Constructor. More... | |
virtual | ~NetworkProtocol () |
Destructor. More... | |
virtual const Size | getMaximumPacketSize () const |
Get maximum packet size. More... | |
virtual FileSystem::Result | initialize ()=0 |
Perform initialization. More... | |
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. More... | |
virtual FileSystem::Result | process (const NetworkQueue::Packet *pkt, const Size offset)=0 |
Process incoming network packet. More... | |
Public Member Functions inherited from Directory | |
Directory (const u32 inode) | |
Constructor. More... | |
virtual | ~Directory () |
Destructor. More... | |
virtual FileSystem::Result | read (IOBuffer &buffer, Size &size, const Size offset) |
Read directory entries. More... | |
virtual File * | lookup (const char *name) |
Retrieve a File from storage. More... | |
void | insert (FileSystem::FileType type, const char *name) |
Insert a new directory entry. More... | |
void | remove (const char *name) |
Remove a directory entry. More... | |
void | clear () |
Clears the internal list of entries. 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 | 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 Types | |
enum | Identifier { Ethernet = 1, IPV4, ARP, ICMP, UDP, TCP } |
List of known network protocol identifiers. More... | |
Protected Attributes | |
NetworkServer & | m_server |
Network server instance. More... | |
NetworkDevice & | m_device |
Network device instance. More... | |
NetworkProtocol & | m_parent |
Parent upper-layer protocol instance. 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 protocol abstraction class.
Definition at line 39 of file NetworkProtocol.h.
|
protected |
List of known network protocol identifiers.
Enumerator | |
---|---|
Ethernet | |
IPV4 | |
ARP | |
ICMP | |
UDP | |
TCP |
Definition at line 46 of file NetworkProtocol.h.
NetworkProtocol::NetworkProtocol | ( | NetworkServer & | server, |
NetworkDevice & | device, | ||
NetworkProtocol & | parent | ||
) |
Constructor.
server | Reference to the NetworkServer instance |
device | Reference to the NetworkDevice instance |
parent | Parent upper-layer protocol (or use this for no parent) |
Definition at line 22 of file NetworkProtocol.cpp.
|
virtual |
Destructor.
Definition at line 32 of file NetworkProtocol.cpp.
|
virtual |
Get maximum packet size.
Definition at line 36 of file NetworkProtocol.cpp.
References NetworkDevice::getMaximumPacketSize(), and m_device.
Referenced by UDP::sendPacket(), and ICMP::sendPacket().
|
virtual |
Get a new packet for transmission.
pkt | On output contains a pointer to a Packet |
address | Address of the destination of this packet |
addressSize | Number of bytes of the address |
protocol | Identifier for the protocol to create the packet for |
payloadSize | Number of payload bytes |
Reimplemented in IPV4, and Ethernet.
Definition at line 41 of file NetworkProtocol.cpp.
References FileSystem::NotSupported.
Referenced by IPV4::getTransmitPacket(), UDP::sendPacket(), ICMP::sendPacket(), ARP::sendReply(), and ARP::sendRequest().
|
pure virtual |
|
pure virtual |
|
protected |
Network device instance.
Definition at line 123 of file NetworkProtocol.h.
Referenced by getMaximumPacketSize(), Ethernet::getTransmitPacket(), Ethernet::initialize(), UDP::sendPacket(), ICMP::sendPacket(), ARP::sendReply(), ARP::sendRequest(), and Ethernet::setAddress().
|
protected |
Parent upper-layer protocol instance.
Definition at line 126 of file NetworkProtocol.h.
Referenced by IPV4::getTransmitPacket(), UDP::sendPacket(), ICMP::sendPacket(), ARP::sendReply(), and ARP::sendRequest().
|
protected |
Network server instance.
Definition at line 120 of file NetworkProtocol.h.
Referenced by UDP::createSocket(), ICMP::createSocket(), UDP::initialize(), ICMP::initialize(), Ethernet::initialize(), IPV4::initialize(), ARP::initialize(), ARP::lookupAddress(), UDP::unregisterSockets(), and ICMP::unregisterSockets().