The Pedigree Project  0.1
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Network Class Referenceabstract

#include <Network.h>

+ Inheritance diagram for Network:
+ Collaboration diagram for Network:

Public Member Functions

 Network (Network *pDev)
 
virtual Type getType ()
 
virtual void getName (String &str)
 
virtual void dump (String &str)
 
virtual bool send (size_t nBytes, uintptr_t buffer)=0
 
virtual bool setStationInfo (const StationInfo &info)
 
virtual const StationInfogetStationInfo ()
 
virtual bool isConnected ()
 
virtual void gotPacket ()
 
virtual void droppedPacket ()
 Called when a packet is dropped by the system.
 
virtual void badPacket ()
 
- Public Member Functions inherited from Device
 Device (Device *p)
 
DevicegetParent () const
 
void setParent (Device *p)
 
virtual String getSpecificType ()
 
virtual void setSpecificType (String str)
 
void setPciPosition (uint32_t bus, uint32_t device, uint32_t func)
 
void setPciIdentifiers (uint8_t classCode, uint8_t subclassCode, uint16_t vendorId, uint16_t deviceId, uint8_t progIf)
 
void setPciConfigHeader (const PciBus::ConfigSpace &space)
 
PciBus::ConfigSpace getPciConfigHeader () const
 
uint8_t getPciClassCode ()
 
uint8_t getPciSubclassCode ()
 
uint16_t getPciVendorId ()
 
uint16_t getPciDeviceId ()
 
uint8_t getPciProgInterface ()
 
uint32_t getPciBusPosition ()
 
uint32_t getPciDevicePosition ()
 
uint32_t getPciFunctionNumber ()
 
virtual Vector< Address * > & addresses ()
 
virtual uintptr_t getInterruptNumber ()
 
virtual void setInterruptNumber (uintptr_t n)
 
void addChild (Device *pDevice)
 
DevicegetChild (size_t n)
 
size_t getNumChildren ()
 
void removeChild (size_t n)
 
void removeChild (Device *d)
 
void replaceChild (Device *src, Device *dest)
 

Static Public Member Functions

static EXPORTED_PUBLIC uint32_t convertToIpv4 (uint8_t a, uint8_t b, uint8_t c, uint8_t d)
 
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)
 
static EXPORTED_PUBLIC uint16_t calculateChecksum (uintptr_t buffer, size_t nBytes)
 
- Static Public Member Functions inherited from Device
static void foreach (Callback callback, Device *root=0)
 
template<class F , class... Args>
static void foreach (pedigree_std::Callable< F > &callback, Device *root, Args...args)
 
static void addToRoot (Device *device)
 
static void searchByVendorId (uint16_t vendorId, void(*callback)(Device *), Device *root=0)
 
static void searchByVendorIdAndDeviceId (uint16_t vendorId, uint16_t deviceId, void(*callback)(Device *), Device *root=0)
 
static void searchByClass (uint16_t classCode, void(*callback)(Device *), Device *root=0)
 
static void searchByClassAndSubclass (uint16_t classCode, uint16_t subclassCode, void(*callback)(Device *), Device *root=0)
 
static void searchByClassSubclassAndProgInterface (uint16_t classCode, uint16_t subclassCode, uint8_t progInterface, void(*callback)(Device *), Device *root=0)
 

Protected Attributes

StationInfo m_StationInfo
 
- Protected Attributes inherited from Device
Vector< Address * > m_Addresses
 
Vector< Device * > m_Children
 
Devicem_pParent
 
uintptr_t m_InterruptNumber
 
String m_SpecificType
 
PciBus::ConfigSpace m_ConfigHeader
 
uint8_t m_ClassCode
 
uint8_t m_SubclassCode
 
uint16_t m_VendorId
 
uint16_t m_DeviceId
 
uint8_t m_ProgInterface
 
uint32_t m_PciBusPos
 
uint32_t m_PciDevicePos
 
uint32_t m_PciFunctionNum
 

Additional Inherited Members

- Public Types inherited from Device
enum  Type {
  Generic, Root, Disk, Bus,
  Display, Network, Sound, Console,
  Mouse, Controller, UsbController, UsbGeneric,
  UsbContainer
}
 
typedef Device *(* Callback) (Device *)
 
- Protected Member Functions inherited from Device
 NOT_COPYABLE_OR_ASSIGNABLE (Device)
 
- Static Protected Member Functions inherited from Device
static Deviceroot ()
 
- Static Protected Attributes inherited from Device
static Device m_Root
 
static Mutex m_TreeLock
 

Detailed Description

A network device (sends/receives packets on a network)

Definition at line 66 of file system/include/pedigree/kernel/machine/Network.h.

Member Function Documentation

void Network::badPacket ( )
virtual

Called when a packet is determined to be "bad" by the system (ie, invalid checksum).

Definition at line 138 of file Network.cc.

References StationInfo::nBad.

uint16_t Network::calculateChecksum ( uintptr_t  buffer,
size_t  nBytes 
)
static

Calculates a checksum

Definition at line 102 of file Network.cc.

uint32_t Network::convertToIpv4 ( uint8_t  a,
uint8_t  b,
uint8_t  c,
uint8_t  d 
)
static

Converts an IPv4 address into an integer

Definition at line 87 of file Network.cc.

IpAddress Network::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 
)
static

Converts an IPv6 address into an IpAddress object

Definition at line 92 of file Network.cc.

void Network::dump ( String str)
virtual

Dumps a textual representation of the device into the given string.

Reimplemented from Device.

Definition at line 66 of file Network.cc.

void Network::getName ( String str)
virtual

Stores the device's name in str.

Reimplemented from Device.

Reimplemented in Ne2k, Loopback, Rtl8139, Dm9601, Nic3C90x, and CdiNet.

Definition at line 61 of file Network.cc.

const StationInfo & Network::getStationInfo ( )
virtual

Gets station information (such as IP addresses)

Reimplemented in Ne2k, Loopback, Rtl8139, Dm9601, Nic3C90x, and CdiNet.

Definition at line 76 of file Network.cc.

Device::Type Network::getType ( )
virtual

Returns the (abstract) type of the device.

Reimplemented from Device.

Definition at line 56 of file Network.cc.

References Device::Network.

Referenced by UnixSocketSyscalls::connect(), UnixSocketSyscalls::pairWith(), and UnixSocketSyscalls::sendto_msg().

+ Here is the caller graph for this function:

void Network::gotPacket ( )
virtual

Packet statistics Called when a packet is picked up by the system, regardless of if it's eventually bad or dropped

Definition at line 128 of file Network.cc.

bool Network::isConnected ( )
virtual

Is this device actually connected to a network?

Reimplemented in Ne2k, and Rtl8139.

Definition at line 82 of file Network.cc.

virtual bool Network::send ( size_t  nBytes,
uintptr_t  buffer 
)
pure virtual

Sends a given packet through the device.

Parameters
nBytesThe number of bytes to send.
bufferA buffer with the packet to send

Implemented in Ne2k, Loopback, Rtl8139, CdiNet, Dm9601, and Nic3C90x.

bool Network::setStationInfo ( const StationInfo info)
virtual

Sets station information (such as IP addresses)

Parameters
infoThe information to set as the station info

Reimplemented in Ne2k, CdiNet, Dm9601, and Nic3C90x.

Definition at line 71 of file Network.cc.


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