/
BirdLeon
/
ROBLOX2016
Обзор
Документация
Войти
/
BirdLeon
/
ROBLOX2016
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Network/NetworkFilter.h
56 строк
2 KB
PatoFlamejanteTV
full source code
19 дек 2024, 19:11
19 дек 2024, 19:11
05db15d
Код
Авторство
О чём код?
#pragma once #include "reflection/property.h" #include "reflection/event.h" #include "network/api.h" #include <boost/unordered_set.hpp> namespace RBX { class Instance; namespace Network { class Replicator; // Allow only white listed data class StrictNetworkFilter { Replicator* replicator; Instance* instanceBeingRemovedFromLocalPlayer; static boost::unordered_set<std::string> propertyWhiteList; static boost::unordered_set<std::string> eventWhiteList; public: StrictNetworkFilter(Replicator* replicator); ~StrictNetworkFilter() {} FilterResult filterChangedProperty(Instance* instance, const Reflection::PropertyDescriptor& desc); FilterResult filterParent(Instance* instance, Instance* newParent); FilterResult filterEvent(Instance* instance, const Reflection::EventDescriptor& desc); FilterResult filterNew(const Instance* instance, const Instance* parent); FilterResult filterDelete(const Instance* instance); FilterResult filterTerrainCellChange(); void onChildRemoved(Instance* removed, const Instance* oldParent); }; // Algorithms for filtering common incoming data. // Whitelists certain physics packets and certain humanoind packets. // Blacklists certain data. // Used as a first-pass filtering of known safe data. class NetworkFilter { Replicator* replicator; public: NetworkFilter(Replicator* replicator); ~NetworkFilter(void); bool filterChangedProperty(Instance* instance, const Reflection::PropertyDescriptor& desc, FilterResult& result); bool filterParent(Instance* instance, Instance* parent, FilterResult& result); bool filterNew(Instance* instance, Instance* parent, FilterResult& result); bool filterDelete(Instance* instance, FilterResult& result); bool filterEvent(Instance* instance, const Reflection::EventDescriptor& desc, FilterResult& result); }; } }