#include <NQPeerList.h>
Inherits CNQLockMechanism.
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_INT * | m_pQueueValue |
INT32 * | m_iQueueNextElement |
INT32 | m_iQueueMaxSize |
UINT32 | m_iLastError |
Definition at line 42 of file NQPeerList.h.
CNQPeerList::CNQPeerList | ( | ) |
Definition at line 12 of file NQPeerList.cpp.
CNQPeerList::~CNQPeerList | ( | ) | [virtual] |
Definition at line 38 of file NQPeerList.cpp.
UINT32 CNQPeerList::getLastError | ( | ) |
Returns last error code happened.
For detailed list of possible error codes, see Declarations.h
Definition at line 752 of file NQPeerList.cpp.
Definition at line 50 of file NQPeerList.cpp.
Referenced by CNetworkQueue::addPeer(), and CNetworkQueue::create().
Definition at line 57 of file NQPeerList.cpp.
Referenced by CNetworkQueue::removePeer().
bool CNQPeerList::removeAll | ( | ) |
Definition at line 64 of file NQPeerList.cpp.
Referenced by CNetworkQueue::create().
Definition at line 87 of file NQPeerList.cpp.
Referenced by CNetworkQueue::ReceiveProcessTask(), CNetworkQueue::sendMsgTo(), and CNetworkQueue::sendMsgToInternal().
Definition at line 94 of file NQPeerList.cpp.
Referenced by CNetworkQueue::ReceiveProcessTask().
Definition at line 101 of file NQPeerList.cpp.
Referenced by CNetworkQueue::ReceiveProcessTask().
Definition at line 108 of file NQPeerList.cpp.
Referenced by CNetworkQueue::SendProcessTask().
Definition at line 115 of file NQPeerList.cpp.
Referenced by CNetworkQueue::SendProcessTask().
UINT32 CNQPeerList::count | ( | ) |
Returns the number of elements (number of peers) in the peer list.
Definition at line 377 of file NQPeerList.cpp.
adds a new peer to the list of peers.
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 |
true | successful, element appended OR element was already inside | |
false | failure, something happened (see lasterr) |
This
method contains assert() which gives more failure reasons during development/debugging.Definition at line 148 of file NQPeerList.cpp.
Removes a peer from the list of peers.
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 |
true | successful, element removed | |
false | failure, something happened (see lasterr)
|
Definition at line 260 of file NQPeerList.cpp.
bool CNQPeerList::removeAll | ( | UINT32 & | lasterr | ) |
Clears the list of peers (makes it empty).
lasterr | unique error code |
true | successful, peer list is empty now | |
false | failure, something happened (see lasterr)
|
Definition at line 345 of file NQPeerList.cpp.
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)
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 |
true | successful, peer is in the list and thus allowed | |
false | peer is not allowed; failure, something happened (see lasterr)
|
Definition at line 482 of file NQPeerList.cpp.
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.
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 |
true | successful, packetindex is returned | |
false | failure, something happened (see lasterr)
|
Definition at line 538 of file NQPeerList.cpp.
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.
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 |
true | successful, packetindex was updated inside peerlist | |
false | failure, something happened (see lasterr)
|
Definition at line 602 of file NQPeerList.cpp.
bool CNQPeerList::getSendPacketIndex | ( | UINT32 | ip, | |
UINT16 | port, | |||
UINT16 & | aNextPacketIndex, | |||
UINT32 & | lasterr | |||
) |
Returns the index of the last packet that was send to the peer.
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 |
true | successful, last send packet index is returned | |
false | failure, something happened (see lasterr)
|
Definition at line 657 of file NQPeerList.cpp.
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.
ip | ip address of peer in host byte order | |
port | network port of peer in host byte order | |
lasterr | unique error code |
true | successful, send packet index was incremented (by one) | |
false | failure, something happened (see lasterr)
|
Definition at line 712 of file NQPeerList.cpp.
INT32 CNQPeerList::m_iQueueFirstElement [private] |
Definition at line 83 of file NQPeerList.h.
Referenced by add(), CNQPeerList(), getReceivePacketIndex(), getSendPacketIndex(), incSendPacketIndex(), isAllowed(), remove(), removeAll(), and setReceivePacketIndex().
INT32 CNQPeerList::m_iQueueLastElement [private] |
Definition at line 84 of file NQPeerList.h.
Referenced by add(), CNQPeerList(), remove(), and removeAll().
INT32 CNQPeerList::m_iQueueNumElements [private] |
Definition at line 85 of file NQPeerList.h.
Referenced by add(), CNQPeerList(), count(), remove(), and removeAll().
NQ_PEER_ENTRY_INT* CNQPeerList::m_pQueueValue [private] |
Definition at line 88 of file NQPeerList.h.
Referenced by add(), CNQPeerList(), getReceivePacketIndex(), getSendPacketIndex(), incSendPacketIndex(), isAllowed(), remove(), removeAll(), setReceivePacketIndex(), and ~CNQPeerList().
INT32* CNQPeerList::m_iQueueNextElement [private] |
Definition at line 89 of file NQPeerList.h.
Referenced by add(), CNQPeerList(), getReceivePacketIndex(), getSendPacketIndex(), incSendPacketIndex(), isAllowed(), remove(), removeAll(), setReceivePacketIndex(), and ~CNQPeerList().
INT32 CNQPeerList::m_iQueueMaxSize [private] |
UINT32 CNQPeerList::m_iLastError [private] |
Definition at line 93 of file NQPeerList.h.
Referenced by add(), CNQPeerList(), getLastError(), getReceivePacketIndex(), getSendPacketIndex(), incSendPacketIndex(), isAllowed(), remove(), removeAll(), and setReceivePacketIndex().