Go to the documentation of this file.
18 #include <FreeNOS/System.h>
86 s << ((address >> 24) & 0xff) <<
"."
87 << ((address >> 16) & 0xff) <<
"."
88 << ((address >> 8) & 0xff) <<
"."
89 << ((address & 0xff));
96 const String input = address;
102 if (lst.
count() != 4)
112 addr |= (
byte << shift);
135 const Size addressSize,
137 const Size payloadSize)
147 ERROR(
"failed to perform ARP lookup: result = " << (
int) result);
159 ERROR(
"failed to get transmit packet: result = " << (
int) result);
177 (*pkt)->size +=
sizeof(
Header);
186 const u16 *ptr = (
const u16 *) buffer;
204 sum = (sum >> 16) + (sum & 0xFFFF);
virtual FileSystem::Result process(const NetworkQueue::Packet *pkt, const Size offset)
Process incoming network packet.
Network protocol abstraction class.
FileSystem::Result lookupAddress(const IPV4::Address *ipAddr, Ethernet::Address *ethAddr)
Lookup Ethernet address for an IP.
const u32 readBe32(const void *data)
Read 32-bit big endian integer.
const u16 readBe16(const void *data)
Read 16-bit big endian integer.
u32 getNextInode()
Get next unused inode.
void writeBe16(void *data, const u16 input)
Write 16-bit big endian integer.
Network Device abstract class.
NetworkProtocol & m_parent
Parent upper-layer protocol instance.
static const u16 checksum(const void *buffer, const Size length)
Calculate IP checksum.
User Datagram Protocol (UDP)
struct IPV4::Header Header
IP network packet header.
Size count() const
Get the number of items on the list.
virtual FileSystem::Result process(const NetworkQueue::Packet *pkt, const Size offset)
Process incoming network packet.
unsigned int uint
Unsigned integer number.
::UDP * m_udp
UDP instance.
List< String > split(const char delimiter) const
Split the String into parts separated by a delimiter.
virtual FileSystem::Result process(const NetworkQueue::Packet *pkt, const Size offset)
Process incoming network packet.
#define DEBUG(msg)
Output a debug message to standard output.
Ethernet network address.
Address m_address
Current IP address.
virtual bool hasCurrent() const
Check if there is a current item on the List.
unsigned short u16
Unsigned 16-bit number.
static const Address toAddress(const char *address)
Convert string to IPV4 address.
unsigned int u32
Unsigned 32-bit number.
unsigned int Size
Any sane size indicator cannot go negative.
virtual FileSystem::Result setAddress(const Address *address)
Set current IP address.
void setARP(::ARP *arp)
Set ARP instance.
FileSystem::Result registerDirectory(Directory *dir, const char *path)
Register a new Directory.
const u16 read16(const void *data)
Read 16-bit integer (no conversion)
virtual FileSystem::Result initialize()
Perform initialization.
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.
static const String toString(const Address address)
Convert address to string.
virtual ~IPV4()
Destructor.
void setUDP(::UDP *udp)
Set UDP instance.
void setICMP(::ICMP *icmp)
Set ICMP instance.
Protocol getProtocolByIdentifier(const NetworkProtocol::Identifier id) const
Convert protocol identifier.
void writeBe32(void *data, const u32 input)
Write 32-bit big endian integer.
NetworkServer & m_server
Network server instance.
#define ERROR(msg)
Output an error message.
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.
u16 m_id
Packet ID for IPV4.
Result
Result code for filesystem Actions.
unsigned char u8
Unsigned 8-bit number.
virtual FileSystem::Result getAddress(Address *address)
Get current IP address.
::ARP * m_arp
ARP instance.
::ICMP * m_icmp
ICMP instance.
Represents a network packet.
Address Resolution Protocol.
Identifier
List of known network protocol identifiers.
long toLong(const Number::Base base=Number::Dec) const
Convert the String to a signed long integer.
Internet Control Message Protocol (ICMP)
FileSystem::Result registerFile(File *file, const char *path)
Register a new File.