diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2013-02-13 20:32:10 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2013-02-13 20:32:10 +0200 |
commit | 728653fbb36727acfb5a4cd480b7fa5d45adfa89 (patch) | |
tree | 0f5f6c90749571af4375f9ff59f39cecaff6cfac /proto_lib/utilities.cpp | |
parent | 49729a7593320662545b7c795f028d0f87827b0f (diff) |
proto lib fixes
more tests
Diffstat (limited to 'proto_lib/utilities.cpp')
-rw-r--r-- | proto_lib/utilities.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/proto_lib/utilities.cpp b/proto_lib/utilities.cpp index ee5e9b4..2a7d43d 100644 --- a/proto_lib/utilities.cpp +++ b/proto_lib/utilities.cpp @@ -66,13 +66,13 @@ const unsigned char *to_internal_type(packet_type t) const unsigned char *type = NULL; switch(t) { - case TYPE_AUTH_REPLY: case TYPE_AUTH_REQUEST: + case TYPE_AUTH: type = type_auth; break; - case TYPE_SERVICES_REPLY: case TYPE_SERVICES_REQUEST: + case TYPE_SERVICES: type = type_services; break; - case TYPE_COMMAND_REPLY: case TYPE_COMMAND_REQUEST: + case TYPE_COMMAND: type = type_command; break; case TYPE_UNKNOWN: default: @@ -81,6 +81,15 @@ const unsigned char *to_internal_type(packet_type t) return type; } +void make_status_packet(packet_type t, status s, std::vector<unsigned char> &v) +{ + const unsigned char *type = to_internal_type(t); + pack_buffer(type, 2, v); + v.push_back(s); + pack_buffer(proto_footer, sizeof(proto_footer), v); +} + + #ifdef DEBUG bool service_s::cmd::operator==(const cmd& c) const { |