]>
Dogcows Code - chaz/yoink/blob - src/Moof/Service.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
14 * Classes for publishing and finding network services.
17 #ifndef _MOOF_SERVICE_HH_
18 #define _MOOF_SERVICE_HH_
22 #include <Moof/Math.hh>
23 #include <Moof/Socket.hh>
30 * Class representing a network service.
37 * Construct a network service. The type of service will be inferred
39 * \param address The address of the host.
40 * \param name The service name.
41 * \param text The service information.
43 Service(const SocketAddress
& address
,
44 const std::string
& name
,
45 const std::string
& text
);
48 * Construct a network service with an explicit type.
49 * \param address The address of the host.
50 * \param type The type of service.
51 * \param name The service name.
52 * \param text The service information.
54 Service(const SocketAddress
& address
,
55 const std::string
& type
,
56 const std::string
& name
,
57 const std::string
& text
);
61 * Publish the service on the network.
66 * Stop publishing the service on the network.
72 * Get the host address.
73 * \return The address.
75 const SocketAddress
& address() const
81 * Get the type of the service.
82 * \return The service type.
84 const std::string
& type() const
90 * Get the service name.
91 * \return The service name.
93 const std::string
& name() const
99 * Get the service information.
100 * \return The service information as a string.
102 const std::string
& text() const
113 int handlePacket(SocketMultiplexer
& sock
,
115 const SocketAddress
& address
);
117 SocketAddress mAddress
;
129 * Construct a service finder to find services of the same type as an
131 * \address The address.
133 ServiceFinder(const SocketAddress
& address
);
136 * Construct a service finder to find services of a certain type.
137 * \param type The type of the service.
138 * \param sockType The type of socket.
140 ServiceFinder(const std::string
& type
, int sockType
= SOCK_STREAM
);
143 const std::map
<std::string
,Service
>& services() const
151 int handlePacket(SocketMultiplexer
& sock
,
153 const SocketAddress
& address
);
156 std::map
<std::string
,Service
> mServices
;
162 #endif // _MOOF_SERVICE_HH_
This page took 0.041525 seconds and 5 git commands to generate.