Author: abock
Date: 2007-08-23 14:02:14 -0400 (Thu, 23 Aug 2007)
New Revision: 84728

Added:
   trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/
   
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/
   
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/DBusManager.cs
   
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/IAvahiServer.cs
   
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/IAvahiServiceBrowser.cs
   
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/ServiceBrowser.cs
   
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/ZeroconfProvider.cs
   trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/README
Modified:
   trunk/Mono.Zeroconf/ChangeLog
   trunk/Mono.Zeroconf/configure.ac
   trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Avahi/Makefile.am
   
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Avahi/Mono.Zeroconf.Providers.Avahi.mdp
   trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Bonjour/Makefile.am
Log:
2007-08-23  Aaron Bockover  <[EMAIL PROTECTED]>

    * configure.ac: Allow mDNSResponder to be disabled; link against
    avahi-sharp again since the DBus effort is on pause for now 

    * src/Mono.Zeroconf.Providers.Avahi/*: Restored the avahi-sharp version
    of the Avahi provider

    * src/Mono.Zeroconf.Providers.AvahiDBus/*: Added code for the Avahi DBus
    provider, but this does not build. It's just a safe keeping for the
    future when we may actually be able to implement the Avahi DBus provider;
    there are some things that may need addressing in NDesk DBus and/or
    Avahi proper




Modified: trunk/Mono.Zeroconf/ChangeLog
===================================================================
--- trunk/Mono.Zeroconf/ChangeLog       2007-08-23 17:48:31 UTC (rev 84727)
+++ trunk/Mono.Zeroconf/ChangeLog       2007-08-23 18:02:14 UTC (rev 84728)
@@ -1,3 +1,17 @@
+2007-08-23  Aaron Bockover  <[EMAIL PROTECTED]>
+
+       * configure.ac: Allow mDNSResponder to be disabled; link against 
+       avahi-sharp again since the DBus effort is on pause for now
+
+       * src/Mono.Zeroconf.Providers.Avahi/*: Restored the avahi-sharp version
+       of the Avahi provider
+
+       * src/Mono.Zeroconf.Providers.AvahiDBus/*: Added code for the Avahi DBus
+       provider, but this does not build. It's just a safe keeping for the 
+       future when we may actually be able to implement the Avahi DBus 
provider;
+       there are some things that may need addressing in NDesk DBus and/or
+       Avahi proper
+
 2007-08-21  Aaron Bockover  <[EMAIL PROTECTED]>
 
        * Mono.Zeroconf: Tons of reorg, cleanup, etc. Mono.Zeroconf will soon

Modified: trunk/Mono.Zeroconf/configure.ac
===================================================================
--- trunk/Mono.Zeroconf/configure.ac    2007-08-23 17:48:31 UTC (rev 84727)
+++ trunk/Mono.Zeroconf/configure.ac    2007-08-23 18:02:14 UTC (rev 84728)
@@ -25,7 +25,7 @@
        [Do not build with Avahi support]), , enable_avahi=yes)
 
 if test "x$enable_avahi" = "xyes"; then
-       PKG_CHECK_MODULES(AVAHI, ndesk-dbus-1.0 >= 0.5.0)
+       PKG_CHECK_MODULES(AVAHI, avahi-sharp >= 0.6.0)
        AC_SUBST(AVAHI_LIBS)
        AM_CONDITIONAL(BUILD_AVAHI, true)
 else
@@ -33,6 +33,10 @@
        AM_CONDITIONAL(BUILD_AVAHI, false)
 fi
 
+AC_ARG_ENABLE(mdnsresponder, AC_HELP_STRING([--disable-mdnsresponder],
+       [Do not build with mDNSResponder support]), , enable_mdnsresponder=yes)
+AM_CONDITIONAL(BUILD_MDNSRESPONDER, test "x$enable_mdnsresponder" = "xyes")
+
 SHAMROCK_EXPAND_LIBDIR
 
 AC_OUTPUT([
@@ -53,7 +57,8 @@
     C# Compiler:             ${MCS}
 
     Avahi Support:           ${enable_avahi}
+    mDNSResponder Support:   ${enable_mdnsresponder}
+
     Developer Documentation: ${enable_docs}
-
 "
 

Modified: trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Avahi/Makefile.am
===================================================================
--- trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Avahi/Makefile.am   
2007-08-23 17:48:31 UTC (rev 84727)
+++ trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Avahi/Makefile.am   
2007-08-23 18:02:14 UTC (rev 84728)
@@ -2,18 +2,12 @@
 ASSEMBLY = $(ASSEMBLY_NAME).dll
 
 MONO_ZEROCONF_PROVIDERS_AVAHI_SRC = \
-       IAvahiServiceBrowser.cs \
-       DBusManager.cs \
-       IAvahiServer.cs \
-       ZeroconfProvider.cs \
-       ServiceBrowser.cs
+       ResolvableService.cs \
+       ServiceBrowser.cs \
+       Service.cs \
+       TxtRecord.cs \
+       ZeroconfProvider.cs
 
-#Mono.Zeroconf.Providers.Avahi/ResolvableService.cs \
-#Mono.Zeroconf.Providers.Avahi/ServiceBrowser.cs \
-#Mono.Zeroconf.Providers.Avahi/Service.cs \
-#Mono.Zeroconf.Providers.Avahi/TxtRecord.cs \
-#Mono.Zeroconf.Providers.Avahi/ZeroconfProvider.cs
-
 SOURCES_PRE = \
        $(foreach 
source,$(MONO_ZEROCONF_PROVIDERS_AVAHI_SRC),Mono.Zeroconf.Providers.Avahi/$(source))
 

Modified: 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Avahi/Mono.Zeroconf.Providers.Avahi.mdp
===================================================================
--- 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Avahi/Mono.Zeroconf.Providers.Avahi.mdp
     2007-08-23 17:48:31 UTC (rev 84727)
+++ 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Avahi/Mono.Zeroconf.Providers.Avahi.mdp
     2007-08-23 18:02:14 UTC (rev 84728)
@@ -8,19 +8,16 @@
     </Configuration>
   </Configurations>
   <Contents>
-    <File name="./Mono.Zeroconf.Providers.Avahi/ResolvableService.cs" 
subtype="Code" buildaction="Nothing" />
-    <File name="./Mono.Zeroconf.Providers.Avahi/Service.cs" subtype="Code" 
buildaction="Nothing" />
+    <File name="./Mono.Zeroconf.Providers.Avahi/ResolvableService.cs" 
subtype="Code" buildaction="Compile" />
+    <File name="./Mono.Zeroconf.Providers.Avahi/Service.cs" subtype="Code" 
buildaction="Compile" />
     <File name="./Mono.Zeroconf.Providers.Avahi/ServiceBrowser.cs" 
subtype="Code" buildaction="Compile" />
-    <File name="./Mono.Zeroconf.Providers.Avahi/TxtRecord.cs" subtype="Code" 
buildaction="Nothing" />
+    <File name="./Mono.Zeroconf.Providers.Avahi/TxtRecord.cs" subtype="Code" 
buildaction="Compile" />
     <File name="./Mono.Zeroconf.Providers.Avahi/ZeroconfProvider.cs" 
subtype="Code" buildaction="Compile" />
-    <File name="./Mono.Zeroconf.Providers.Avahi/DBusManager.cs" subtype="Code" 
buildaction="Compile" />
-    <File name="./Mono.Zeroconf.Providers.Avahi/IAvahiServer.cs" 
subtype="Code" buildaction="Compile" />
-    <File name="./Mono.Zeroconf.Providers.Avahi/IAvahiServiceBrowser.cs" 
subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="Mono.Zeroconf" />
     <ProjectReference type="Gac" localcopy="True" refto="System, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     <ProjectReference type="Gac" localcopy="True" refto="System.Web, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
-    <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus, 
Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
+    <ProjectReference type="Gac" localcopy="True" refto="avahi-sharp, 
Version=1.0.0.0, Culture=neutral, PublicKeyToken=4d116c78973743f5" />
   </References>
 </Project>
\ No newline at end of file

Added: 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/DBusManager.cs
===================================================================
--- 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/DBusManager.cs
      2007-08-23 17:48:31 UTC (rev 84727)
+++ 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/DBusManager.cs
      2007-08-23 18:02:14 UTC (rev 84728)
@@ -0,0 +1,138 @@
+//
+// DBusManager.cs
+//
+// Authors:
+//     Aaron Bockover  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+
+using NDesk.DBus;
+
+namespace Mono.Zeroconf.Providers.Avahi
+{
+    internal static class DBusManager
+    {
+       private const uint MINIMUM_AVAHI_API_VERSION = 515;
+        
+        private static object iterate_thread_mutex = new object();
+        private static int iterate_freeze_count = 0;
+        private static Thread iterate_thread;
+
+               private static Bus bus;
+
+        private static IAvahiServer server;
+        public static IAvahiServer Server {
+               get { return server; }
+        }
+        
+        private static void InitializeSystemBusConnection()
+        {
+            string address = 
Environment.GetEnvironmentVariable("DBUS_SYSTEM_BUS_ADDRESS");
+            if(String.IsNullOrEmpty(address)) {
+               address = "unix:path=/var/run/dbus/system_bus_socket";
+            }
+                       
+                       bus = Bus.Open(address);
+        }
+
+        public static void Initialize()
+        {
+            InitializeSystemBusConnection();
+            
+                       if(!bus.NameHasOwner("org.freedesktop.Avahi")) {
+                               throw new ApplicationException("Could not find 
org.freedesktop.Avahi");
+                       }
+                       
+                       server = 
bus.GetObject<IAvahiServer>("org.freedesktop.Avahi", new ObjectPath("/"));
+                       uint api_version = server.GetAPIVersion();
+                       
+                       if(api_version < MINIMUM_AVAHI_API_VERSION) {
+                               throw new 
ApplicationException(String.Format("Avahi API version " +
+                                       "{0} is required, but {1} is what the 
server returned.", 
+                                       MINIMUM_AVAHI_API_VERSION, 
api_version));
+                       }
+                       
+                       // If you remove this you will see that the events 
+                       // come through -- it'll work for the first object,
+                       // but once the thread is created you are hosed.
+                       // Leaving this call here for testing/debugging
+                       // while the iterate issue is looked into. For
+                       // production, this call will be deferred until
+                       // it's necessary.
+                       EnsureIterate();
+        }
+        
+        public static T GetObject<T>(string object_path)
+        {
+               return GetObject<T>(new ObjectPath(object_path));
+        }
+
+               public static T GetObject<T>(ObjectPath object_path)
+               {
+                       return bus.GetObject<T>("org.freedesktop.Avahi", 
object_path);
+               }
+        
+        public static void EnsureIterate()
+        {
+               lock(iterate_thread_mutex) {
+                       if(iterate_thread != null) {
+                               return;
+                       }
+                       
+                       iterate_thread = new Thread(Iterate);
+                       iterate_thread.IsBackground = true;
+                       iterate_thread.Start();
+               }
+        }
+        
+        private static void Iterate()
+        {
+                       while(true) {
+                               if(iterate_freeze_count == 0) {
+                                   Console.WriteLine("Start Iterate");
+                                       bus.Iterate();
+                                       Console.WriteLine("End Iterate");
+                               }
+                       }
+        }
+        
+        public static void BusLock()
+        {
+               Interlocked.Increment(ref iterate_freeze_count);
+               Console.WriteLine("Freeze: {0}", iterate_freeze_count);
+               EnsureIterate();
+        }
+        
+        public static void BusUnlock()
+        {
+               Interlocked.Decrement(ref iterate_freeze_count);
+               Console.WriteLine("Unfreeze: {0}", iterate_freeze_count);
+               EnsureIterate();
+        }
+    }
+}

Added: 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/IAvahiServer.cs
===================================================================
--- 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/IAvahiServer.cs
     2007-08-23 17:48:31 UTC (rev 84727)
+++ 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/IAvahiServer.cs
     2007-08-23 18:02:14 UTC (rev 84728)
@@ -0,0 +1,42 @@
+//
+// IServer.cs
+//
+// Authors:
+//     Aaron Bockover  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using NDesk.DBus;
+
+namespace Mono.Zeroconf.Providers.Avahi
+{ 
+    [Interface("org.freedesktop.Avahi.Server")]
+    public interface IAvahiServer
+    {
+        uint GetAPIVersion();
+        
+        ObjectPath ServiceBrowserNew(int @interface, int protocol, 
+            string type, string domain, uint flags);
+    }   
+}

Added: 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/IAvahiServiceBrowser.cs
===================================================================
--- 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/IAvahiServiceBrowser.cs
     2007-08-23 17:48:31 UTC (rev 84727)
+++ 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/IAvahiServiceBrowser.cs
     2007-08-23 18:02:14 UTC (rev 84728)
@@ -0,0 +1,50 @@
+//
+// IServiceBrowser.cs
+//
+// Authors:
+//     Aaron Bockover  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using NDesk.DBus;
+
+namespace Mono.Zeroconf.Providers.Avahi
+{
+    public delegate void ServiceBrowserItemHandler(int @interface, int 
protocol, string name, 
+        string type, string domain, uint flags);
+
+    public delegate void ServiceBrowserHandler();
+
+    [Interface("org.freedesktop.Avahi.ServiceBrowser")]
+    public interface IAvahiServiceBrowser
+    {
+        event ServiceBrowserItemHandler ItemNew;
+        event ServiceBrowserItemHandler ItemRemove;
+        
+        event ServiceBrowserHandler AllForNow;
+        event ServiceBrowserHandler CacheExhausted;
+        
+        void Free();
+    }   
+}

Added: 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/ServiceBrowser.cs
===================================================================
--- 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/ServiceBrowser.cs
   2007-08-23 17:48:31 UTC (rev 84727)
+++ 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/ServiceBrowser.cs
   2007-08-23 18:02:14 UTC (rev 84728)
@@ -0,0 +1,85 @@
+//
+// ServiceBrowser.cs
+//
+// Authors:
+//     Aaron Bockover  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Mono.Zeroconf;
+
+namespace Mono.Zeroconf.Providers.Avahi
+{
+    public class ServiceBrowser : IServiceBrowser
+    {
+        public event ServiceBrowseEventHandler ServiceAdded;
+        public event ServiceBrowseEventHandler ServiceRemoved;
+    
+       private IAvahiServiceBrowser service_browser;
+    
+        public ServiceBrowser()
+        {
+        }
+        
+        public void Dispose()
+        {
+               if(service_browser != null) {
+                       service_browser.ItemNew -= OnItemNew;
+                       service_browser.ItemRemove -= OnItemRemove;
+                       service_browser.Free();
+               }
+        }
+    
+        public void Browse(string regtype, string domain)
+        {
+            Dispose();
+            
+            DBusManager.BusLock();
+            
+            service_browser = DBusManager.GetObject<IAvahiServiceBrowser>(
+               DBusManager.Server.ServiceBrowserNew(-1, -1, regtype, domain, 
0));
+            
+            service_browser.ItemNew += OnItemNew;
+            
+            DBusManager.BusUnlock();
+            
+            DBusManager.BusLock();
+            service_browser.ItemRemove += OnItemRemove;
+            DBusManager.BusUnlock();
+            
+        }
+        
+        private void OnItemNew(int @interface, int protocol, string name, 
+               string type, string domain, uint flags)
+        {
+               Console.WriteLine("NEW ITEM: {0}", name);
+        }
+        
+        private void OnItemRemove(int @interface, int protocol, string name, 
+               string type, string domain, uint flags)
+        {
+               Console.WriteLine("ITEM REMOVED: {0}", name);
+        }
+    }
+}

Added: 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/ZeroconfProvider.cs
===================================================================
--- 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/ZeroconfProvider.cs
 2007-08-23 17:48:31 UTC (rev 84727)
+++ 
trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.Avahi/ZeroconfProvider.cs
 2007-08-23 18:02:14 UTC (rev 84728)
@@ -0,0 +1,55 @@
+//
+// ZeroconfProvider.cs
+//
+// Authors:
+//     Aaron Bockover  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+
+[assembly:Mono.Zeroconf.Providers.ZeroconfProvider(typeof(Mono.Zeroconf.Providers.Avahi.ZeroconfProvider))]
+
+namespace Mono.Zeroconf.Providers.Avahi
+{
+    public class ZeroconfProvider : IZeroconfProvider
+    {
+        public void Initialize()
+        {
+            DBusManager.Initialize();
+        }
+        
+        public Type ServiceBrowser { 
+            get { return typeof(Mono.Zeroconf.Providers.Avahi.ServiceBrowser); 
}
+        }
+        
+        public Type RegisterService { 
+            get { return null; }
+        }
+        
+        public Type TxtRecord {
+            get { return null; }
+        }
+    }
+}

Added: trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/README
===================================================================
--- trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/README    
2007-08-23 17:48:31 UTC (rev 84727)
+++ trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.AvahiDBus/README    
2007-08-23 18:02:14 UTC (rev 84728)
@@ -0,0 +1,27 @@
+Ideally the Avahi provider would just use DBus instead of avahi-sharp.
+
+Using avahi-sharp:
+
+       [Application]     (managed)
+       [Mono.Zeroconf]   (managed)
+       [avahi-sharp]     (managed p/invoke binding)
+       [libavahi-client] (native)
+       [libdbus]         (native)
+                 ..          (DBus IPC)
+       [avahi-daemon]    (native)
+
+Using DBus:
+
+       [Application]     (managed)
+       [Mono.Zeroconf]   (managed)
+       [NDesk.DBus]      (managed)
+                 ..          (DBus IPC)
+       [avahi-daemon]    (native)
+
+However, due to some poor design decisions in the Avahi DBus API,
+implementing the provider via DBus is not currently possible without
+exposing the need for the application to use DBus.
+
+The DBus provider for Avahi will be resumed later. For now the
+avahi-sharp binding provider will have to do.
+

Modified: trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Bonjour/Makefile.am
===================================================================
--- trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Bonjour/Makefile.am 
2007-08-23 17:48:31 UTC (rev 84727)
+++ trunk/Mono.Zeroconf/src/Mono.Zeroconf.Providers.Bonjour/Makefile.am 
2007-08-23 18:02:14 UTC (rev 84728)
@@ -23,6 +23,8 @@
        $(top_srcdir)/src/AssemblyInfo.cs \
        $(foreach source,$(SOURCES_PRE),$(srcdir)/$(source))
 
+if BUILD_MDNSRESPONDER
+
 assemblydir = $(libdir)/mono-zeroconf
 assembly_SCRIPTS = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config
 
@@ -31,6 +33,8 @@
 $(ASSEMBLY): $(top_builddir)/src/Mono.Zeroconf/Mono.Zeroconf.dll $(SOURCES)
        $(MCS) -debug -target:library -out:$@ -r:$< $(AVAHI_LIBS) $(SOURCES)
 
+endif
+
 EXTRA_DIST = $(SOURCES) $(ASSEMBLY).config
 CLEANFILES = *.dll *.mdb
 DISTCLEANFILES = *.pidb

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to