Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6061 in orxonox.OLD for branches/network


Ignore:
Timestamp:
Dec 12, 2005, 2:14:56 PM (19 years ago)
Author:
bwuest
Message:

Network protocol: Protocol changed

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

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_protocol.cc

    r6060 r6061  
    6767    return -1;
    6868
    69 //   for(int i = 0; i < length; i++)
    70 //     printf("send byte[%i]=%u\n", i, data[i]);
    7169
    72 
    73   //Create space for the header
     70  // FIXME: without move Create space for the header
    7471  for( int i = length - 1; i >= 0; i--)
    7572    data[i + this->headerLength] = data[i];
    7673
    7774  //Now create the header
    78   /* protocol identifier */
    79   data[0] = 255;
    80   /* version number */
    81   data[1] = 0;
    8275  /* sender ID: FIXME: there will be a better ID (for example unique:D)*/
    83   data[2] = (byte)(source.getUniqueID());
     76  data[0] = (byte)(source.getUniqueID());
    8477  /* data length*/
    85   data[3] = length;
     78  data[1] = length;
    8679
    8780
     
    10396    PRINTF(0)("Received data is to short; it can't contain a header!\n");
    10497    Header h;
    105     h.protocol = 0;
     98    h.length = 0;
    10699    return h;
    107100  }
     
    111104  //&h = data;
    112105
    113   h.protocol = data[0];
    114   /* version number */
    115   h.version = data[1];
    116106  /* unique ID */
    117   h.synchronizeableID = data[2];
     107  h.synchronizeableID = data[0];
    118108  /* data length*/
    119   h.length = data[3];
     109  h.length = data[1];
    120110
    121 
    122 //   for(int i = 0; i < length; i++)
    123 //     printf("recS byte[%i]=%u\n", i, data[i]);
    124 
    125   //Remove header
    126 //   for (int i = headerLength; i < length; i++)
    127 //     data[i - headerLength] = data[i];
    128111
    129112  return h;
  • branches/network/src/lib/network/network_protocol.h

    r6060 r6061  
    66#define _NETWORK_PROTOCOL_H
    77
     8/* include base_object.h since all classes are derived from this one */
    89#include "base_object.h"
    910
     
    1112#include "netdefs.h"
    1213
    13 #define HEADER_LENGTH 1
    14 
    1514typedef struct Header
    1615{
    17   byte protocol;
    18   byte version;
    1916  byte synchronizeableID;
    2017  byte length;
Note: See TracChangeset for help on using the changeset viewer.