diff options
author | James Willcox <snopr@snorp.net> | 2005-11-17 21:11:13 +0000 |
---|---|---|
committer | James Willcox <snopr@snorp.net> | 2005-11-17 21:11:13 +0000 |
commit | 9a589e1f5221d1bd995b6c4fa73e3a074d4c2da4 (patch) | |
tree | 10b4bf2a914fa421474e6e895331d3cb4b07c9d9 /avahi-sharp/ServiceResolver.cs | |
parent | 84e07c25895dd6a8f706499a867afa44b9444ce2 (diff) |
* add byte[] overloads for EntryGroup methods
* cleanup string marshalling
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@999 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-sharp/ServiceResolver.cs')
-rw-r--r-- | avahi-sharp/ServiceResolver.cs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/avahi-sharp/ServiceResolver.cs b/avahi-sharp/ServiceResolver.cs index 8dfe520..945372b 100644 --- a/avahi-sharp/ServiceResolver.cs +++ b/avahi-sharp/ServiceResolver.cs @@ -23,6 +23,7 @@ using System; using System.Collections; using System.Net; using System.Runtime.InteropServices; +using System.Text; using Mono.Unix; namespace Avahi @@ -53,7 +54,7 @@ namespace Avahi [DllImport ("avahi-client")] private static extern IntPtr avahi_service_resolver_new (IntPtr client, int iface, Protocol proto, - IntPtr name, IntPtr type, IntPtr domain, + byte[] name, byte[] type, byte[] domain, Protocol aproto, LookupFlags flags, ServiceResolverCallback cb, IntPtr userdata); @@ -145,18 +146,14 @@ namespace Avahi (foundListeners.Count == 0 && timeoutListeners.Count == 0)) return; - IntPtr namePtr = Utility.StringToPtr (name); - IntPtr typePtr = Utility.StringToPtr (type); - IntPtr domainPtr = Utility.StringToPtr (domain); - lock (client) { - handle = avahi_service_resolver_new (client.Handle, iface, proto, namePtr, typePtr, domainPtr, - aproto, flags, cb, IntPtr.Zero); + handle = avahi_service_resolver_new (client.Handle, iface, proto, + Utility.StringToBytes (name), Utility.StringToBytes (type), + Utility.StringToBytes (domain), aproto, flags, cb, IntPtr.Zero); + + if (handle == IntPtr.Zero) + client.ThrowError (); } - - Utility.Free (namePtr); - Utility.Free (typePtr); - Utility.Free (domainPtr); } private void Stop (bool force) |