diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2013-02-15 20:53:16 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2013-02-15 20:53:16 +0200 |
commit | 4a2dd17aa0601fffd42f2ec1c92c6a1b79f648d3 (patch) | |
tree | 810c02c1cdd244aebdfebdba888a2a70158ab138 /proto_lib | |
parent | eda5eaf4a1be590b9e4905f322b3e0923f65d312 (diff) |
work on client started (services retrieving implemented)
server services packet handling implemented
Diffstat (limited to 'proto_lib')
-rw-r--r-- | proto_lib/api_protocol.h | 1 | ||||
-rw-r--r-- | proto_lib/packet.cpp | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/proto_lib/api_protocol.h b/proto_lib/api_protocol.h index 9a82e31..ffd7e0f 100644 --- a/proto_lib/api_protocol.h +++ b/proto_lib/api_protocol.h @@ -49,6 +49,7 @@ class packet public: explicit packet(std::vector<unsigned char>&); const std::vector<unsigned char> &raw(); + unsigned char *buf(); packet_type get_type(); bool is_good(); status get_status(); //false on fail diff --git a/proto_lib/packet.cpp b/proto_lib/packet.cpp index 8dc1b12..c4c5da0 100644 --- a/proto_lib/packet.cpp +++ b/proto_lib/packet.cpp @@ -349,4 +349,14 @@ svc_cmd packet::serv_extract_command(packet& p) return c; } +unsigned char *packet::buf() +{ + if(data.empty()) + return NULL; + unsigned char *b = new unsigned char [data.size()]; + for(size_t i = 0; i < data.size(); i ++) + b[i] = data[i]; + return b; +} + }; |