diff options
author | Jonathon Jongsma <jonathon@quotidian.org> | 2009-06-17 22:37:14 -0500 |
---|---|---|
committer | Jonathon Jongsma <jonathon@quotidian.org> | 2009-06-17 23:59:22 -0500 |
commit | f365326dd970083f339b393ea3ae0efcf3ce091c (patch) | |
tree | 0821056cfe4e6afb308807c0b8bac088edc061b8 /gio/src/resolver.hg | |
parent | 7896cdddf7d987a9e06bc05e03864698b306cc43 (diff) | |
download | glibmm-f365326dd970083f339b393ea3ae0efcf3ce091c.tar.gz |
initial wrapping of Resolver, SrvTarget
Diffstat (limited to 'gio/src/resolver.hg')
-rw-r--r-- | gio/src/resolver.hg | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/gio/src/resolver.hg b/gio/src/resolver.hg new file mode 100644 index 00000000..31573b62 --- /dev/null +++ b/gio/src/resolver.hg @@ -0,0 +1,87 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + +/* Copyright (C) 2009 jonathon jongsma + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <giomm/inetaddress.h> +#include <giomm/cancellable.h> +#include <giomm/srvtarget.h> + +_DEFS(giomm,gio) +_PINCLUDE(glibmm/private/object_p.h) + +namespace Gio +{ + +/** Asynchronous and cancellable DNS resolver + * + * Resolver provides cancellable synchronous and asynchronous DNS resolution, + * for hostnames (lookup_by_address(), lookup_by_name() and their async + * variants) and SRV (service) records (lookup_service()). + * + * NetworkAddress and NetworkService provide wrappers around Resolver + * functionality that also implement SocketConnectable, making it easy to + * connect to a remote host/service. + * + * @newin2p22 + */ +class Resolver +: public Glib::Object +{ + _CLASS_GOBJECT(Resolver, GResolver, G_RESOLVER, Glib::Object, GObject) + +protected: + +public: + static Glib::RefPtr<Resolver> get_default(); + _IGNORE(g_resolver_get_default) + static void set_default(const Glib::RefPtr<Resolver>& resolver); + _IGNORE(g_resolver_set_default) + + // g_resolver_free_addresses is just a C convenience function + _IGNORE(g_resolver_free_addresses) + +#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_SHALLOW)') + _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_by_name, errthrow) +#ifdef GLIBMM_EXCEPTIONS_ENABLED + Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname); +#else + Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname, std::auto_ptr<Glib::Error>& error); +#endif + //TODO lookup_by_name_async + +#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_SHALLOW)') + _WRAP_METHOD(Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_by_address, errthrow) +#ifdef GLIBMM_EXCEPTIONS_ENABLED + Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address); +#else + Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, std::auto_ptr<Glib::Error>& error); +#endif //GLIBMM_EXCEPTIONS_ENABLED + //TODO lookup_by_address_async + +#m4 _CONVERSION(`GList*',`Glib::ListHandle<SrvTarget>',`$2($3, Glib::OWNERSHIP_SHALLOW)') + _WRAP_METHOD(Glib::ListHandle<SrvTarget> lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_service, errthrow) +#ifdef GLIBMM_EXCEPTIONS_ENABLED + Glib::ListHandle<SrvTarget> lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain); +#else + Glib::ListHandle<SrvTarget> lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, std::auto_ptr<Glib::Error>& error); +#endif //GLIBMM_EXCEPTIONS_ENABLED + //TODO lookup_service_async +}; + +} // namespace Gio |