socketencryptinputstream.h
来自「天之炼狱1服务器端源文件游戏服务端不完整」· C头文件 代码 · 共 80 行
H
80 行
//////////////////////////////////////////////////////////////////////// // SocketEncryptInputStream.h // // by Reiot// //////////////////////////////////////////////////////////////////////#ifndef __SOCKET_ENCRYPT_INPUT_STREAM_H__#define __SOCKET_ENCRYPT_INPUT_STREAM_H__// include files#include "Types.h"#include "Exception.h"#include "SocketInputStream.h"#include "Encrypter.h"const unsigned int DefaultSocketEncryptInputBufferSize = 81920;////////////////////////////////////////////////////////////////////////// class SocketEncryptInputStream////////////////////////////////////////////////////////////////////////class SocketEncryptInputStream : public SocketInputStream {//////////////////////////////////////////////////// constructor/destructor//////////////////////////////////////////////////public : // constructor SocketEncryptInputStream (Socket* sock, uint BufferSize = DefaultSocketEncryptInputBufferSize) throw (Error); ~SocketEncryptInputStream () throw (Error); //////////////////////////////////////////////////// methods//////////////////////////////////////////////////public : // read data to stream (output buffer) // *CAUTION* // string 阑 滚欺俊 writing 且 锭, 磊悼栏肺 size 甫 菊俊 嘿老 荐档 乐促. // 弊矾唱, string 狼 农扁甫 BYTE/WORD 吝 绢蠢 巴栏肺 且 扒瘤绰 狼巩捞促. // 菩哦狼 农扁绰 累阑 荐废 亮促绰 沥氓窍俊辑 鞘夸俊 蝶扼辑 string size 蔼阑 // BYTE 肚绰 WORD 甫 荐悼栏肺 荤侩窍档废 茄促. uint readEncrypt (bool &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (char &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (uchar &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (short &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (ushort &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (int &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (uint &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (long &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (ulong &buf) throw (ProtocolException, Error) { uint n = read(buf); buf = m_Encrypter.convert(buf); return n; }/* uint readEncrypt (bool &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szbool ); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (char &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szchar ); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (uchar &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szuchar ); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (short &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szshort ); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (ushort &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szushort); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (int &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szint ); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (uint &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szuint ); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (long &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szlong ); buf = m_Encrypter.convert(buf); return n; } uint readEncrypt (ulong &buf) throw (ProtocolException, Error) { uint n = read((char*)&buf, szulong ); buf = m_Encrypter.convert(buf); return n; }*/ void setEncryptCode(uchar code) { m_Encrypter.setCode(code); } uchar getEncryptCode() const { return m_Encrypter.getCode(); }//////////////////////////////////////////////////// attributes//////////////////////////////////////////////////private : Encrypter m_Encrypter; };#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?