X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FService.hh;fp=src%2FMoof%2FService.hh;h=0000000000000000000000000000000000000000;hp=570a2309e270cb235a7abe7e1b8819d12a7264a6;hb=831f04d4bc19a390415ac0bbac4331c7a65509bc;hpb=299af4f2047e767e5d79501c26444473bda64c64 diff --git a/src/Moof/Service.hh b/src/Moof/Service.hh deleted file mode 100644 index 570a230..0000000 --- a/src/Moof/Service.hh +++ /dev/null @@ -1,164 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -/** - * \file Service.hh - * Classes for publishing and finding network services. - */ - -#ifndef _MOOF_SERVICE_HH_ -#define _MOOF_SERVICE_HH_ - -#include - -#include -#include - - -namespace Mf { - - -/** - * Class representing a network service. - */ -class Service -{ -public: - - /** - * Construct a network service with an explicit type. - * \param address The address of the host. - * \param type The type of service. - * \param name The service name. - * \param text The service information. - */ - Service(const SocketAddress& address, - const std::string& type, - const std::string& name, - const std::string& text); - - /** - * Construct a network service. The type of service will be inferred - * from the address. - * \param address The address of the host. - * \param name The service name. - * \param text The service information. - */ - Service(const SocketAddress& address, - const std::string& name, - const std::string& text); - - - /** - * Publish the service on the network. - */ - void publish(); - - /** - * Stop publishing the service on the network. - */ - void stop(); - - - /** - * Get the host address. - * \return The address. - */ - const SocketAddress& address() const - { - return mAddress; - } - - /** - * Get the type of the service. - * \return The service type. - */ - const std::string& type() const - { - return mType; - } - - /** - * Get the service name. - * \return The service name. - */ - const std::string& name() const - { - return mName; - } - - /** - * Get the service information. - * \return The service information as a string. - */ - const std::string& text() const - { - return mText; - } - - - ~Service(); - - -private: - - int handlePacket(SocketMultiplexer& mux, - Packet& packet, - const SocketAddress& address); - - SocketAddress mAddress; - std::string mType; - std::string mName; - std::string mText; -}; - - -class ServiceFinder -{ -public: - - /** - * Construct a service finder to find services of the same type as an - * address. - * \address The address. - */ - explicit ServiceFinder(const SocketAddress& 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); - - - const std::map& services() const - { - return mServices; - } - - -private: - - int handlePacket(SocketMultiplexer& mux, - Packet& packet, - const SocketAddress& address); - - std::string mType; - std::map mServices; -}; - - -} // namespace Mf - -#endif // _MOOF_SERVICE_HH_ -