*
**************************************************************************/
+#ifndef _MOOF_SERVICE_HH_
+#define _MOOF_SERVICE_HH_
+
/**
- * \file Service.hh
+ * \file service.hh
* Classes for publishing and finding network services.
*/
-#ifndef _MOOF_SERVICE_HH_
-#define _MOOF_SERVICE_HH_
-
#include <map>
-#include <Moof/Math.hh>
-#include <Moof/Socket.hh>
+#include <moof/math.hh>
+#include <moof/socket.hh>
-namespace Mf {
+namespace moof {
/**
* Class representing a network service.
*/
-class Service
+class service
{
public:
* \param name The service name.
* \param text The service information.
*/
- Service(const SocketAddress& address,
+ service(const socket::address& address,
const std::string& type,
const std::string& name,
const std::string& text);
* \param name The service name.
* \param text The service information.
*/
- Service(const SocketAddress& address,
+ service(const socket::address& address,
const std::string& name,
const std::string& text);
* Get the host address.
* \return The address.
*/
- const SocketAddress& address() const
+ const socket::address& address() const
{
- return mAddress;
+ return address_;
}
/**
*/
const std::string& type() const
{
- return mType;
+ return type_;
}
/**
*/
const std::string& name() const
{
- return mName;
+ return name_;
}
/**
*/
const std::string& text() const
{
- return mText;
+ return text_;
}
- ~Service();
+ ~service();
private:
- int handlePacket(SocketMultiplexer& mux,
- Packet& packet,
- const SocketAddress& address);
+ int handle_packet(socket_multiplexer& mux,
+ packet& packet,
+ const socket::address& address);
- SocketAddress mAddress;
- std::string mType;
- std::string mName;
- std::string mText;
+ socket::address address_;
+ std::string type_;
+ std::string name_;
+ std::string text_;
};
-class ServiceFinder
+class service_finder
{
public:
* address.
* \address The address.
*/
- explicit ServiceFinder(const SocketAddress& address);
+ explicit service_finder(const socket::address& address);
/**
* Construct a service finder to find services of a certain type.
* \param type The type of the service.
* \param sockType The type of socket.
*/
- explicit ServiceFinder(const std::string& type,
- int sockType = SOCK_STREAM);
+ explicit service_finder(const std::string& type,
+ int sockType = SOCK_STREAM);
- const std::map<std::string,Service>& services() const
+ const std::map<std::string,service>& services() const
{
- return mServices;
+ return services_;
}
private:
- int handlePacket(SocketMultiplexer& mux,
- Packet& packet,
- const SocketAddress& address);
+ int handle_packet(socket_multiplexer& mux,
+ packet& packet,
+ const socket::address& address);
- std::string mType;
- std::map<std::string,Service> mServices;
+ std::string type_;
+ std::map<std::string,service> services_;
};
-} // namespace Mf
+} // namespace moof
#endif // _MOOF_SERVICE_HH_