socketencryptoutputstream.h

来自「天之炼狱1服务器端源文件游戏服务端不完整」· C头文件 代码 · 共 80 行

H
80
字号
//////////////////////////////////////////////////////////////////////// // SocketEncryptOutputStream.h // // by Reiot// //////////////////////////////////////////////////////////////////////#ifndef __SOCKET_ENCRYPT_OUTPUT_STREAM_H__#define __SOCKET_ENCRYPT_OUTPUT_STREAM_H__// include files#include "Types.h"#include "Exception.h"#include "SocketOutputStream.h"#include "Encrypter.h"const unsigned int DefaultSocketEncryptOutputBufferSize = 81920;////////////////////////////////////////////////////////////////////////// class SocketEncryptOutputStream////////////////////////////////////////////////////////////////////////class SocketEncryptOutputStream : public SocketOutputStream {//////////////////////////////////////////////////// constructor/destructor//////////////////////////////////////////////////public :		// constructor	SocketEncryptOutputStream (Socket* sock, uint BufferSize = DefaultSocketEncryptOutputBufferSize) throw (Error);	~SocketEncryptOutputStream () throw (Error);	//////////////////////////////////////////////////// methods//////////////////////////////////////////////////public :		// write data to stream (output buffer)	// *CAUTION*	// string 阑 滚欺俊 writing 且 锭, 磊悼栏肺 size 甫 菊俊 嘿老 荐档 乐促.	// 弊矾唱, string 狼 农扁甫 BYTE/WORD 吝 绢蠢 巴栏肺 且 扒瘤绰 狼巩捞促.	// 菩哦狼 农扁绰 累阑 荐废 亮促绰 沥氓窍俊辑 鞘夸俊 蝶扼辑 string size 蔼阑	// BYTE 肚绰 WORD 甫 荐悼栏肺 荤侩窍档废 茄促.    uint writeEncrypt (bool   buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }    uint writeEncrypt (char   buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }    uint writeEncrypt (uchar  buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }    uint writeEncrypt (short  buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }    uint writeEncrypt (ushort buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }    uint writeEncrypt (int    buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }    uint writeEncrypt (uint   buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }    uint writeEncrypt (long   buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }    uint writeEncrypt (ulong  buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write(buf); }/*    uint writeEncrypt (bool   buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szbool  ); }    uint writeEncrypt (char   buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szchar  ); }    uint writeEncrypt (uchar  buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szuchar ); }    uint writeEncrypt (short  buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szshort ); }    uint writeEncrypt (ushort buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szushort); }    uint writeEncrypt (int    buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szint   ); }    uint writeEncrypt (uint   buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szuint  ); }    uint writeEncrypt (long   buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szlong  ); }    uint writeEncrypt (ulong  buf) throw (ProtocolException, Error) { buf = m_Encrypter.convert(buf); return write((const char*)&buf, szulong ); }*/	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 + -
显示快捷键?