Changeset 510

Show
Ignore:
Timestamp:
04/10/06 15:39:23 (2 years ago)
Author:
dp
Message:

service-gotek2

  • send 4 bytes packet size instead of 2
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • library/trunk/modules/service-gotek2/GotekPacket.cpp

    r507 r510  
    1919 
    2020        m_type = (GotekPacketType)readUInt8(); 
    21         readUInt16(); 
     21 
     22        uint32_t size = readUInt32(); 
     23 
     24        if( size != m_data.size() ) 
     25        { 
     26                m_options |= GotekBad; 
     27                throw GotekException(string("Packet size information does not match actual packet size!")); 
     28        } 
    2229} 
    2330 
     
    4552        string packet; 
    4653         
    47         uint16_t nsize = htons(m_data.size()); 
     54        uint32_t nsize = htonl(m_data.size()); 
    4855         
    4956        packet.push_back((unsigned char)type()); 
    50         packet.push_back((unsigned char)(nsize >> 8)); 
     57        packet.push_back((unsigned char)(nsize >> 24)); 
     58        packet.push_back((unsigned char)((nsize >> 16) & 0xff)); 
     59        packet.push_back((unsigned char)((nsize >> 8) & 0xff)); 
    5160        packet.push_back((unsigned char)(nsize & 0xff)); 
    5261