]>
Dogcows Code - chaz/yoink/blob - src/moof/service.hh
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
8 *****************************************************************************/
10 #ifndef _MOOF_SERVICE_HH_
11 #define _MOOF_SERVICE_HH_
15 #include <moof/math.hh>
16 #include <moof/socket.hh>
21 * Classes for publishing and finding network services.
28 * Class representing a network service.
35 * Construct a network service with an explicit type.
36 * \param address The address of the host.
37 * \param type The type of service.
38 * \param name The service name.
39 * \param text The service information.
41 service(const socket::address
& address
,
42 const std::string
& type
,
43 const std::string
& name
,
44 const std::string
& text
);
47 * Construct a network service. The type of service will be inferred
49 * \param address The address of the host.
50 * \param name The service name.
51 * \param text The service information.
53 service(const socket::address
& address
,
54 const std::string
& name
,
55 const std::string
& text
);
58 * Publish the service on the network.
63 * Stop publishing the service on the network.
68 * Get the host address.
69 * \return The address.
71 const socket::address
& address() const
77 * Get the type of the service.
78 * \return The service type.
80 const std::string
& type() const
86 * Get the service name.
87 * \return The service name.
89 const std::string
& name() const
95 * Get the service information.
96 * \return The service information as a string.
98 const std::string
& text() const
107 int handle_packet(socket_multiplexer
& mux
,
108 packet
& packet
, const socket::address
& address
);
110 socket::address address_
;
122 * Construct a service finder to find services of the same type as an
124 * \address The address.
126 explicit service_finder(const socket::address
& address
);
129 * Construct a service finder to find services of a certain type.
130 * \param type The type of the service.
131 * \param sockType The type of socket.
133 explicit service_finder(const std::string
& type
,
134 int sockType
= SOCK_STREAM
);
136 const std::map
<std::string
,service
>& services() const
143 int handle_packet(socket_multiplexer
& mux
,
144 packet
& packet
, const socket::address
& address
);
147 std::map
<std::string
,service
> services_
;
153 #endif // _MOOF_SERVICE_HH_
This page took 0.043681 seconds and 5 git commands to generate.