summaryrefslogtreecommitdiff
path: root/proto_lib/api_protocol.h
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2013-02-12 14:23:46 +0200
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2013-02-12 14:23:46 +0200
commit1e4aaa2f93cc0a5c394a03d53c6707fe98c0c1c2 (patch)
treee727e815d5d74cc5387d7c0d567cf31849172ee2 /proto_lib/api_protocol.h
parentb568c0cab255aefd400d48c05e2cabc6ca96c270 (diff)
working with proto lib
Diffstat (limited to 'proto_lib/api_protocol.h')
-rw-r--r--proto_lib/api_protocol.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/proto_lib/api_protocol.h b/proto_lib/api_protocol.h
index 452d6dc..af6d84b 100644
--- a/proto_lib/api_protocol.h
+++ b/proto_lib/api_protocol.h
@@ -34,12 +34,14 @@ enum status {failure = 0x00, success = 0x01};
class packet
{
public:
- packet(std::vector<unsigned char>&);
+ explicit packet(std::vector<unsigned char>&);
const std::vector<unsigned char> &raw();
packet_type get_type();
bool is_good();
+ bool check_status(); //false on fail
bool is_server_packet();
bool is_client_packet();
+ bool is_status_packet();
bool assign(packet&);
bool assign(std::vector<unsigned char>&);
@@ -53,16 +55,13 @@ public:
static std::string cli_parse_command_reply(packet&);
//server functions
- static bool serv_validate_client_proto(packet&);
+ static bool serv_validate_client_proto(packet&); //false on fail
static packet *serv_make_services_packet(std::list<service_s>&);
//generic
- static packet *make_status_packet(const unsigned char* type, status s);
- static bool check_status_packet(const unsigned char *type, packet&); //false on fail
-
+ static packet *make_status_packet(packet_type type, status s);
private:
- packet();
std::vector<unsigned char> data;
};