6 #define PROTOCOL_MAXPAYLOAD 255
10 enum Type { PUT, FIND, DEL, QUIT };
11 enum Result { OK, NOT_FOUND, EXISTS };
13 unsigned char type: 2; // 2 bits para tipo
14 unsigned char end: 1; // 1 bit para marca de FIN
15 unsigned char client_id: 5; // 5 bits para id de cliente
16 char payload[PROTOCOL_MAXPAYLOAD];
20 Protocol(unsigned type, unsigned end, unsigned client_id, const char* p):
21 type(type), end(end), client_id(client_id)
24 strncpy(payload, p, PROTOCOL_MAXPAYLOAD);
31 #endif // _PROTOCOL_H_
33 // vim: set et sw=4 sts=4 :