20 #include "pedigree/kernel/machine/Network.h" 21 #include "pedigree/kernel/utilities/String.h" 23 StationInfo::StationInfo()
24 : ipv4(), ipv6(0), nIpv6Addresses(0), subnetMask(), broadcast(0xFFFFFFFF),
25 gateway(), gatewayIpv6(
IpAddress::IPv6), dnsServers(0), nDnsServers(0),
26 mac(), nPackets(0), nDropped(0), nBad(0)
31 : ipv4(info.ipv4), ipv6(info.ipv6), nIpv6Addresses(info.nIpv6Addresses),
32 subnetMask(info.subnetMask), broadcast(info.broadcast),
33 gateway(info.gateway), gatewayIpv6(info.gatewayIpv6),
34 dnsServers(info.dnsServers), nDnsServers(info.nDnsServers), mac(info.mac),
35 nPackets(info.nPackets), nDropped(info.nDropped), nBad(info.nBad)
39 StationInfo::~StationInfo()
43 Network::Network() : m_StationInfo()
45 m_SpecificType =
"Generic Network Device";
48 Network::Network(
Network *pDev) :
Device(pDev), m_StationInfo()
63 str =
"Generic Network Device";
68 str =
"Generic Network Device";
89 return a | (b << 8) | (c << 16) | (d << 24);
93 uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f, uint8_t g,
94 uint8_t h, uint8_t i, uint8_t j, uint8_t k, uint8_t l, uint8_t m, uint8_t n,
97 uint8_t temp[16] = {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p};
105 uint16_t *data =
reinterpret_cast<uint16_t *
>(buffer);
110 nBytes -=
sizeof(uint16_t);
116 uint8_t *data8 =
reinterpret_cast<uint8_t *
>(data);
122 sum = (sum & 0xFFFF) + (sum >> 16);
124 uint16_t ret =
static_cast<uint16_t
>(~sum);
130 m_StationInfo.nPackets++;
140 m_StationInfo.
nBad++;
virtual void droppedPacket()
Called when a packet is dropped by the system.
virtual bool setStationInfo(const StationInfo &info)
static EXPORTED_PUBLIC IpAddress convertToIpv6(uint8_t a, uint8_t b=0, uint8_t c=0, uint8_t d=0, uint8_t e=0, uint8_t f=0, uint8_t g=0, uint8_t h=0, uint8_t i=0, uint8_t j=0, uint8_t k=0, uint8_t l=0, uint8_t m=0, uint8_t n=0, uint8_t o=0, uint8_t p=0)
virtual const StationInfo & getStationInfo()
static EXPORTED_PUBLIC uint32_t convertToIpv4(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
size_t nBad
Number of packets dropped by the filter.
static EXPORTED_PUBLIC uint16_t calculateChecksum(uintptr_t buffer, size_t nBytes)
size_t nDropped
Number of packets passed through the interface.
virtual void dump(String &str)
virtual void getName(String &str)
virtual bool isConnected()