Service.hpp
Go to the documentation of this file.
32 ClientProperty(const std::string& _clientName="", const std::vector<std::string>& _groups = std::vector<std::string>()) :
92 return std::find(m_listAthorizedFunction.begin(), m_listAthorizedFunction.end(), _funcName) != m_listAthorizedFunction.end();
184 virtual void clientConnect(uint64_t _clientId, const std::string& _userName, const std::string& _clientName, const std::vector<std::string>& _groups) = 0;
203 virtual void callBinary2(const std::string& _call, ememory::SharedPtr<zeus::BufferCall> _obj) = 0;
247 // no need of shared_ptr or unique_ptr (if service die all is lost and is client die, the gateway notify us...)
248 std::map<uint64_t, std::pair<ememory::SharedPtr<ClientProperty>, ememory::SharedPtr<ZEUS_TYPE_SERVICE>>> m_interface;
261 ZEUS_ERROR("Advertise function start with 'srv.' is not permited ==> only allow for internal service: '" << _name << "'");
309 void clientConnect(uint64_t _clientId, const std::string& _userName, const std::string& _clientName, const std::vector<std::string>& _groups) {
314 ememory::SharedPtr<ClientProperty> tmpProperty = ememory::makeShared<ClientProperty>(_clientName, _groups);
319 tmpSrv = ememory::makeShared<ZEUS_TYPE_SERVICE>(m_getUserInterface->getUser(_userName), tmpProperty);
382 m_interfaceClient->answerError(_obj->getTransactionId(), "CLIENT-UNKNOW", "", _obj->getClientId());
415 m_interfaceClient->answerError(_obj->getTransactionId(), "FUNCTION-UNKNOW", "", _obj->getClientId());
this is for service instance call
void setType(enum type _type)
Set the type of the call that must be done for this function.
ClientProperty(const std::string &_clientName="", const std::vector< std::string > &_groups=std::vector< std::string >())
Definition: Service.hpp:32
This call a service function (global function like "srv.xxx")
This is a global function.
Definition: Service.hpp:25
eproperty::Value< uint16_t > propertyPort
Port of the WebSocket connection.
Definition: Service.hpp:107
Interface to store a function and call it after with a zeus::Buffer.
Definition: AbstractFunction.hpp:23
void clientSetGroup(uint64_t _clientId, const std::vector< std::string > &_clientGroups)
Definition: Service.hpp:365
eproperty::Value< std::string > propertyNameService
Service name.
Definition: Service.hpp:108
void answerError(uint64_t _clientTransactionId, const std::string &_errorValue, const std::string &_errorComment="", uint32_t _clientId=0)
uint32_t getTransactionId() const
Get the transaction identifier of the packet.
bool isFunctionAuthorized(uint64_t _clientId, const std::string &_funcName)
Definition: Service.hpp:297
zeus::AbstractFunction * advertise(std::string _name, ZEUS_RETURN_VALUE(ZEUS_CLASS_TYPE::*_func)(ZEUS_FUNC_ARGS_TYPE... _args))
Definition: Service.hpp:220
eproperty::Value< std::string > propertyIp
Ip of WebSocket TCP connection.
Definition: Service.hpp:106
void setGroups(std::vector< std::string > _groups)
Definition: Service.hpp:64
Definition: Service.hpp:244
void clientConnect(uint64_t _clientId, const std::string &_userName, const std::string &_clientName, const std::vector< std::string > &_groups)
Definition: Service.hpp:309
zeus::AbstractFunction * advertise(const std::string &_name, ZEUS_RETURN_VALUE(ZEUS_CLASS_TYPE::*_func)(ZEUS_FUNC_ARGS_TYPE... _args))
Definition: Service.hpp:258
void addAuthorized(const std::string &_funcName)
Definition: Service.hpp:83
AbstractFunction * createAbstractFunctionClass(const std::string &_name, ZEUS_RETURN(ZEUS_CLASS_TYPE::*_fffp)(ZEUS_TYPES...))
Create a function information with the function type.
Definition: AbstractFunctionTypeClass.hpp:157
const std::vector< std::string > & getGroups()
Definition: Service.hpp:72
void clientSetName(uint64_t _clientId, const std::string &_clientName)
Definition: Service.hpp:351
void clientDisconnect(uint64_t _clientId)
Definition: Service.hpp:335
Definition: Service.hpp:102
ServiceType(ememory::SharedPtr< ZEUS_USER_ACCESS > _interface)
Definition: Service.hpp:288
std::string to_string(const TYPE &_variable)
This is a local fucntion.
Does not know the type of the call.
void callBinary2(const std::string &_call, ememory::SharedPtr< zeus::BufferCall > _obj)
Definition: Service.hpp:379
bool isFunctionAuthorized(const std::string &_funcName)
Definition: Service.hpp:91
std::string getExtention(const std::string &_mineType)
Retrive the extention of a file with his mine type.