FreeNOS
Public Member Functions | Private Attributes
IPV4Address Class Reference

IPV4 address file. More...

#include <IPV4Address.h>

Inheritance diagram for IPV4Address:
File

Public Member Functions

 IPV4Address (const u32 inode, IPV4 *ipv4)
 Constructor. More...
 
virtual ~IPV4Address ()
 Destructor. More...
 
virtual FileSystem::Result read (IOBuffer &buffer, Size &size, const Size offset)
 Read IPV4 address. More...
 
virtual FileSystem::Result write (IOBuffer &buffer, Size &size, const Size offset)
 Set new IPV4 address. 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

IPV4m_ipv4
 IPV4 object pointer. More...
 

Additional Inherited Members

- 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

IPV4 address file.

Definition at line 36 of file IPV4Address.h.

Constructor & Destructor Documentation

◆ IPV4Address()

IPV4Address::IPV4Address ( const u32  inode,
IPV4 ipv4 
)

Constructor.

Parameters
inodeInode number
ipv4IPV4 object pointer

Definition at line 23 of file IPV4Address.cpp.

References File::m_size.

◆ ~IPV4Address()

IPV4Address::~IPV4Address ( )
virtual

Destructor.

Definition at line 31 of file IPV4Address.cpp.

Member Function Documentation

◆ read()

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

Read IPV4 address.

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 35 of file IPV4Address.cpp.

References IPV4::getAddress(), m_ipv4, File::m_size, FileSystem::Success, and IOBuffer::write().

◆ write()

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

Set new IPV4 address.

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 54 of file IPV4Address.cpp.

References MemoryBlock::copy(), DEBUG, m_ipv4, IOBuffer::read(), IPV4::setAddress(), IPV4::toAddress(), and IPV4::toString().

Field Documentation

◆ m_ipv4

IPV4* IPV4Address::m_ipv4
private

IPV4 object pointer.

Definition at line 85 of file IPV4Address.h.

Referenced by read(), and write().


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