summaryrefslogtreecommitdiffstats
path: root/avahi-sharp/Client.cs
diff options
context:
space:
mode:
authorJames Willcox <snopr@snorp.net>2005-09-25 22:09:41 +0000
committerJames Willcox <snopr@snorp.net>2005-09-25 22:09:41 +0000
commitcc272cf44768c9292879a9ee43783fec4b510ffd (patch)
tree82b1121ff5e58a1b7319f0b555ded29caf3bae7f /avahi-sharp/Client.cs
parent9247af4048229c9b777791fd087e2068dd785a7d (diff)
* update to the latest avahi-client API (LookupFlags)
* add the local service cookie bits * update docs git-svn-id: file:///home/lennart/svn/public/avahi/trunk@620 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-sharp/Client.cs')
-rw-r--r--avahi-sharp/Client.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/avahi-sharp/Client.cs b/avahi-sharp/Client.cs
index 783c003..d9466bc 100644
--- a/avahi-sharp/Client.cs
+++ b/avahi-sharp/Client.cs
@@ -55,6 +55,23 @@ namespace Avahi
Collision,
Disconnected = 100
}
+
+ [Flags]
+ public enum LookupFlags {
+ None,
+ UseWideArea,
+ UseMulticast,
+ NoTxt,
+ NoAddress
+ }
+
+ [Flags]
+ public enum LookupResultFlags {
+ None,
+ Cached,
+ WideArea,
+ Multicast
+ }
public class Client : IDisposable
{
@@ -108,6 +125,14 @@ namespace Avahi
[DllImport ("avahi-common")]
private static extern void avahi_simple_poll_quit (IntPtr spoll);
+ [DllImport ("avahi-client")]
+ private static extern uint avahi_client_get_local_service_cookie (IntPtr client);
+
+ [DllImport ("avahi-client")]
+ private static extern int avahi_client_is_service_local (IntPtr client, int iface, Protocol proto,
+ IntPtr name, IntPtr type, IntPtr domain);
+
+
[DllImport ("libc")]
private static extern int poll(IntPtr ufds, uint nfds, int timeout);
@@ -163,6 +188,15 @@ namespace Avahi
}
}
+ public uint LocalServiceCookie
+ {
+ get {
+ lock (this) {
+ return avahi_client_get_local_service_cookie (handle);
+ }
+ }
+ }
+
internal int LastError
{
get {
@@ -210,6 +244,27 @@ namespace Avahi
}
}
+ public bool IsServiceLocal (ServiceInfo service)
+ {
+ return IsServiceLocal (service.NetworkInterface, service.Protocol, service.Name,
+ service.ServiceType, service.Domain);
+ }
+
+ public bool IsServiceLocal (int iface, Protocol proto, string name, string type, string domain)
+ {
+ IntPtr namePtr = Utility.StringToPtr (name);
+ IntPtr typePtr = Utility.StringToPtr (type);
+ IntPtr domainPtr = Utility.StringToPtr (domain);
+
+ int result = avahi_client_is_service_local (handle, iface, proto, namePtr, typePtr, domainPtr);
+
+ Utility.Free (namePtr);
+ Utility.Free (typePtr);
+ Utility.Free (domainPtr);
+
+ return result == 1;
+ }
+
internal void CheckError ()
{
int error = LastError;