| 1 |
// PR c++/15209 |
| 2 |
// { dg-options "-w" } |
| 3 |
|
| 4 |
__extension__ typedef __SIZE_TYPE__ size_t; |
| 5 |
typedef unsigned char uint8_t; |
| 6 |
typedef unsigned short int uint16_t; |
| 7 |
|
| 8 |
typedef unsigned int uint32_t; |
| 9 |
__extension__ typedef unsigned long long int uint64_t; |
| 10 |
|
| 11 |
typedef uint8_t u8; |
| 12 |
typedef uint16_t u16; |
| 13 |
typedef uint32_t u32; |
| 14 |
typedef uint64_t u64; |
| 15 |
|
| 16 |
struct MAGIC {u8 magic[8];} __attribute__ ((packed)); |
| 17 |
struct PACKETTYPE {u8 type[16];} __attribute__ ((packed)); |
| 18 |
|
| 19 |
|
| 20 |
typedef u16 leu16; |
| 21 |
typedef u32 leu32; |
| 22 |
typedef u64 leu64; |
| 23 |
|
| 24 |
class MD5Hash |
| 25 |
{ |
| 26 |
public: |
| 27 |
|
| 28 |
MD5Hash(void) {}; |
| 29 |
|
| 30 |
void *print(void) const; |
| 31 |
MD5Hash(const MD5Hash &other); |
| 32 |
MD5Hash& operator=(const MD5Hash &other); |
| 33 |
|
| 34 |
public: |
| 35 |
u8 hash[16]; |
| 36 |
}; |
| 37 |
|
| 38 |
struct PACKET_HEADER |
| 39 |
{ |
| 40 |
|
| 41 |
MAGIC magic; |
| 42 |
leu64 length; |
| 43 |
MD5Hash hash; |
| 44 |
MD5Hash setid; |
| 45 |
PACKETTYPE type; |
| 46 |
} __attribute__ ((packed)); |
| 47 |
|
| 48 |
|
| 49 |
struct MAINPACKET |
| 50 |
{ |
| 51 |
PACKET_HEADER header; |
| 52 |
|
| 53 |
leu64 blocksize; |
| 54 |
leu32 recoverablefilecount; |
| 55 |
MD5Hash fileid[0]; |
| 56 |
|
| 57 |
|
| 58 |
} __attribute__ ((packed)); |
| 59 |
|
| 60 |
struct CriticalPacket |
| 61 |
{ |
| 62 |
u8 *packetdata; |
| 63 |
size_t packetlength; |
| 64 |
}; |
| 65 |
|
| 66 |
class MainPacket : public CriticalPacket |
| 67 |
{ |
| 68 |
const MD5Hash& SetId(void) const; |
| 69 |
|
| 70 |
u64 blocksize; |
| 71 |
u32 totalfilecount; |
| 72 |
u32 recoverablefilecount; |
| 73 |
}; |
| 74 |
|
| 75 |
inline const MD5Hash& MainPacket::SetId(void) const |
| 76 |
{ |
| 77 |
return ((const MAINPACKET*)packetdata)->header.setid; |
| 78 |
} |