Skip to content

Commit

Permalink
2009-03-30 Aaron Bockover <[email protected]>
Browse files Browse the repository at this point in the history
    * src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.AvahiDBus/Service.cs:
    Set the interface to unspecified by default, fixing a bug reported on
    Stack Overflow (http://stackoverflow.com/questions/599846)

    * src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.AvahiDBus/RegisterService.cs:
    Verify that the server is indeed running by calling server.GetState ()
    before creating a new entry group

    * src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.AvahiDBus/AvahiServerState.cs:
    Added AvahiServerState enum

    * src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.AvahiDBus/IAvahiServer.cs:
    Add the GetState method


svn path=/trunk/Mono.Zeroconf/; revision=130583
  • Loading branch information
abock committed Mar 30, 2009
1 parent 09fda89 commit dd08db6
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 1 deletion.
16 changes: 16 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2009-03-30 Aaron Bockover <[email protected]>

* src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.AvahiDBus/Service.cs:
Set the interface to unspecified by default, fixing a bug reported on
Stack Overflow (http://stackoverflow.com/questions/599846)

* src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.AvahiDBus/RegisterService.cs:
Verify that the server is indeed running by calling server.GetState ()
before creating a new entry group

* src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.AvahiDBus/AvahiServerState.cs:
Added AvahiServerState enum

* src/Mono.Zeroconf.Providers.AvahiDBus/Mono.Zeroconf.Providers.AvahiDBus/IAvahiServer.cs:
Add the GetState method

2008-09-11 Aaron Bockover <[email protected]>

0.8.0 Released
Expand Down
1 change: 1 addition & 0 deletions src/Mono.Zeroconf.Providers.AvahiDBus/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ASSEMBLY_NAME = Mono.Zeroconf.Providers.AvahiDBus
ASSEMBLY = $(ASSEMBLY_NAME).dll

MONO_ZEROCONF_PROVIDERS_AVAHI_SRC = \
Mono.Zeroconf.Providers.AvahiDBus/AvahiServerState.cs \
Mono.Zeroconf.Providers.AvahiDBus/AvahiUtils.cs \
Mono.Zeroconf.Providers.AvahiDBus/BrowseService.cs \
Mono.Zeroconf.Providers.AvahiDBus/DBusManager.cs \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<Compile Include="Mono.Zeroconf.Providers.AvahiDBus\LookupFlags.cs" />
<Compile Include="Mono.Zeroconf.Providers.AvahiDBus\LookupResultFlags.cs" />
<Compile Include="Mono.Zeroconf.Providers.AvahiDBus\IAvahiServiceResolver.cs" />
<Compile Include="Mono.Zeroconf.Providers.AvahiDBus\AvahiServerState.cs" />
<Compile Include="Mono.Zeroconf.Providers.AvahiDBus\AvahiUtils.cs" />
<Compile Include="Mono.Zeroconf.Providers.AvahiDBus\Service.cs" />
<Compile Include="Mono.Zeroconf.Providers.AvahiDBus\BrowseService.cs" />
Expand Down Expand Up @@ -92,4 +93,4 @@
</Properties>
</MonoDevelop>
</ProjectExtensions>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// AvahiServerState.cs
//
// Author:
// Aaron Bockover <[email protected]>
//
// Copyright (C) 2009 Novell, Inc.
//
// 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;

namespace Mono.Zeroconf.Providers.AvahiDBus
{
public enum AvahiServerState
{
Invalid,
Registering,
Running,
Collision,
Failure
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ namespace Mono.Zeroconf.Providers.AvahiDBus
public interface IAvahiServer
{
uint GetAPIVersion ();

AvahiServerState GetState ();

ObjectPath ServiceBrowserNew (int @interface, Protocol protocol,
string type, string domain, LookupFlags flags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ public void Register ()
byte [][] txt_record = TxtRecord == null
? new byte[0][]
: Mono.Zeroconf.Providers.AvahiDBus.TxtRecord.Render (TxtRecord);

entry_group.AddService (AvahiInterface, AvahiProtocol, PublishFlags.None,
Name ?? String.Empty, RegType ?? String.Empty, ReplyDomain ?? String.Empty,
String.Empty, (ushort)port, txt_record);

entry_group.Commit ();
}

Expand All @@ -72,6 +74,10 @@ private void RegisterDBus ()
return;
}

if (DBusManager.Server.GetState () != AvahiServerState.Running) {
throw new ApplicationException ("Avahi Server is not in the Running state");
}

ObjectPath path = DBusManager.Server.EntryGroupNew ();
entry_group = DBusManager.GetObject<IAvahiEntryGroup> (path);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class Service : Mono.Zeroconf.IService

public Service ()
{
this.@interface = -1; // Unspecified
}

public Service (string name, string regtype, string replyDomain, int @interface, Protocol aprotocol)
Expand Down

0 comments on commit dd08db6

Please sign in to comment.