FreeNOS
Public Member Functions | Private Attributes
ARPSocket Class Reference

Address Resolution Protocol (ARP) socket. More...

#include <ARPSocket.h>

Inheritance diagram for ARPSocket:
NetworkSocket File

Public Member Functions

 ARPSocket (const u32 inode, ARP *arp)
 Constructor. More...
 
virtual ~ARPSocket ()
 Destructor. More...
 
virtual FileSystem::Result read (IOBuffer &buffer, Size &size, const Size offset)
 Receive ARP response. More...
 
virtual FileSystem::Result write (IOBuffer &buffer, Size &size, const Size offset)
 Send ARP request. More...
 
virtual FileSystem::Result process (const NetworkQueue::Packet *pkt)
 Process incoming network packet. More...
 
- Public Member Functions inherited from NetworkSocket
 NetworkSocket (const u32 inode, const Size packetSize, const ProcessID pid)
 Constructor. More...
 
virtual ~NetworkSocket ()
 Destructor. More...
 
ProcessID getProcessID () const
 Get owner ProcessID. 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 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

ARPm_arp
 ARP protocol instance. More...
 
IPV4::Address m_ipAddr
 IPV4 address for request. More...
 
Ethernet::Address m_ethAddr
 Ethernet address for reply. More...
 

Additional Inherited Members

- Protected Attributes inherited from NetworkSocket
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

Address Resolution Protocol (ARP) socket.

ARP sockets receive a copy of ARP reply packets.

Definition at line 40 of file ARPSocket.h.

Constructor & Destructor Documentation

◆ ARPSocket()

ARPSocket::ARPSocket ( const u32  inode,
ARP arp 
)

Constructor.

Parameters
inodeInode number
arpARP object pointer

Definition at line 24 of file ARPSocket.cpp.

References m_arp, m_ethAddr, m_ipAddr, and MemoryBlock::set().

◆ ~ARPSocket()

ARPSocket::~ARPSocket ( )
virtual

Destructor.

Definition at line 33 of file ARPSocket.cpp.

Member Function Documentation

◆ process()

FileSystem::Result ARPSocket::process ( const NetworkQueue::Packet pkt)
virtual

Process incoming network packet.

Parameters
pktIncoming packet pointer
Returns
Result code

Implements NetworkSocket.

Definition at line 85 of file ARPSocket.cpp.

References DEBUG, and FileSystem::Success.

Referenced by ARP::process().

◆ read()

FileSystem::Result ARPSocket::read ( IOBuffer buffer,
Size size,
const Size  offset 
)
virtual

Receive ARP response.

Parameters
bufferInput/Output buffer to output bytes to.
sizeMaximum number of bytes to read on input. On output, the actual number of bytes read.
offsetOffset inside the file to start reading.
Returns
Result code

Reimplemented from File.

Definition at line 37 of file ARPSocket.cpp.

References DEBUG, FileSystem::InvalidArgument, ARP::lookupAddress(), m_arp, m_ethAddr, m_ipAddr, FileSystem::Success, and IOBuffer::write().

◆ write()

FileSystem::Result ARPSocket::write ( IOBuffer buffer,
Size size,
const Size  offset 
)
virtual

Send ARP request.

Parameters
bufferInput/Output buffer to input bytes from.
sizeMaximum number of bytes to write on input. On output, the actual number of bytes written.
offsetOffset inside the file to start writing.
Returns
Result code

Reimplemented from File.

Definition at line 65 of file ARPSocket.cpp.

References DEBUG, ARP::lookupAddress(), m_arp, m_ethAddr, m_ipAddr, IOBuffer::read(), and FileSystem::Success.

Field Documentation

◆ m_arp

ARP* ARPSocket::m_arp
private

ARP protocol instance.

Definition at line 98 of file ARPSocket.h.

Referenced by ARPSocket(), read(), and write().

◆ m_ethAddr

Ethernet::Address ARPSocket::m_ethAddr
private

Ethernet address for reply.

Definition at line 104 of file ARPSocket.h.

Referenced by ARPSocket(), read(), and write().

◆ m_ipAddr

IPV4::Address ARPSocket::m_ipAddr
private

IPV4 address for request.

Definition at line 101 of file ARPSocket.h.

Referenced by ARPSocket(), read(), and write().


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