Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6053 in orxonox.OLD for branches/network/src/lib/network/handshake.h


Ignore:
Timestamp:
Dec 11, 2005, 6:01:04 PM (18 years ago)
Author:
rennerc
Message:

handshake works now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/handshake.h

    r6043 r6053  
    1717
    1818typedef enum HandshakeState {
    19   HS_SEND_INIT = 0,
    20   HS_RECV_INIT,
    21   HS_SEND_VERSION,
    22   HS_RECV_VERSION,
    23   HS_SEND_ID,
    24   HS_RECV_ID,
    25   HS_COMPLETED,
     19  HS_SENT_INIT  = 0x00000001,
     20  HS_RECVD_INIT = 0x00000002,
     21  HS_SENT_VER   = 0x00000004,
     22  HS_RECVD_VER  = 0x00000008,
     23  HS_SENT_HID   = 0x00000010,
     24  HS_RECVD_HID  = 0x00000020,
     25  HS_COMPLETED  = 0X00000040,
    2626
    2727  NUM_STATES
     
    3232  public:
    3333    Handshake(bool server, int clientId = 0);
    34     inline bool       completed(){ return state == HS_COMPLETED; }
     34    inline bool       completed(){ return hasState( HS_COMPLETED ); }
    3535    inline bool       ok(){ return isOk; }
    3636    inline int        getHostId(){ return newHostId; }
    3737
    3838    virtual void      writeBytes(const byte* data, int length);
    39     virtual int       readBytes(byte* data, int maxLength, int& reciever);
     39    virtual int       readBytes(byte* data, int maxLength, int * reciever);
    4040    virtual void      writeDebug() const;
    4141    virtual void      readDebug() const;
     
    4343  private:
    4444    int               state;
    45     int               server;
    4645    int               clientId;
    4746    int               newHostId;
    4847    bool              isOk;
     48
     49    inline bool       hasState( int a ){ return (state & a) == a; }
     50    inline void       setState( int a ){ state = state | a; }
     51    inline void       unsetState( int a ){ state = state & (~a); }
    4952
    5053};
Note: See TracChangeset for help on using the changeset viewer.