deletes more old files

This commit is contained in:
Peter Thorson
2011-12-02 08:44:01 -06:00
parent 88fb43d799
commit 280d6522be
3 changed files with 1 additions and 189 deletions

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2011, Peter Thorson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the WebSocket++ Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef WEBSOCKET_BASIC_MESSAGE_HPP
#define WEBSOCKET_BASIC_MESSAGE_HPP
#include <iostream>
namespace websocketpp {
namespace message {
class basic {
public:
basic() {}
// copy up to `size` bytes from input into the internal payload buffer and
// perform any transformations required by the message type. Returns the
// number of bytes actually processed.
virtual uint64_t process_payload(std::istream& input,uint64_t size) = 0;
// return the opcode that this message is configured to manage
opcode::value get_opcode() const {
return m_opcode;
};
protected:
opcode::value m_opcode;
};
typedef boost::shared_ptr<basic> ptr;
} // namespace message
} // namespace websocketpp
#endif // WEBSOCKET_BASIC_MESSAGE_HPP

View File

@@ -1,118 +0,0 @@
/*
* Copyright (c) 2011, Peter Thorson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the WebSocket++ Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef WEBSOCKET_UTF8_MESSAGE_HPP
#define WEBSOCKET_UTF8_MESSAGE_HPP
#include "basic_message.hpp"
namespace websocketpp {
namespace message {
class utf8 : public basic {
public:
utf8() {
m_payload.reserve(SIZE_INIT);
}
uint64_t process_payload(std::istream& input,uint64_t size) {
char c;
const uint64_t new_size = m_payload.size() + size;
if (new_size > SIZE_MAX) {
// TODO: real exception
throw "message too big exception";
}
if (new_size > m_payload.capacity()) {
m_payload.reserve(max(new_size,2*m_payload.capacity()));
}
for (uint64_t i = 0; i < size; ++i) {
if (input.good()) {
c = input.get();
} else if (input.eof()) {
break;
} else {
// istream read error? throw?
}
if (input.good()) {
// process c
if (m_masking_key) {
c = c ^ m_masking_key[m_masking_index++%4];
}
if (!m_validator.consume(static_cast<uint32_t>(c))) {
// TODO
throw "bad utf8";
}
// add c to payload
m_payload.push_back(c);
} else if (input.eof()) {
break;
} else {
// istream read error? throw?
}
}
// we have read all bytes in the message.
return i;
}
void complete() {
if (m_validator.complete()) {
// TODO
throw "bad utf8";
}
}
void reset(opcode::value opcode, uint32_t masking_key) {
m_opcode = opcode;
m_masking_key = masking_key;
m_masking_index = 0;
m_payload.resize(0);
m_validator.reset();
}
private:
static const uint64_t SIZE_INIT = 1000000; // 1MB
static const uint64_t SIZE_MAX = 100000000;// 100MB
uint64_t m_max_size;
utf8_validator::validator m_validator;
uint32_t m_masking_key;
int m_masking_index;
std::string m_payload;
};
typedef boost::shared_ptr<utf8> utf8_ptr;
} // namespace message
} // namespace websocketpp
#endif // WEBSOCKET_UTF8_MESSAGE_HPP

View File

@@ -17,14 +17,10 @@
B663885A1487D77800DDAE13 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6FE8D5D14730B2200B32547 /* libssl.dylib */; };
B663885B1487D78800DDAE13 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6FE8D5B14730B1A00B32547 /* libcrypto.dylib */; };
B663885C1487D7AA00DDAE13 /* libboost_regex.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBF1434AF6A0029A1B1 /* libboost_regex.dylib */; };
B66388621487FE6C00DDAE13 /* basic_message.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B663885E1487FE6C00DDAE13 /* basic_message.hpp */; };
B66388631487FE6C00DDAE13 /* basic_message.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B663885E1487FE6C00DDAE13 /* basic_message.hpp */; };
B66388641487FE6C00DDAE13 /* data.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B663885F1487FE6C00DDAE13 /* data.hpp */; };
B66388651487FE6C00DDAE13 /* data.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B663885F1487FE6C00DDAE13 /* data.hpp */; };
B66388661487FE6C00DDAE13 /* control.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B66388601487FE6C00DDAE13 /* control.hpp */; };
B66388671487FE6C00DDAE13 /* control.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B66388601487FE6C00DDAE13 /* control.hpp */; };
B66388681487FE6C00DDAE13 /* utf8_message.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B66388611487FE6C00DDAE13 /* utf8_message.hpp */; };
B66388691487FE6C00DDAE13 /* utf8_message.hpp in Headers */ = {isa = PBXBuildFile; fileRef = B66388611487FE6C00DDAE13 /* utf8_message.hpp */; };
B6727429148517180029CF3E /* uri.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6727428148517180029CF3E /* uri.cpp */; };
B672742A148517180029CF3E /* uri.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6727428148517180029CF3E /* uri.cpp */; };
B672742D148531250029CF3E /* libboost_regex.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBF1434AF6A0029A1B1 /* libboost_regex.dylib */; };
@@ -188,10 +184,8 @@
B66388451487D71800DDAE13 /* echo_server_tls.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = echo_server_tls.cpp; path = examples/echo_server_tls/echo_server_tls.cpp; sourceTree = "<group>"; };
B66388461487D71800DDAE13 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = examples/echo_server_tls/Makefile; sourceTree = "<group>"; };
B663884B1487D73200DDAE13 /* echo_server_tls */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = echo_server_tls; sourceTree = BUILT_PRODUCTS_DIR; };
B663885E1487FE6C00DDAE13 /* basic_message.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = basic_message.hpp; path = src/messages/basic_message.hpp; sourceTree = "<group>"; };
B663885F1487FE6C00DDAE13 /* data.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = data.hpp; path = src/messages/data.hpp; sourceTree = "<group>"; };
B66388601487FE6C00DDAE13 /* control.hpp */ = {isa = PBXFileReference; fileEncoding = 4; name = control.hpp; path = src/messages/control.hpp; sourceTree = "<group>"; };
B66388611487FE6C00DDAE13 /* utf8_message.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = utf8_message.hpp; path = src/messages/utf8_message.hpp; sourceTree = "<group>"; };
B66388601487FE6C00DDAE13 /* control.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = control.hpp; path = src/messages/control.hpp; sourceTree = "<group>"; };
B6727428148517180029CF3E /* uri.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = uri.cpp; path = src/uri.cpp; sourceTree = "<group>"; };
B6828875143745DA002BA48B /* chat_client_handler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = chat_client_handler.cpp; path = examples/chat_client/chat_client_handler.cpp; sourceTree = "<group>"; };
B6828876143745DA002BA48B /* chat_client_handler.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = chat_client_handler.hpp; path = examples/chat_client/chat_client_handler.hpp; sourceTree = "<group>"; };
@@ -399,10 +393,8 @@
B663885D1487FDAA00DDAE13 /* messages */ = {
isa = PBXGroup;
children = (
B663885E1487FE6C00DDAE13 /* basic_message.hpp */,
B663885F1487FE6C00DDAE13 /* data.hpp */,
B66388601487FE6C00DDAE13 /* control.hpp */,
B66388611487FE6C00DDAE13 /* utf8_message.hpp */,
);
name = messages;
sourceTree = "<group>";
@@ -636,10 +628,8 @@
B6DF1CB81434AC470029A1B1 /* websocket_session.hpp in Headers */,
B6BE76EA144EF53000716A77 /* websocket_endpoint.hpp in Headers */,
B6FE8D06145AFF5F00B32547 /* websocket_constants.hpp in Headers */,
B66388621487FE6C00DDAE13 /* basic_message.hpp in Headers */,
B66388641487FE6C00DDAE13 /* data.hpp in Headers */,
B66388661487FE6C00DDAE13 /* control.hpp in Headers */,
B66388681487FE6C00DDAE13 /* utf8_message.hpp in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -662,10 +652,8 @@
B6DF1CB91434AC470029A1B1 /* websocket_session.hpp in Headers */,
B6BE76EB144EF53000716A77 /* websocket_endpoint.hpp in Headers */,
B6FE8D07145AFF5F00B32547 /* websocket_constants.hpp in Headers */,
B66388631487FE6C00DDAE13 /* basic_message.hpp in Headers */,
B66388651487FE6C00DDAE13 /* data.hpp in Headers */,
B66388671487FE6C00DDAE13 /* control.hpp in Headers */,
B66388691487FE6C00DDAE13 /* utf8_message.hpp in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};