CNQPeerList Class Reference

#include <NQPeerList.h>

Inherits CNQLockMechanism.

Collaboration diagram for CNQPeerList:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CNQPeerList ()
virtual ~CNQPeerList ()
UINT32 getLastError ()
 Returns last error code happened.
bool add (UINT32 ip, UINT16 port)
bool remove (UINT32 ip, UINT16 port)
bool removeAll ()
bool isAllowed (UINT32 ip, UINT16 port)
bool getReceivePacketIndex (UINT32 ip, UINT16 port, UINT16 &packetindex)
bool setReceivePacketIndex (UINT32 ip, UINT16 port, UINT16 packetindex)
bool getSendPacketIndex (UINT32 ip, UINT16 port, UINT16 &aNextPacketIndex)
bool incSendPacketIndex (UINT32 ip, UINT16 port)
UINT32 count ()
 Returns the number of elements (number of peers) in the peer list.
bool add (UINT32 ip, UINT16 port, UINT32 &lasterr)
 adds a new peer to the list of peers.
bool remove (UINT32 ip, UINT16 port, UINT32 &lasterr)
 Removes a peer from the list of peers.
bool removeAll (UINT32 &lasterr)
 Clears the list of peers (makes it empty).
bool isAllowed (UINT32 ip, UINT16 port, UINT32 &lasterr)
 Checks whether a peer is in the list.
bool getReceivePacketIndex (UINT32 ip, UINT16 port, UINT16 &packetindex, UINT32 &lasterr)
bool setReceivePacketIndex (UINT32 ip, UINT16 port, UINT16 packetindex, UINT32 &lasterr)
bool getSendPacketIndex (UINT32 ip, UINT16 port, UINT16 &aNextPacketIndex, UINT32 &lasterr)
 Returns the index of the last packet that was send to the peer.
bool incSendPacketIndex (UINT32 ip, UINT16 port, UINT32 &lasterr)
 Increments the packet index for given peer.

Private Attributes

INT32 m_iQueueFirstElement
INT32 m_iQueueLastElement
INT32 m_iQueueNumElements
NQ_PEER_ENTRY_INTm_pQueueValue
INT32m_iQueueNextElement
INT32 m_iQueueMaxSize
UINT32 m_iLastError


Detailed Description

Definition at line 42 of file NQPeerList.h.


Constructor & Destructor Documentation

CNQPeerList::CNQPeerList (  ) 

Definition at line 12 of file NQPeerList.cpp.

CNQPeerList::~CNQPeerList (  )  [virtual]

Definition at line 38 of file NQPeerList.cpp.


Member Function Documentation

UINT32 CNQPeerList::getLastError (  ) 

Returns last error code happened.

For detailed list of possible error codes, see Declarations.h

See also:
Network Queue Error Codes

Definition at line 752 of file NQPeerList.cpp.

bool CNQPeerList::add ( UINT32  ip,
UINT16  port 
)

Definition at line 50 of file NQPeerList.cpp.

Referenced by CNetworkQueue::addPeer(), and CNetworkQueue::create().

Here is the caller graph for this function:

bool CNQPeerList::remove ( UINT32  ip,
UINT16  port 
)

Definition at line 57 of file NQPeerList.cpp.

Referenced by CNetworkQueue::removePeer().

Here is the caller graph for this function:

bool CNQPeerList::removeAll (  ) 

Definition at line 64 of file NQPeerList.cpp.

Referenced by CNetworkQueue::create().

Here is the caller graph for this function:

bool CNQPeerList::isAllowed ( UINT32  ip,
UINT16  port 
)

Definition at line 87 of file NQPeerList.cpp.

Referenced by CNetworkQueue::ReceiveProcessTask(), CNetworkQueue::sendMsgTo(), and CNetworkQueue::sendMsgToInternal().

Here is the caller graph for this function:

bool CNQPeerList::getReceivePacketIndex ( UINT32  ip,
UINT16  port,
UINT16 packetindex 
)

Definition at line 94 of file NQPeerList.cpp.

Referenced by CNetworkQueue::ReceiveProcessTask().

Here is the caller graph for this function:

bool CNQPeerList::setReceivePacketIndex ( UINT32  ip,
UINT16  port,
UINT16  packetindex 
)

Definition at line 101 of file NQPeerList.cpp.

Referenced by CNetworkQueue::ReceiveProcessTask().

Here is the caller graph for this function:

bool CNQPeerList::getSendPacketIndex ( UINT32  ip,
UINT16  port,
UINT16 aNextPacketIndex 
)

Definition at line 108 of file NQPeerList.cpp.

Referenced by CNetworkQueue::SendProcessTask().

Here is the caller graph for this function:

bool CNQPeerList::incSendPacketIndex ( UINT32  ip,
UINT16  port 
)

Definition at line 115 of file NQPeerList.cpp.

Referenced by CNetworkQueue::SendProcessTask().

Here is the caller graph for this function:

UINT32 CNQPeerList::count (  ) 

Returns the number of elements (number of peers) in the peer list.

Returns:
number of elements contained in the peer list

Definition at line 377 of file NQPeerList.cpp.

bool CNQPeerList::add ( UINT32  ip,
UINT16  port,
UINT32 lasterr 
)

adds a new peer to the list of peers.

Parameters:
ip ip address of peer to add in host byte order
port network port of peer to add in host byte order
lasterr unique error code
Return values:
true successful, element appended OR element was already inside
false failure, something happened (see lasterr)
Errorcodes:

Note:
This method returns true even in case the peer was already added to the list before. This method contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 148 of file NQPeerList.cpp.

Here is the call graph for this function:

bool CNQPeerList::remove ( UINT32  ip,
UINT16  port,
UINT32 lasterr 
)

Removes a peer from the list of peers.

Parameters:
ip ip address of peer to remove in host byte order
port network port of peer to remove in host byte order
lasterr unique error code
Return values:
true successful, element removed
false failure, something happened (see lasterr)
Note:
This method contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 260 of file NQPeerList.cpp.

Here is the call graph for this function:

bool CNQPeerList::removeAll ( UINT32 lasterr  ) 

Clears the list of peers (makes it empty).

Parameters:
lasterr unique error code
Return values:
true successful, peer list is empty now
false failure, something happened (see lasterr)

Definition at line 345 of file NQPeerList.cpp.

Here is the call graph for this function:

bool CNQPeerList::isAllowed ( UINT32  ip,
UINT16  port,
UINT32 lasterr 
)

Checks whether a peer is in the list.

This method checks whether a peer (defined as (ip, port)) is inside the list (and thus, it is allowed to receive packets from and send packets to the peer)

Parameters:
ip ip address of peer to check in host byte order
port network port of peer to check in host byte order
lasterr unique error code
Return values:
true successful, peer is in the list and thus allowed
false peer is not allowed; failure, something happened (see lasterr)
Note:
This method returns false even in case the peer is valid, but mutex locking could not be performed.
See also:
Network Queue Error Codes

Definition at line 482 of file NQPeerList.cpp.

Here is the call graph for this function:

bool CNQPeerList::getReceivePacketIndex ( UINT32  ip,
UINT16  port,
UINT16 packetindex,
UINT32 lasterr 
)

Returns received packet index from given peer.

This method returns the last received packet index that came from the peer, IF there was already a packet received from that peer.

Parameters:
ip ip address of peer in host byte order
port network port of peer in host byte order
packetindex last packet index from peer (on true return code)
lasterr unique error code
Return values:
true successful, packetindex is returned
false failure, something happened (see lasterr)
Note:
This method contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 538 of file NQPeerList.cpp.

Here is the call graph for this function:

bool CNQPeerList::setReceivePacketIndex ( UINT32  ip,
UINT16  port,
UINT16  packetindex,
UINT32 lasterr 
)

Returns the last received packet index from given peer.

This method returns the last received packet index that came from the peer, IF there was already a packet received from that peer.

Parameters:
ip ip address of peer in host byte order
port network port of peer in host byte order
packetindex last packet index from peer (to save inside peerlist)
lasterr unique error code
Return values:
true successful, packetindex was updated inside peerlist
false failure, something happened (see lasterr)
Note:
This method contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 602 of file NQPeerList.cpp.

Here is the call graph for this function:

bool CNQPeerList::getSendPacketIndex ( UINT32  ip,
UINT16  port,
UINT16 aNextPacketIndex,
UINT32 lasterr 
)

Returns the index of the last packet that was send to the peer.

Parameters:
ip ip address of peer in host byte order
port network port of peer in host byte order
aNextPacketIndex last send packet index to peer (on true return code)
lasterr unique error code
Return values:
true successful, last send packet index is returned
false failure, something happened (see lasterr)
Note:
This method contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 657 of file NQPeerList.cpp.

Here is the call graph for this function:

bool CNQPeerList::incSendPacketIndex ( UINT32  ip,
UINT16  port,
UINT32 lasterr 
)

Increments the packet index for given peer.

This method increments the send packet index of the given peer (because a packet was successfully send out by the network queue) by one.

Parameters:
ip ip address of peer in host byte order
port network port of peer in host byte order
lasterr unique error code
Return values:
true successful, send packet index was incremented (by one)
false failure, something happened (see lasterr)
Note:
This method contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 712 of file NQPeerList.cpp.

Here is the call graph for this function:


Member Data Documentation

Definition at line 84 of file NQPeerList.h.

Referenced by add(), CNQPeerList(), remove(), and removeAll().

Definition at line 85 of file NQPeerList.h.

Referenced by add(), CNQPeerList(), count(), remove(), and removeAll().

Definition at line 91 of file NQPeerList.h.

Referenced by add(), CNQPeerList(), and removeAll().


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

Generated on Tue Apr 22 18:19:59 2008 for NetworkQueue by  doxygen 1.5.5