libgnomevfsmm 2.26.0
dns-sd.h
Go to the documentation of this file.
1/* Copyright 2003 gnome-vfsmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free
15 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#ifndef _LIBGNOMEVFSMM_DNS_SD_H
19#define _LIBGNOMEVFSMM_DNS_SD_H
20
21//#include <libgnomevfsmm/async-handle.h>
22#include <libgnomevfsmm/enums.h> //For Result
23#include <glibmm.h>
24#include <libgnomevfs/gnome-vfs-dns-sd.h>
25
26
27
28namespace Gnome
29{
30
31namespace Vfs
32{
33
34//Forward declaration
35class exception;
36
37namespace DnsSd
38{
39
40//TODO: Hide the C structs?
41typedef struct GnomeVFSDNSSDBrowseHandle BrowseHandle;
42typedef struct GnomeVFSDNSSDResolveHandle ResolveHandle;
43
44
46{
47public:
48 Glib::ustring name;
49 Glib::ustring type;
50 Glib::ustring domain;
51};
52
56typedef sigc::slot<void, BrowseHandle*, GnomeVFSDNSSDServiceStatus, const Service&> BrowseSlot;
57
58//The return value should only be used to call stop_browse().
59#ifdef GLIBMM_EXCEPTIONS_ENABLED
60BrowseHandle* browse(const Glib::ustring& domain, const Glib::ustring& type, const BrowseSlot& slot);
61#else
62BrowseHandle* browse(const Glib::ustring& domain, const Glib::ustring& type, const BrowseSlot& slot, std::auto_ptr<Gnome::Vfs::exception>& error);
63#endif //GLIBMM_EXCEPTIONS_ENABLED
64
65#ifdef GLIBMM_EXCEPTIONS_ENABLED
67#else
68void stop_browse(BrowseHandle* handle, std::auto_ptr<Gnome::Vfs::exception>& error);
69#endif //GLIBMM_EXCEPTIONS_ENABLED
70
71typedef std::map<Glib::ustring, Glib::ustring> ServiceOptions;
72
77typedef sigc::slot<void, ResolveHandle*, Result, const Service&, const Glib::ustring&, int,
79
80//The return value should only be used to call cancel_resolve().
81#ifdef GLIBMM_EXCEPTIONS_ENABLED
82ResolveHandle* resolve(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
83 int timeout, const ResolveSlot& slot);
84#else
85ResolveHandle* resolve(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
86 int timeout, const ResolveSlot& slot, std::auto_ptr<Gnome::Vfs::exception>& error);
87#endif //GLIBMM_EXCEPTIONS_ENABLED
88
89#ifdef GLIBMM_EXCEPTIONS_ENABLED
91#else
92void cancel_resolve(ResolveHandle* handle, std::auto_ptr<Gnome::Vfs::exception>& error);
93#endif //GLIBMM_EXCEPTIONS_ENABLED
94
95
96typedef Glib::ListHandle<Service> ListHandleServices;
97
98//TODO: Use a generic Glib *Handle instead of std::list<Service>?
99#ifdef GLIBMM_EXCEPTIONS_ENABLED
100void browse_sync(const Glib::ustring& domain, const Glib::ustring& type, int timeout_msec, std::list<Service>& services);
101#else
102void browse_sync(const Glib::ustring& domain, const Glib::ustring& type, int timeout_msec, std::list<Service>& services, std::auto_ptr<Gnome::Vfs::exception>& error);
103#endif //GLIBMM_EXCEPTIONS_ENABLED
104
105
106#ifdef GLIBMM_EXCEPTIONS_ENABLED
107void resolve_sync(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
108 int timeout_msec, Glib::ustring& host, int& port, ServiceOptions& options);
109#else
110void resolve_sync(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
111 int timeout_msec, Glib::ustring& host, int& port, ServiceOptions& options, std::auto_ptr<Gnome::Vfs::exception>& error);
112#endif //GLIBMM_EXCEPTIONS_ENABLED
113
114typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
115
116#ifdef GLIBMM_EXCEPTIONS_ENABLED
117ListHandleStrings list_browse_domains_sync(const Glib::ustring& domain, int timeout_msec);
118#else
119ListHandleStrings list_browse_domains_sync(const Glib::ustring& domain, int timeout_msec, std::auto_ptr<Gnome::Vfs::exception>& error);
120#endif //GLIBMM_EXCEPTIONS_ENABLED
121
123
124
125} // namespace DnsSd
126
127} // namespace Vfs
128
129} // namespace Gnome
130
131#endif
Definition dns-sd.h:46
Glib::ustring type
Definition dns-sd.h:49
Glib::ustring domain
Definition dns-sd.h:50
Glib::ustring name
Definition dns-sd.h:48
Result
Definition enums.h:97
ListHandleStrings get_default_browse_domains()
struct GnomeVFSDNSSDResolveHandle ResolveHandle
Definition dns-sd.h:42
void resolve_sync(const Glib::ustring &name, const Glib::ustring &type, const Glib::ustring &domain, int timeout_msec, Glib::ustring &host, int &port, ServiceOptions &options)
void cancel_resolve(ResolveHandle *handle)
void browse_sync(const Glib::ustring &domain, const Glib::ustring &type, int timeout_msec, std::list< Service > &services)
ResolveHandle * resolve(const Glib::ustring &name, const Glib::ustring &type, const Glib::ustring &domain, int timeout, const ResolveSlot &slot)
std::map< Glib::ustring, Glib::ustring > ServiceOptions
Definition dns-sd.h:71
Glib::ListHandle< Service > ListHandleServices
Definition dns-sd.h:96
struct GnomeVFSDNSSDBrowseHandle BrowseHandle
Definition dns-sd.h:41
BrowseHandle * browse(const Glib::ustring &domain, const Glib::ustring &type, const BrowseSlot &slot)
ListHandleStrings list_browse_domains_sync(const Glib::ustring &domain, int timeout_msec)
void stop_browse(BrowseHandle *handle)
sigc::slot< void, BrowseHandle *, GnomeVFSDNSSDServiceStatus, const Service & > BrowseSlot
For instance, void on_browse(BrowseHandle* handle, GnomeVFSDNSSDServiceStatus status,...
Definition dns-sd.h:56
Glib::ListHandle< Glib::ustring > ListHandleStrings
Definition dns-sd.h:114
sigc::slot< void, ResolveHandle *, Result, const Service &, const Glib::ustring &, int, const ServiceOptions & > ResolveSlot
For instance, void on_resolve(ResolveHandle* handle, Result result, const Service& service,...
Definition dns-sd.h:78
Definition address.h:37