|
|
@ -73,16 +73,16 @@ class KMessageServerPrivate;
|
|
|
|
|
|
|
|
|
|
|
|
Here is a list of the messages the KMessageServer understands:
|
|
|
|
Here is a list of the messages the KMessageServer understands:
|
|
|
|
<< means, the value is inserted into the TQByteArray using TQDataStream. The
|
|
|
|
<< means, the value is inserted into the TQByteArray using TQDataStream. The
|
|
|
|
messageIDs (RETQ_BROADCAST, ...) are of type TQ_UINT32.
|
|
|
|
messageIDs (REQ_BROADCAST, ...) are of type TQ_UINT32.
|
|
|
|
|
|
|
|
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( RETQ_BROADCAST ) << raw_data
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( REQ_BROADCAST ) << raw_data
|
|
|
|
|
|
|
|
|
|
|
|
When the server receives this message, it sends the following message to
|
|
|
|
When the server receives this message, it sends the following message to
|
|
|
|
ALL connected clients (a broadcast), where the raw_data is left unchanged:
|
|
|
|
ALL connected clients (a broadcast), where the raw_data is left unchanged:
|
|
|
|
TQByteArray << static_cast <TQ_UINT32>( MSG_BROADCAST ) << clientID << raw_data
|
|
|
|
TQByteArray << static_cast <TQ_UINT32>( MSG_BROADCAST ) << clientID << raw_data
|
|
|
|
TQ_UINT32 clientID; // the ID of the client that sent the broadcast request
|
|
|
|
TQ_UINT32 clientID; // the ID of the client that sent the broadcast request
|
|
|
|
|
|
|
|
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( RETQ_FORWARD ) << client_list << raw_data
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( REQ_FORWARD ) << client_list << raw_data
|
|
|
|
TQValueList <TQ_UINT32> client_list; // list of receivers
|
|
|
|
TQValueList <TQ_UINT32> client_list; // list of receivers
|
|
|
|
|
|
|
|
|
|
|
|
When the server receives this message, it sends the following message to
|
|
|
|
When the server receives this message, it sends the following message to
|
|
|
@ -93,10 +93,10 @@ class KMessageServerPrivate;
|
|
|
|
|
|
|
|
|
|
|
|
Note: Every client receives the message as many times as he is in the client_list.
|
|
|
|
Note: Every client receives the message as many times as he is in the client_list.
|
|
|
|
Note: Since the client_list is sent to all the clients, every client can see who else
|
|
|
|
Note: Since the client_list is sent to all the clients, every client can see who else
|
|
|
|
got the message. If you want to prevent this, send a single RETQ_FORWARD
|
|
|
|
got the message. If you want to prevent this, send a single REQ_FORWARD
|
|
|
|
message for every receiver.
|
|
|
|
message for every receiver.
|
|
|
|
|
|
|
|
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( RETQ_CLIENT_ID )
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( REQ_CLIENT_ID )
|
|
|
|
|
|
|
|
|
|
|
|
When the server receives this message, it sends the following message to
|
|
|
|
When the server receives this message, it sends the following message to
|
|
|
|
the asking client:
|
|
|
|
the asking client:
|
|
|
@ -107,7 +107,7 @@ class KMessageServerPrivate;
|
|
|
|
can store his ID. The ID of a client doesn't change during his lifetime, and is
|
|
|
|
can store his ID. The ID of a client doesn't change during his lifetime, and is
|
|
|
|
unique for this KMessageServer.
|
|
|
|
unique for this KMessageServer.
|
|
|
|
|
|
|
|
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( RETQ_ADMIN_ID )
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( REQ_ADMIN_ID )
|
|
|
|
|
|
|
|
|
|
|
|
When the server receives this message, it sends the following message to
|
|
|
|
When the server receives this message, it sends the following message to
|
|
|
|
the asking client:
|
|
|
|
the asking client:
|
|
|
@ -116,9 +116,9 @@ class KMessageServerPrivate;
|
|
|
|
|
|
|
|
|
|
|
|
Note: This answer is also automatically sent to a new connected client, so that he
|
|
|
|
Note: This answer is also automatically sent to a new connected client, so that he
|
|
|
|
can see if he is the admin or not. It will also be sent to all connected clients
|
|
|
|
can see if he is the admin or not. It will also be sent to all connected clients
|
|
|
|
when a new admin is set (see RETQ_ADMIN_CHANGE).
|
|
|
|
when a new admin is set (see REQ_ADMIN_CHANGE).
|
|
|
|
|
|
|
|
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( RETQ_ADMIN_CHANGE ) << new_admin
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( REQ_ADMIN_CHANGE ) << new_admin
|
|
|
|
TQ_UINT32 new_admin; // the ID of the new admin, or 0 for no admin
|
|
|
|
TQ_UINT32 new_admin; // the ID of the new admin, or 0 for no admin
|
|
|
|
|
|
|
|
|
|
|
|
When the server receives this message, it sets the admin to the new ID. If no client
|
|
|
|
When the server receives this message, it sets the admin to the new ID. If no client
|
|
|
@ -127,7 +127,7 @@ class KMessageServerPrivate;
|
|
|
|
|
|
|
|
|
|
|
|
Note: The server sends a ANS_ADMIN_ID message to every connected client.
|
|
|
|
Note: The server sends a ANS_ADMIN_ID message to every connected client.
|
|
|
|
|
|
|
|
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( RETQ_REMOVE_CLIENT ) << client_list
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( REQ_REMOVE_CLIENT ) << client_list
|
|
|
|
TQValueList <TQ_UINT32> client_list; // The list of clients to be removed
|
|
|
|
TQValueList <TQ_UINT32> client_list; // The list of clients to be removed
|
|
|
|
|
|
|
|
|
|
|
|
When the server receives this message, it removes the clients with the ids stored in
|
|
|
|
When the server receives this message, it removes the clients with the ids stored in
|
|
|
@ -137,7 +137,7 @@ class KMessageServerPrivate;
|
|
|
|
Note: If one of the clients is the admin himself, he will also be deleted.
|
|
|
|
Note: If one of the clients is the admin himself, he will also be deleted.
|
|
|
|
Another client (if any left) will become the new admin.
|
|
|
|
Another client (if any left) will become the new admin.
|
|
|
|
|
|
|
|
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( RETQ_MAX_NUM_CLIENTS ) << maximum_clients
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( REQ_MAX_NUM_CLIENTS ) << maximum_clients
|
|
|
|
TQ_INT32 maximum_clients; // The maximum of clients connected, or infinite if -1
|
|
|
|
TQ_INT32 maximum_clients; // The maximum of clients connected, or infinite if -1
|
|
|
|
|
|
|
|
|
|
|
|
When the server receives this message, it limits the number of clients to the number given,
|
|
|
|
When the server receives this message, it limits the number of clients to the number given,
|
|
|
@ -145,9 +145,9 @@ class KMessageServerPrivate;
|
|
|
|
ONLY THE ADMIN CAN USE THIS MESSAGE!
|
|
|
|
ONLY THE ADMIN CAN USE THIS MESSAGE!
|
|
|
|
|
|
|
|
|
|
|
|
Note: If there are already more clients, they are not affected. It only prevents new Clients
|
|
|
|
Note: If there are already more clients, they are not affected. It only prevents new Clients
|
|
|
|
to be added. To assure this limit, remove clients afterwards (RETQ_REMOVE_CLIENT)
|
|
|
|
to be added. To assure this limit, remove clients afterwards (REQ_REMOVE_CLIENT)
|
|
|
|
|
|
|
|
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( RETQ_CLIENT_LIST )
|
|
|
|
- TQByteArray << static_cast<TQ_UINT32>( REQ_CLIENT_LIST )
|
|
|
|
|
|
|
|
|
|
|
|
When the server receives this message, it answers by sending a list of IDs of all the clients
|
|
|
|
When the server receives this message, it answers by sending a list of IDs of all the clients
|
|
|
|
that are connected at the moment. So it sends the following message to the asking client:
|
|
|
|
that are connected at the moment. So it sends the following message to the asking client:
|
|
|
@ -182,15 +182,15 @@ public:
|
|
|
|
MessageIDs for messages from a client to the message server.
|
|
|
|
MessageIDs for messages from a client to the message server.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
enum {
|
|
|
|
RETQ_BROADCAST = 1,
|
|
|
|
REQ_BROADCAST = 1,
|
|
|
|
RETQ_FORWARD,
|
|
|
|
REQ_FORWARD,
|
|
|
|
RETQ_CLIENT_ID,
|
|
|
|
REQ_CLIENT_ID,
|
|
|
|
RETQ_ADMIN_ID,
|
|
|
|
REQ_ADMIN_ID,
|
|
|
|
RETQ_ADMIN_CHANGE,
|
|
|
|
REQ_ADMIN_CHANGE,
|
|
|
|
RETQ_REMOVE_CLIENT,
|
|
|
|
REQ_REMOVE_CLIENT,
|
|
|
|
RETQ_MAX_NUM_CLIENTS,
|
|
|
|
REQ_MAX_NUM_CLIENTS,
|
|
|
|
RETQ_CLIENT_LIST,
|
|
|
|
REQ_CLIENT_LIST,
|
|
|
|
RETQ_MAX_REQ = 0xffff };
|
|
|
|
REQ_MAX_REQ = 0xffff };
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* MessageIDs for messages from the message server to a client.
|
|
|
|
* MessageIDs for messages from the message server to a client.
|
|
|
|