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 //Forward declaration
00035 class exception;
00036 
00037 namespace DnsSd
00038 {
00039 
00040 //TODO: Hide the C structs?
00041 typedef struct GnomeVFSDNSSDBrowseHandle BrowseHandle;
00042 typedef struct GnomeVFSDNSSDResolveHandle ResolveHandle;
00043 
00044 
00045 class Service
00046 {
00047 public:
00048   Glib::ustring name;
00049   Glib::ustring type;
00050   Glib::ustring domain;
00051 };
00052 
00056 typedef sigc::slot<void, BrowseHandle*, GnomeVFSDNSSDServiceStatus, const Service&> BrowseSlot;
00057 
00058 //The return value should only be used to call stop_browse().  
00059 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00060 BrowseHandle* browse(const Glib::ustring& domain, const Glib::ustring& type, const BrowseSlot& slot);
00061 #else
00062 BrowseHandle* browse(const Glib::ustring& domain, const Glib::ustring& type, const BrowseSlot& slot, std::auto_ptr<Gnome::Vfs::exception>& error);
00063 #endif //GLIBMM_EXCEPTIONS_ENABLED
00064 
00065 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00066 void stop_browse(BrowseHandle* handle);
00067 #else
00068 void stop_browse(BrowseHandle* handle, std::auto_ptr<Gnome::Vfs::exception>& error);
00069 #endif //GLIBMM_EXCEPTIONS_ENABLED
00070 
00071 typedef std::map<Glib::ustring, Glib::ustring> ServiceOptions;
00072 
00077 typedef sigc::slot<void, ResolveHandle*, Result, const Service&, const Glib::ustring&, int,
00078   const ServiceOptions&> ResolveSlot;
00079 
00080 //The return value should only be used to call cancel_resolve().
00081 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00082 ResolveHandle* resolve(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
00083                        int timeout, const ResolveSlot& slot);
00084 #else
00085 ResolveHandle* resolve(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
00086                        int timeout, const ResolveSlot& slot, std::auto_ptr<Gnome::Vfs::exception>& error);
00087 #endif //GLIBMM_EXCEPTIONS_ENABLED
00088 
00089 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00090 void cancel_resolve(ResolveHandle* handle);
00091 #else
00092 void cancel_resolve(ResolveHandle* handle, std::auto_ptr<Gnome::Vfs::exception>& error);
00093 #endif //GLIBMM_EXCEPTIONS_ENABLED
00094   
00095 
00096 typedef Glib::ListHandle<Service> ListHandleServices;
00097 
00098 //TODO: Use a generic Glib *Handle instead of std::list<Service>?
00099 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00100 void browse_sync(const Glib::ustring& domain, const Glib::ustring& type, int timeout_msec, std::list<Service>& services);
00101 #else
00102 void browse_sync(const Glib::ustring& domain, const Glib::ustring& type, int timeout_msec, std::list<Service>& services, std::auto_ptr<Gnome::Vfs::exception>& error);
00103 #endif //GLIBMM_EXCEPTIONS_ENABLED
00104 
00105 
00106 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00107 void resolve_sync(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
00108                   int timeout_msec, Glib::ustring& host, int& port, ServiceOptions& options);
00109 #else
00110 void resolve_sync(const Glib::ustring& name, const Glib::ustring& type, const Glib::ustring& domain,
00111                   int timeout_msec, Glib::ustring& host, int& port, ServiceOptions& options, std::auto_ptr<Gnome::Vfs::exception>& error);
00112 #endif //GLIBMM_EXCEPTIONS_ENABLED
00113 
00114 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
00115 
00116 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00117 ListHandleStrings list_browse_domains_sync(const Glib::ustring& domain, int timeout_msec);
00118 #else
00119 ListHandleStrings list_browse_domains_sync(const Glib::ustring& domain, int timeout_msec, std::auto_ptr<Gnome::Vfs::exception>& error);
00120 #endif //GLIBMM_EXCEPTIONS_ENABLED
00121 
00122 ListHandleStrings get_default_browse_domains();
00123 
00124 
00125 } // namespace DnsSd
00126 
00127 } // namespace Vfs
00128 
00129 } // namespace Gnome
00130 
00131 #endif

Generated on Sat Apr 7 01:48:27 2007 for libgnomevfsmm by  doxygen 1.5.1