summaryrefslogtreecommitdiff
path: root/proto_lib/api_protocol.h
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2013-02-13 20:32:10 +0200
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2013-02-13 20:32:10 +0200
commit728653fbb36727acfb5a4cd480b7fa5d45adfa89 (patch)
tree0f5f6c90749571af4375f9ff59f39cecaff6cfac /proto_lib/api_protocol.h
parent49729a7593320662545b7c795f028d0f87827b0f (diff)
proto lib fixes
more tests
Diffstat (limited to 'proto_lib/api_protocol.h')
-rw-r--r--proto_lib/api_protocol.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/proto_lib/api_protocol.h b/proto_lib/api_protocol.h
index afa8224..9a82e31 100644
--- a/proto_lib/api_protocol.h
+++ b/proto_lib/api_protocol.h
@@ -41,7 +41,7 @@ struct svc_cmd
std::string service, command;
};
-enum packet_type {TYPE_AUTH_REPLY, TYPE_AUTH_REQUEST, TYPE_SERVICES_REPLY, TYPE_SERVICES_REQUEST, TYPE_COMMAND_REPLY, TYPE_COMMAND_REQUEST, TYPE_CUSTOM, TYPE_UNKNOWN};
+enum packet_type {TYPE_AUTH, TYPE_SERVICES, TYPE_COMMAND, TYPE_CUSTOM, TYPE_UNKNOWN};
enum status {STATUS_FAILURE = 0x00, STATUS_SUCCESS = 0x01};
class packet
@@ -51,7 +51,7 @@ public:
const std::vector<unsigned char> &raw();
packet_type get_type();
bool is_good();
- bool check_status(); //false on fail
+ status get_status(); //false on fail
bool is_server_packet();
bool is_client_packet();
bool is_status_packet();
@@ -64,6 +64,7 @@ public:
static packet *cli_make_command_packet(std::string &service, std::string &command);
static packet *cli_make_command_packet(const char* service, const char* command);
static packet *cli_make_request_services_packet();
+ static packet *cli_make_status_packet(packet_type type, status s);
static std::list<service_s> *cli_extract_services(packet&);
static std::string cli_parse_command_reply(packet&);
@@ -72,12 +73,11 @@ public:
static bool serv_validate_client_proto(packet&); //false on fail
static packet *serv_make_services_packet(std::list<service_s>&);
static packet *serv_make_command_reply_packet(std::string&, status s);
+ static packet *serv_make_command_reply_packet(const char*, status s);
static packet *serv_make_command_reply_packet(std::vector<unsigned char>&, status s);
+ static packet *serv_make_status_packet(packet_type type, status s);
static svc_cmd serv_extract_command(packet&);
- //generic
- static packet *make_status_packet(packet_type type, status s);
-
private:
std::vector<unsigned char> data;
};