summaryrefslogtreecommitdiff
path: root/proto_lib/protocol.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2013-02-12 13:47:03 +0200
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2013-02-12 13:47:03 +0200
commitb568c0cab255aefd400d48c05e2cabc6ca96c270 (patch)
tree471e2794310b6bb6a53d013327122f43d5518685 /proto_lib/protocol.cpp
parent224d96964ea3c9e541fcd5caa2778af25f71ba2e (diff)
some work with proto library done
Diffstat (limited to 'proto_lib/protocol.cpp')
-rw-r--r--proto_lib/protocol.cpp64
1 files changed, 0 insertions, 64 deletions
diff --git a/proto_lib/protocol.cpp b/proto_lib/protocol.cpp
deleted file mode 100644
index 991f4e4..0000000
--- a/proto_lib/protocol.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright © 2013 sss
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <string>
-#include <list>
-#include <vector>
-#include <algorithm>
-#include "api_protocol.h"
-#include "packet.h"
-
-
-
-bool serv_validate_client_proto(packet &p)
-{
- const std::vector<unsigned char> &data = p.raw();
- if(data.empty())
- return false;
- if(std::search(data.begin(), data.end(), proto_header, proto_header + sizeof(proto_header)) == data.end())
- return false;
- if(std::search(data.begin(), data.end(), proto_footer, proto_footer + sizeof(proto_footer)) == data.end())
- return false;
- std::vector<unsigned char>::const_iterator i = std::search(data.begin(), data.end(), cli_packet, cli_packet + sizeof(cli_packet));
- if(i == data.end())
- return false;
- i += sizeof(cli_packet);
- if(*i < proto_version)
- return false;
- return true;
-}
-
-packet *cli_make_auth_packet()
-{
- std::vector<unsigned char> v;
- int size = sizeof(proto_header);
- for(int i = 0; i < size; i++)
- v.push_back(proto_header[i]);
- size = sizeof(cli_packet);
- for(int i = 0; i < size; i++)
- v.push_back(cli_packet[i]);
- size = sizeof(type_auth);
- for(int i = 0; i < size; i++)
- v.push_back(type_auth[i]);
- v.push_back(proto_version);
- size = sizeof(proto_footer);
- for(int i = 0; i < size; i++)
- v.push_back(proto_footer[i]);
- packet *p = new packet;
- p->assign(v);
- return p;
-}
-