diff options
author | James Willcox <snopr@snorp.net> | 2005-10-26 03:20:44 +0000 |
---|---|---|
committer | James Willcox <snopr@snorp.net> | 2005-10-26 03:20:44 +0000 |
commit | 94d2753047cff1e9223e42736884e4d51348b45a (patch) | |
tree | 5d4173121818486d3adaa3c3b357b2a6f893860c /avahi-sharp/Utility.cs | |
parent | 58dbdd3113ff75b7262ac2e7a8474550a2dacfd3 (diff) |
first pass at updating to the 0.6 apis
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@876 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-sharp/Utility.cs')
-rw-r--r-- | avahi-sharp/Utility.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/avahi-sharp/Utility.cs b/avahi-sharp/Utility.cs index 55254eb..f8b4ffd 100644 --- a/avahi-sharp/Utility.cs +++ b/avahi-sharp/Utility.cs @@ -36,6 +36,9 @@ namespace Avahi [DllImport ("avahi-common")] private static extern IntPtr avahi_address_snprint (IntPtr buf, int size, IntPtr address); + [DllImport ("avahi-common")] + private static extern IntPtr avahi_address_parse (IntPtr str, Protocol proto, IntPtr ret); + public static string PtrToString (IntPtr ptr) { if (ptr == IntPtr.Zero) @@ -74,6 +77,16 @@ namespace Avahi Stdlib.free (ptr); } + public static IntPtr AddressToPtr (IPAddress address) + { + IntPtr straddr = Utility.StringToPtr (address.ToString ()); + IntPtr addrPtr = Stdlib.malloc (32); + avahi_address_parse (straddr, Protocol.Unspecified, addrPtr); + Utility.Free (straddr); + + return addrPtr; + } + public static IPAddress PtrToAddress (IntPtr ptr) { IPAddress address = null; |