Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9524 in orxonox.OLD for branches/proxy/src/lib


Ignore:
Timestamp:
Jul 27, 2006, 8:57:19 PM (18 years ago)
Author:
patrick
Message:

receiver type is transmitted also since it is needed for message relays

Location:
branches/proxy/src/lib/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/message_manager.cc

    r9523 r9524  
    107107  for ( std::list<NetworkMessage>::iterator it = outgoingMessageQueue[userId].messages.begin(); it != outgoingMessageQueue[userId].messages.end(); it++ )
    108108  {
     109    // send data length
    109110    n = Converter::intToByteArray( it->length, data + i, maxLength );
    110111    i += n;
    111112    assert( n == INTSIZE );
    112113
     114    // send serial number
    113115    n = Converter::intToByteArray( it->number, data + i, maxLength );
    114116    i += n;
    115117    assert( n == INTSIZE );
    116118
     119    // send message type
    117120    n = Converter::intToByteArray( it->messageType, data + i, maxLength );
    118121    i += n;
    119122    assert( n == INTSIZE );
    120123
     124    // send sender id
    121125    n = Converter::intToByteArray( it->senderId, data + i, maxLength );
    122126    i += n;
    123127    assert( n == INTSIZE );
    124128
     129    // send destination id
    125130    n = Converter::intToByteArray( it->destinationId, data + i, maxLength );
    126131    i += n;
    127132    assert( n == INTSIZE );
    128133
     134    // send receiver type
     135    n = Converter::intToByteArray( it->recieverType, data + i, maxLength );
     136    i += n;
     137    assert( n == INTSIZE );
     138
     139    // and copy the data
    129140    assert( i + it->length <= maxLength );
    130141    memcpy( data + i, it->data, it->length );
     
    180191
    181192  int messageLength, messageType;
    182   int senderId, destinationId;
     193  int senderId, destinationId, recieverType;
    183194
    184195  // now go through all newly received messages and assemble them
     
    215226    i += n;
    216227
     228    // read the receiver type
     229    assert( i + INTSIZE <= length );
     230    n = Converter::byteArrayToInt( data + i, &recieverType);
     231    assert( n == INTSIZE );
     232    i += n;
    217233
    218234    if ( number > 0 )
     
    249265          msg.number = userId;
    250266          msg.senderId = senderId;
     267          msg.recieverType = (RecieverType)recieverType;
    251268          msg.destinationId = destinationId;
    252269
     
    273290          msg.senderId = senderId;
    274291          msg.destinationId = destinationId;
    275 
    276           incomingMessageQueue.push_back( msg );
     292          msg.recieverType = (RecieverType)recieverType;
     293#warning do the actual forwarding
     294//           void sendMessage( MessageType messageType, byte * data, int dataLength, RecieverType recieverType, int reciever, MessagePriority messagePriority );
     295
     296//           this->sendMessage(messageType, messageHandlerMap[(MessageType)messageType].someData,
    277297        }
    278298      }
     
    409429      msg.senderId = SharedNetworkData::getInstance()->getHostID();
    410430      msg.destinationId = reciever;
     431      msg.recieverType = recieverType;
    411432      msg.priority = messagePriority;
    412433
     
    425446      msg.senderId = SharedNetworkData::getInstance()->getHostID();
    426447      msg.destinationId = reciever;
     448      msg.recieverType = recieverType;
    427449      msg.priority = messagePriority;
    428450
     
    448470      msg.senderId = SharedNetworkData::getInstance()->getHostID();
    449471      msg.destinationId = reciever;
     472      msg.recieverType = recieverType;
    450473      msg.priority = messagePriority;
    451474
     
    469492    msg.senderId = SharedNetworkData::getInstance()->getHostID();
    470493    msg.destinationId = reciever;
     494    msg.recieverType = recieverType;
    471495    msg.priority = messagePriority;
    472496
  • branches/proxy/src/lib/network/message_manager.h

    r9521 r9524  
    4242typedef bool (*MessageCallback)( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId );
    4343
    44 enum RecieverType
     44typedef enum RecieverType
    4545{
    4646  RT_ALL_BUT_ME = 1,   //!< message is sent to all users but myself
     
    6767  int              senderId;                            //!< userId of the sender
    6868  int              destinationId;                       //!< userId of the destination
     69  RecieverType     recieverType;                        //!< type of the receiver
    6970  MessagePriority  priority;                            //!< priority of the messages
    7071};
Note: See TracChangeset for help on using the changeset viewer.