Add setXteaKey function
This commit is contained in:
parent
cadf07974a
commit
3b345cf868
|
@ -645,6 +645,7 @@ void Application::registerLuaFunctions()
|
||||||
g_lua.bindClassMemberFunction<Protocol>("setConnection", &Protocol::setConnection);
|
g_lua.bindClassMemberFunction<Protocol>("setConnection", &Protocol::setConnection);
|
||||||
g_lua.bindClassMemberFunction<Protocol>("send", &Protocol::send);
|
g_lua.bindClassMemberFunction<Protocol>("send", &Protocol::send);
|
||||||
g_lua.bindClassMemberFunction<Protocol>("recv", &Protocol::recv);
|
g_lua.bindClassMemberFunction<Protocol>("recv", &Protocol::recv);
|
||||||
|
g_lua.bindClassMemberFunction<Protocol>("setXteaKey", &Protocol::setXteaKey);
|
||||||
g_lua.bindClassMemberFunction<Protocol>("getXteaKey", &Protocol::getXteaKey);
|
g_lua.bindClassMemberFunction<Protocol>("getXteaKey", &Protocol::getXteaKey);
|
||||||
g_lua.bindClassMemberFunction<Protocol>("generateXteaKey", &Protocol::generateXteaKey);
|
g_lua.bindClassMemberFunction<Protocol>("generateXteaKey", &Protocol::generateXteaKey);
|
||||||
g_lua.bindClassMemberFunction<Protocol>("enableXteaEncryption", &Protocol::enableXteaEncryption);
|
g_lua.bindClassMemberFunction<Protocol>("enableXteaEncryption", &Protocol::enableXteaEncryption);
|
||||||
|
|
|
@ -151,6 +151,14 @@ void Protocol::generateXteaKey()
|
||||||
m_xteaKey[3] = unif(eng);
|
m_xteaKey[3] = unif(eng);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Protocol::setXteaKey(uint32 a, uint32 b, uint32 c, uint32 d)
|
||||||
|
{
|
||||||
|
m_xteaKey[0] = a;
|
||||||
|
m_xteaKey[1] = b;
|
||||||
|
m_xteaKey[2] = c;
|
||||||
|
m_xteaKey[3] = d;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> Protocol::getXteaKey()
|
std::vector<int> Protocol::getXteaKey()
|
||||||
{
|
{
|
||||||
std::vector<int> xteaKey;
|
std::vector<int> xteaKey;
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
void setConnection(const ConnectionPtr& connection) { m_connection = connection; }
|
void setConnection(const ConnectionPtr& connection) { m_connection = connection; }
|
||||||
|
|
||||||
void generateXteaKey();
|
void generateXteaKey();
|
||||||
|
void setXteaKey(uint32 a, uint32 b, uint32 c, uint32 d);
|
||||||
std::vector<int> getXteaKey();
|
std::vector<int> getXteaKey();
|
||||||
void enableXteaEncryption() { m_xteaEncryptionEnabled = true; }
|
void enableXteaEncryption() { m_xteaEncryptionEnabled = true; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue