From 1a452285dc8663a14a0e930920763a04a2b9aede Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Sat, 8 Jun 2024 15:31:02 +0000 Subject: [PATCH] extract CServiceEntry into separate file --- nelns/naming_service/naming_service.cpp | 23 ++-------------- nelns/naming_service/service_entry.h | 35 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 nelns/naming_service/service_entry.h diff --git a/nelns/naming_service/naming_service.cpp b/nelns/naming_service/naming_service.cpp index b10856088d..6dc4a6afda 100644 --- a/nelns/naming_service/naming_service.cpp +++ b/nelns/naming_service/naming_service.cpp @@ -48,6 +48,8 @@ #include "nel/net/service.h" #include "nel/net/module_manager.h" +#include "service_entry.h" + // // Namespaces // @@ -70,27 +72,6 @@ NLMISC_COMMAND(test, "none", "none") } -// -// Structures -// - -struct CServiceEntry -{ - CServiceEntry (TSockId sock, const vector &a, const string &n, TServiceId s) : SockId(sock), Addr(a), Name(n), SId (s), WaitingUnregistration(false) { } - - TSockId SockId; // the connection between the service and the naming service - vector Addr; // address to send to the service who wants to lookup this service - // it s possible to have more than one addr, anyway, the naming service - // will send good address depending of the sub net address of the service - string Name; // name of the service - TServiceId SId; // id of the service - - bool WaitingUnregistration; // true if this service is in unregistration process (wait other service ACK) - TTime WaitingUnregistrationTime; // time of the beginning of the inregistration process - list WaitingUnregistrationServices; // list of service that we wait the answer -}; - - // Helper that emulates layer5's send() //void sendToService( uint16 sid, CMessage& msgout ); diff --git a/nelns/naming_service/service_entry.h b/nelns/naming_service/service_entry.h new file mode 100644 index 0000000000..3a440d4b67 --- /dev/null +++ b/nelns/naming_service/service_entry.h @@ -0,0 +1,35 @@ +#ifndef NL_SERVICE_ENTRY_H +#define NL_SERVICE_ENTRY_H + +#include +#include + +#include +#include +#include +#include + +struct CServiceEntry +{ + CServiceEntry(NLNET::TSockId sock, const std::vector &a, const std::string &n, NLNET::TServiceId s) + : SockId(sock) + , Addr(a) + , Name(n) + , SId(s) + , WaitingUnregistration(false) + { + } + + NLNET::TSockId SockId; // the connection between the service and the naming service + std::vector Addr; // address to send to the service who wants to lookup this service + // it s possible to have more than one addr, anyway, the naming service + // will send good address depending of the sub net address of the service + std::string Name; // name of the service + NLNET::TServiceId SId; // id of the service + + bool WaitingUnregistration; // true if this service is in unregistration process (wait other service ACK) + NLMISC::TTime WaitingUnregistrationTime; // time of the beginning of the inregistration process + std::list WaitingUnregistrationServices; // list of service that we wait the answer +}; + +#endif // NL_SERVICE_ENTRY_H