The Pedigree Project  0.1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
NetworkStack Class Reference

#include <NetworkStack.h>

+ Inheritance diagram for NetworkStack:
+ Collaboration diagram for NetworkStack:

Classes

class  Packet
 

Public Member Functions

void receive (size_t nBytes, uintptr_t packet, Network *pCard, uint32_t offset)
 
void registerDevice (Network *pDevice)
 
NetworkgetDevice (size_t n)
 
size_t getNumDevices ()
 
void deRegisterDevice (Network *pDevice)
 
void setLoopback (Network *pCard)
 
NetworkgetLoopback ()
 
MemoryPoolgetMemPool ()
 
struct netifgetInterface (Network *pCard) const
 
- Public Member Functions inherited from RequestQueue
 RequestQueue (const String &name)
 
virtual void initialise ()
 
virtual void destroy ()
 
MUST_USE_RESULT uint64_t addRequest (size_t priority, uint64_t p1=0, uint64_t p2=0, uint64_t p3=0, uint64_t p4=0, uint64_t p5=0, uint64_t p6=0, uint64_t p7=0, uint64_t p8=0)
 
MUST_USE_RESULT uint64_t addRequest (size_t priority, ActionOnDuplicate action, uint64_t p1=0, uint64_t p2=0, uint64_t p3=0, uint64_t p4=0, uint64_t p5=0, uint64_t p6=0, uint64_t p7=0, uint64_t p8=0)
 
uint64_t addAsyncRequest (size_t priority, uint64_t p1=0, uint64_t p2=0, uint64_t p3=0, uint64_t p4=0, uint64_t p5=0, uint64_t p6=0, uint64_t p7=0, uint64_t p8=0)
 
void halt ()
 
void resume ()
 

Static Public Member Functions

static NetworkStackinstance ()
 

Private Member Functions

virtual uint64_t executeRequest (uint64_t p1, uint64_t p2, uint64_t p3, uint64_t p4, uint64_t p5, uint64_t p6, uint64_t p7, uint64_t p8)
 

Private Attributes

Networkm_pLoopback
 
Vector< Network * > m_Children
 
MemoryPool m_MemPool
 
Mutex m_Lock
 
Tree< Network *, struct netif * > m_Interfaces
 
size_t m_NextInterfaceNumber
 

Static Private Attributes

static NetworkStackstack = 0
 

Additional Inherited Members

- Public Types inherited from RequestQueue
enum  ActionOnDuplicate { Block, NewRequest, ReturnImmediately }
 
- Protected Member Functions inherited from RequestQueue
 RequestQueue (const RequestQueue &)
 
void operator= (const RequestQueue &)
 
virtual bool compareRequests (const Request &a, const Request &b)
 
bool isRequestValid (const Request *r)
 
int work ()
 
RequestgetNextRequest ()
 
- Static Protected Member Functions inherited from RequestQueue
static int trampoline (void *p)
 
static int doAsync (void *p)
 
- Protected Attributes inherited from RequestQueue
Requestm_pRequestQueue [REQUEST_QUEUE_NUM_PRIORITIES]
 
volatile bool m_Stop
 
Mutex m_RequestQueueMutex
 
ConditionVariable m_RequestQueueCondition
 
ConditionVariable m_AsyncRequestQueueCondition
 
Threadm_pThread
 
bool m_Halted
 
Mutex m_HaltAcknowledged
 
RequestQueueOverrunChecker m_OverrunChecker
 
size_t m_nMaxAsyncRequests
 
size_t m_nAsyncRequests
 
size_t m_nTotalRequests
 
String m_Name
 

Detailed Description

The Pedigree network stack This function is the base for receiving packets, and provides functionality for keeping track of network devices in the system.

Definition at line 40 of file NetworkStack.h.

Member Function Documentation

void NetworkStack::deRegisterDevice ( Network pDevice)

Unregisters a given network device from the stack

Definition at line 272 of file NetworkStack.cc.

References MemoryPool::allocateNow(), Vector< T >::begin(), Vector< T >::end(), Vector< T >::erase(), MemoryPool::free(), instance(), Device::m_Children, m_MemPool, and netif_remove().

uint64_t NetworkStack::executeRequest ( uint64_t  p1,
uint64_t  p2,
uint64_t  p3,
uint64_t  p4,
uint64_t  p5,
uint64_t  p6,
uint64_t  p7,
uint64_t  p8 
)
privatevirtual

Callback - classes are expected to inherit and override this function. It's called when a request needs to be executed (by the worker thread).

Implements RequestQueue.

Definition at line 159 of file NetworkStack.cc.

References netif::input.

Network * NetworkStack::getDevice ( size_t  n)

Returns the n'th registered network device

Definition at line 262 of file NetworkStack.cc.

References Device::m_Children.

struct netif* NetworkStack::getInterface ( Network pCard) const
inline

Get an interface for a card.

Definition at line 126 of file NetworkStack.h.

Network* NetworkStack::getLoopback ( )
inline

Gets the loopback device for the stack

Definition at line 75 of file NetworkStack.h.

MemoryPool& NetworkStack::getMemPool ( )
inline

Grabs the memory pool for networking use

Definition at line 81 of file NetworkStack.h.

Referenced by Dm9601::initialiseDriver(), Dm9601::send(), and Ne2k::send().

+ Here is the caller graph for this function:

size_t NetworkStack::getNumDevices ( )

Returns the number of devices registered with the stack

Definition at line 267 of file NetworkStack.cc.

References Vector< T >::count(), and Device::m_Children.

static NetworkStack& NetworkStack::instance ( )
inlinestatic

For access to the stack without declaring an instance of it

Definition at line 47 of file NetworkStack.h.

Referenced by CdiNet::CdiNet(), deRegisterDevice(), Dm9601::initialiseDriver(), Ne2k::Ne2k(), Nic3C90x::Nic3C90x(), Dm9601::send(), Rtl8139::send(), Loopback::send(), Ne2k::send(), and CdiNet::setStationInfo().

+ Here is the caller graph for this function:

void NetworkStack::receive ( size_t  nBytes,
uintptr_t  packet,
Network pCard,
uint32_t  offset 
)

Called when a packet arrives

Definition at line 178 of file NetworkStack.cc.

References Network::droppedPacket(), ERROR, NetworkFilter::instance(), pbuf::len, pbuf::next, pbuf::payload, pbuf_alloc(), PBUF_POOL, and PBUF_RAW.

Referenced by Dm9601::initialiseDriver(), Nic3C90x::Nic3C90x(), Rtl8139::send(), Loopback::send(), Ne2k::send(), and CdiNet::setStationInfo().

+ Here is the caller graph for this function:

void NetworkStack::registerDevice ( Network pDevice)

Registers a given network device with the stack

Definition at line 226 of file NetworkStack.cc.

References FATAL, Device::m_Children, netif::name, netif_add(), netif::num, Vector< T >::pushBack(), and tcpip_input().

Referenced by CdiNet::CdiNet(), Dm9601::initialiseDriver(), Ne2k::Ne2k(), and Nic3C90x::Nic3C90x().

+ Here is the caller graph for this function:

void NetworkStack::setLoopback ( Network pCard)
inline

Sets the loopback device for the stack

Definition at line 69 of file NetworkStack.h.

Member Data Documentation

Vector<Network *> NetworkStack::m_Children
private

Network devices registered with the stack.

Definition at line 142 of file NetworkStack.h.

Tree<Network *, struct netif *> NetworkStack::m_Interfaces
private

lwIP interfaces for each of our cards.

Definition at line 152 of file NetworkStack.h.

MemoryPool NetworkStack::m_MemPool
private

Networking memory pool

Definition at line 145 of file NetworkStack.h.

Referenced by deRegisterDevice().

size_t NetworkStack::m_NextInterfaceNumber
private

Next interface number to assign.

Definition at line 155 of file NetworkStack.h.

Network* NetworkStack::m_pLoopback
private

Loopback device

Definition at line 139 of file NetworkStack.h.


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