FreeNOS
Public Member Functions | Protected Attributes
NetworkSocket Class Referenceabstract

Network socket represents a single logical connection on a protocol. More...

#include <NetworkSocket.h>

Inheritance diagram for NetworkSocket:
File ARPSocket ICMPSocket UDPSocket

Public Member Functions

 NetworkSocket (const u32 inode, const Size packetSize, const ProcessID pid)
 Constructor. More...
 
virtual ~NetworkSocket ()
 Destructor. More...
 
ProcessID getProcessID () const
 Get owner ProcessID. More...
 
virtual FileSystem::Result process (const NetworkQueue::Packet *pkt)=0
 Process incoming network packet. 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

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

Detailed Description

Network socket represents a single logical connection on a protocol.

Definition at line 37 of file NetworkSocket.h.

Constructor & Destructor Documentation

◆ NetworkSocket()

NetworkSocket::NetworkSocket ( const u32  inode,
const Size  packetSize,
const ProcessID  pid 
)

Constructor.

Parameters
inodeInode number
packetSizeSize of each network packet
pidProcessID which owns this socket

Definition at line 21 of file NetworkSocket.cpp.

References m_info, and MemoryBlock::set().

◆ ~NetworkSocket()

NetworkSocket::~NetworkSocket ( )
virtual

Destructor.

Definition at line 32 of file NetworkSocket.cpp.

Member Function Documentation

◆ getProcessID()

ProcessID NetworkSocket::getProcessID ( ) const

Get owner ProcessID.

Returns
ProcessID

Definition at line 36 of file NetworkSocket.cpp.

References m_pid.

Referenced by UDP::unregisterSockets(), and ICMP::unregisterSockets().

◆ process()

virtual FileSystem::Result NetworkSocket::process ( const NetworkQueue::Packet pkt)
pure virtual

Process incoming network packet.

Parameters
pktIncoming packet pointer
Returns
Result code

Implemented in UDPSocket, ICMPSocket, and ARPSocket.

Field Documentation

◆ m_info

NetworkClient::SocketInfo NetworkSocket::m_info
protected

Socket connection.

Definition at line 85 of file NetworkSocket.h.

Referenced by ICMPSocket::getAddress(), ICMPSocket::ICMPSocket(), NetworkSocket(), UDPSocket::write(), and ICMPSocket::write().

◆ m_pid

const ProcessID NetworkSocket::m_pid
protected

ProcessID which owns this socket.

Definition at line 76 of file NetworkSocket.h.

Referenced by getProcessID().

◆ m_receive

NetworkQueue NetworkSocket::m_receive
protected

Receive queue.

Definition at line 79 of file NetworkSocket.h.

◆ m_transmit

NetworkQueue NetworkSocket::m_transmit
protected

Transmit queue.

Definition at line 82 of file NetworkSocket.h.


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