Add setXteaKey function

This commit is contained in:
Henrique 2012-08-01 21:24:54 -03:00
parent cadf07974a
commit 3b345cf868
3 changed files with 10 additions and 0 deletions

View File

@ -645,6 +645,7 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<Protocol>("setConnection", &Protocol::setConnection);
g_lua.bindClassMemberFunction<Protocol>("send", &Protocol::send);
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>("generateXteaKey", &Protocol::generateXteaKey);
g_lua.bindClassMemberFunction<Protocol>("enableXteaEncryption", &Protocol::enableXteaEncryption);

View File

@ -151,6 +151,14 @@ void Protocol::generateXteaKey()
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> xteaKey;

View File

@ -46,6 +46,7 @@ public:
void setConnection(const ConnectionPtr& connection) { m_connection = connection; }
void generateXteaKey();
void setXteaKey(uint32 a, uint32 b, uint32 c, uint32 d);
std::vector<int> getXteaKey();
void enableXteaEncryption() { m_xteaEncryptionEnabled = true; }