Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

dns-sd.h

Go to the documentation of this file.
00001 /* Copyright 2003 gnome-vfsmm Development Team
00002  *
00003  * This library is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU Library General Public
00005  * License as published by the Free Software Foundation; either
00006  * version 2 of the License, or (at your option) any later version.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Library General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Library General Public
00014  * License along with this library; if not, write to the Free
00015  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00016  */
00017 
00018 #ifndef _LIBGNOMEVFSMM_DNS_SD_H
00019 #define _LIBGNOMEVFSMM_DNS_SD_H
00020 
00021 //#include <libgnomevfsmm/async-handle.h>
00022 #include <libgnomevfsmm/enums.h> //For Result
00023 #include <glibmm.h>
00024 #include <libgnomevfs/gnome-vfs-dns-sd.h>
00025 
00026 
00027 
00028 namespace Gnome
00029 {
00030 
00031 namespace Vfs
00032 {
00033 
00034 namespace DnsSd
00035 {
00036 
00037 //TODO: Hide the C structs?
00038 typedef struct GnomeVFSDNSSDBrowseHandle BrowseHandle;
00039 typedef struct GnomeVFSDNSSDResolveHandle ResolveHandle;
00040 
00041 
00042 class Service
00043 {
00044 public:
00045   Glib::ustring name;
00046   Glib::ustring type;
00047   Glib::ustring domain;
00048 };
00049 
00053 typedef sigc::slot<void, BrowseHandle*, GnomeVFSDNSSDServiceStatus, const Service&> BrowseSlot;
00054 
00055 //The return value should only be used to call stop_browse().  
00056 BrowseHandle* browse(const Glib::ustring& domain, const Glib::ustring& type, const BrowseSlot& slot);
00057 
00058 void stop_browse(BrowseHandle* handle);
00059 
00060 typedef std::map<Glib::ustring, Glib::ustring> ServiceOptions;
00061 
00066 typedef sigc::slot<void, ResolveHandle*, Result, const Service&, const Glib::ustring&, int,
00067   const ServiceOptions&> ResolveSlot;
00068 
00069 //The return value should only be used to call cancel_resolve().
00070 ResolveHandle* resolve(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
00071                        int timeout, const ResolveSlot& slot);
00072 
00073 void cancel_resolve(ResolveHandle* handle);
00074   
00075 
00076 typedef Glib::ListHandle<Service> ListHandleServices;
00077 
00078 //TODO: Use a generic Glib *Handle instead of std::list<Service>?
00079 void browse_sync(const Glib::ustring& domain, const Glib::ustring& type, int timeout_msec, std::list<Service>& services);
00080 
00081 
00082 void resolve_sync(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
00083                   int timeout_msec, Glib::ustring& host, int& port, ServiceOptions& options);
00084 
00085 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
00086 
00087 ListHandleStrings list_browse_domains_sync(const Glib::ustring& domain, int timeout_msec);
00088 
00089 ListHandleStrings get_default_browse_domains();
00090 
00091 
00092 } // namespace DnsSd
00093 
00094 } // namespace Vfs
00095 
00096 } // namespace Gnome
00097 
00098 #endif

Generated on Mon Mar 7 11:19:50 2005 for libgnomevfsmm by  doxygen 1.3.9.1