]>
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 **************************************************************************/
12 #ifndef _MOOF_SERVICE_HH_
13 #define _MOOF_SERVICE_HH_
17 * Classes for publishing and finding network services.
22 #include <moof/math.hh>
23 #include <moof/socket.hh>
30 * Class representing a network service.
37 * Construct a network service with an explicit type.
38 * \param address The address of the host.
39 * \param type The type of service.
40 * \param name The service name.
41 * \param text The service information.
43 service(const socket::address
& address
,
44 const std::string
& type
,
45 const std::string
& name
,
46 const std::string
& text
);
49 * Construct a network service. The type of service will be inferred
51 * \param address The address of the host.
52 * \param name The service name.
53 * \param text The service information.
55 service(const socket::address
& address
,
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 socket::address
& 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 handle_packet(socket_multiplexer
& mux
,
115 const socket::address
& address
);
117 socket::address address_
;
129 * Construct a service finder to find services of the same type as an
131 * \address The address.
133 explicit service_finder(const socket::address
& 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 explicit service_finder(const std::string
& type
,
141 int sockType
= SOCK_STREAM
);
144 const std::map
<std::string
,service
>& services() const
152 int handle_packet(socket_multiplexer
& mux
,
154 const socket::address
& address
);
157 std::map
<std::string
,service
> services_
;
163 #endif // _MOOF_SERVICE_HH_
This page took 0.047488 seconds and 4 git commands to generate.