19 #ifndef __MSGHANDLER_H__ 20 #define __MSGHANDLER_H__ 22 #include <csutil/parray.h> 23 #include <csutil/refcount.h> 24 #include <csutil/threading/thread.h> 25 #include <csutil/threading/rwmutex.h> 59 : flags(nFlags), subscriber(nSubscriber)
92 if (nextSequenceNumber > 63)
93 nextSequenceNumber = 1;
95 return nextSequenceNumber;
154 { netbase->SendMessage(msg); }
158 { netbase->Broadcast(msg, scope, guildID); }
176 virtual void Multicast(
MsgEntry* msg, csArray<PublishDestination>& multi, uint32_t except,
float range)
177 { netbase->Multicast(msg, multi, except, range); }
181 csTicks
GetPing() {
return netbase->GetPing(); }
184 bool Flush() {
return netbase->Flush(queue); }
194 CS::Threading::ReadWriteMutex
mutex;
int GetCurrentSequenceNumber()
void AddToLocalQueue(MsgEntry *me)
iNetSubscriber * subscriber
The actual subscriber that wants to be notified.
int IncrementSequenceNumber()
bool operator<(const Subscription &other) const
The structure of 1 queue entry (pointer to a message)
csHash< Subscription, msgtype > subscribers
Stores the hash of all subscribers and the message type they are subscribed to.
Manages a iNetSubscriber watching a certain message type.
virtual void SendMessage(MsgEntry *msg)
Allows subscribers to respond with new messages.
Subscription(iNetSubscriber *nSubscriber, uint32_t nFlags=0x01)
Constructor without a callback.
This interface must be implemented by objects that want to receive network messages.
virtual void Broadcast(MsgEntry *msg, broadcasttype scope=NetBase::BC_EVERYONEBUTSELF, int guildID=-1)
Send messages to many clients with one func call.
csRefArray< MsgEntry > pendingMessages
virtual void Multicast(MsgEntry *msg, csArray< PublishDestination > &multi, uint32_t except, float range)
Sends the given message me to all the clients in the list.
This class acts as a base for client/server net classes.
This class collects data of a netclient.
void void Initialize(iObjectRegistry *object_reg)
A queue of smart pointers with locking facilties for multi-threading.
NetBase::broadcasttype broadcasttype
import the broadcasttype
This class is the client's and server's main interface for either sending network messages out or get...
bool Flush()
Flush the connected output queue.
This class holds the structure for guaranteed inbound ordering of certain message types...
CS::Threading::ReadWriteMutex mutex
Protects subscribers.
uint32_t flags
Additional flags for detecting if the subscriber should be notified.