]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Service.hh
sockets documentation and cleanup
[chaz/yoink] / src / Moof / Service.hh
index 5870d576b454717217a4da1e18efee8abf58a24a..7c5e6b7b7b440ad4ba9f14fb6ec519eb230633c6 100644 (file)
 #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;
 };
 
 
This page took 0.018303 seconds and 4 git commands to generate.