Fix indentation
This commit is contained in:
parent
071dbfa5fc
commit
a120591be3
@ -30,8 +30,8 @@ namespace demonware
|
|||||||
|
|
||||||
printf("DW: Handling subservice of type %d\n", this->sub_type_);
|
printf("DW: Handling subservice of type %d\n", this->sub_type_);
|
||||||
|
|
||||||
const auto callback = this->callbacks.find(this->sub_type_);
|
const auto callback = this->callbacks_.find(this->sub_type_);
|
||||||
if (callback != this->callbacks.end())
|
if (callback != this->callbacks_.end())
|
||||||
{
|
{
|
||||||
callback->second(server, &buffer);
|
callback->second(server, &buffer);
|
||||||
}
|
}
|
||||||
@ -42,21 +42,21 @@ namespace demonware
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::map<uint8_t, callback> callbacks{};
|
std::map<uint8_t, callback> callbacks_{};
|
||||||
|
|
||||||
template<typename Class, typename T, typename... Args>
|
template <typename Class, typename T, typename... Args>
|
||||||
void register_service(const uint8_t type, T(Class::*callback)(Args ...) const)
|
void register_service(const uint8_t type, T (Class::*callback)(Args ...) const)
|
||||||
{
|
{
|
||||||
this->callbacks[type] = [this, callback](Args... args) -> T
|
this->callbacks_[type] = [this, callback](Args ... args) -> T
|
||||||
{
|
{
|
||||||
return (reinterpret_cast<Class*>(this)->*callback)(args...);
|
return (reinterpret_cast<Class*>(this)->*callback)(args...);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Class, typename T, typename... Args>
|
template <typename Class, typename T, typename... Args>
|
||||||
void register_service(const uint8_t type, T(Class::*callback)(Args ...))
|
void register_service(const uint8_t type, T (Class::*callback)(Args ...))
|
||||||
{
|
{
|
||||||
this->callbacks[type] = [this, callback](Args... args) -> T
|
this->callbacks_[type] = [this, callback](Args ... args) -> T
|
||||||
{
|
{
|
||||||
return (reinterpret_cast<Class*>(this)->*callback)(args...);
|
return (reinterpret_cast<Class*>(this)->*callback)(args...);
|
||||||
};
|
};
|
||||||
@ -70,7 +70,7 @@ namespace demonware
|
|||||||
uint8_t sub_type_{};
|
uint8_t sub_type_{};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<uint16_t Type>
|
template <uint16_t Type>
|
||||||
class i_generic_service : public i_service
|
class i_generic_service : public i_service
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -173,7 +173,7 @@ namespace demonware
|
|||||||
auto iv_hash = utils::cryptography::tiger::compute(std::string(reinterpret_cast<char*>(&iv), 4));
|
auto iv_hash = utils::cryptography::tiger::compute(std::string(reinterpret_cast<char*>(&iv), 4));
|
||||||
|
|
||||||
const std::string key(reinterpret_cast<char*>(dw::get_key(false)), 24);
|
const std::string key(reinterpret_cast<char*>(dw::get_key(false)), 24);
|
||||||
p_buffer = byte_buffer{ utils::cryptography::des3::decrypt(p_buffer.get_remaining(), iv_hash, key) };
|
p_buffer = byte_buffer{utils::cryptography::des3::decrypt(p_buffer.get_remaining(), iv_hash, key)};
|
||||||
p_buffer.set_use_data_types(false);
|
p_buffer.set_use_data_types(false);
|
||||||
|
|
||||||
int checksum;
|
int checksum;
|
||||||
|
@ -8,7 +8,8 @@ namespace demonware
|
|||||||
public:
|
public:
|
||||||
explicit service_server(std::string name);
|
explicit service_server(std::string name);
|
||||||
|
|
||||||
template <typename T> void register_service()
|
template <typename T>
|
||||||
|
void register_service()
|
||||||
{
|
{
|
||||||
static_assert(std::is_base_of<i_service, T>::value, "Service must inherit from IService");
|
static_assert(std::is_base_of<i_service, T>::value, "Service must inherit from IService");
|
||||||
|
|
||||||
|
@ -43,8 +43,9 @@ namespace demonware
|
|||||||
|
|
||||||
const auto iv = utils::cryptography::tiger::compute(std::string(reinterpret_cast<char*>(&seed), 4));
|
const auto iv = utils::cryptography::tiger::compute(std::string(reinterpret_cast<char*>(&seed), 4));
|
||||||
|
|
||||||
const std::string enc_key (reinterpret_cast<char*>(&ticket[32]), 24);
|
const std::string enc_key(reinterpret_cast<char*>(&ticket[32]), 24);
|
||||||
auto enc_ticket = utils::cryptography::des3::encrypt(std::string(reinterpret_cast<char*>(&auth_ticket), sizeof(auth_ticket)), iv,enc_key );
|
auto enc_ticket = utils::cryptography::des3::encrypt(
|
||||||
|
std::string(reinterpret_cast<char*>(&auth_ticket), sizeof(auth_ticket)), iv, enc_key);
|
||||||
|
|
||||||
bit_buffer response;
|
bit_buffer response;
|
||||||
response.set_use_data_types(false);
|
response.set_use_data_types(false);
|
||||||
|
@ -43,7 +43,7 @@ namespace demonware
|
|||||||
|
|
||||||
bool bdStorage::load_publisher_resource(const std::string& name, std::string& buffer)
|
bool bdStorage::load_publisher_resource(const std::string& name, std::string& buffer)
|
||||||
{
|
{
|
||||||
for(const auto& resource : this->publisher_resources_)
|
for (const auto& resource : this->publisher_resources_)
|
||||||
{
|
{
|
||||||
if (std::regex_match(name, resource.first))
|
if (std::regex_match(name, resource.first))
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ namespace demonware
|
|||||||
printf("DW: Loading user file: %s\n", filename.data());
|
printf("DW: Loading user file: %s\n", filename.data());
|
||||||
|
|
||||||
const auto path = get_user_file_path(filename);
|
const auto path = get_user_file_path(filename);
|
||||||
if(utils::io::read_file(path, &data))
|
if (utils::io::read_file(path, &data))
|
||||||
{
|
{
|
||||||
auto reply = server->create_reply(this->get_sub_type());
|
auto reply = server->create_reply(this->get_sub_type());
|
||||||
reply->add(new bdFileData(data));
|
reply->add(new bdFileData(data));
|
||||||
@ -127,7 +127,7 @@ namespace demonware
|
|||||||
auto reply = server->create_reply(this->get_sub_type());
|
auto reply = server->create_reply(this->get_sub_type());
|
||||||
|
|
||||||
const auto path = get_user_file_path(filename);
|
const auto path = get_user_file_path(filename);
|
||||||
if(utils::io::read_file(path, &data))
|
if (utils::io::read_file(path, &data))
|
||||||
{
|
{
|
||||||
auto* info = new bdFileInfo;
|
auto* info = new bdFileInfo;
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ namespace demonware
|
|||||||
buffer->read_string(&platform);
|
buffer->read_string(&platform);
|
||||||
|
|
||||||
const auto path = get_user_file_path(filename);
|
const auto path = get_user_file_path(filename);
|
||||||
if(utils::io::read_file(path, &data))
|
if (utils::io::read_file(path, &data))
|
||||||
{
|
{
|
||||||
auto reply = server->create_reply(this->get_sub_type());
|
auto reply = server->create_reply(this->get_sub_type());
|
||||||
reply->add(new bdFileData(data));
|
reply->add(new bdFileData(data));
|
||||||
|
@ -60,9 +60,14 @@ namespace demonware
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 30: this->ip_discovery(s, to, tolen); break;
|
case 30:
|
||||||
case 20: this->nat_discovery(s, to, tolen); break;
|
this->ip_discovery(s, to, tolen);
|
||||||
default: break;
|
break;
|
||||||
|
case 20:
|
||||||
|
this->nat_discovery(s, to, tolen);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user