#ifndef _MOOF_SERVICE_HH_
#define _MOOF_SERVICE_HH_
+#include <vector>
+
#include <Moof/Math.hh>
+#include <Moof/Socket.hh>
namespace Mf {
-class ServiceBroadcaster
+/**
+ * Class representing a network service.
+ */
+class Service
{
public:
- ServiceBroadcaster(const std::string& name);
+ /**
+ * Construct a network service.
+ * \param address The address of the host.
+ * \param text The service information.
+ */
+ Service(const SocketAddress& address, const std::string& text);
+
+
+ /**
+ * Get the host address.
+ * \return The address.
+ */
+ const SocketAddress& address() const;
+
+ /**
+ * Get the service information.
+ * \return The service information as a string.
+ */
+ const std::string& text() const;
+
+
+ /**
+ * Publish the service on the network.
+ */
+ void publish();
void update(Scalar t, Scalar dt);
+
+
+private:
+
+ SocketAddress mAddress;
+ std::string mText;
};
-class ServiceLocator
+class ServiceFinder
{
public:
- ServiceLocator(const std::string& name);
+ ServiceFinder(const std::string& service, int type = SOCK_STREAM);
void update(Scalar t, Scalar dt);
+
+
+ const std::vector<Service>& services() const
+ {
+ return mServices;
+ }
+
+
+private:
+
+ std::vector<Service> mServices;
};