--- /dev/null
+# $Id: Makefile.am 1251 2006-08-21 23:31:59Z lennart $
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# avahi is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with avahi; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+
+ASSEMBLY = avahi-ui-sharp.dll
+
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config
+
+AVAHISOURCES = \
+ $(srcdir)/ServiceDialog.cs
+
+EXTRA_DIST = \
+ $(AVAHISOURCES) \
+ $(srcdir)/avahi-ui-sharp-docs.source \
+ $(srcdir)/en/*.xml \
+ $(srcdir)/en/*/*.xml \
+ $(srcdir)/gencfg.sh
+
+$(ASSEMBLY): $(AVAHISOURCES)
+ mcs -keyfile:$(top_srcdir)/avahi-sharp/avahi.snk -target:library -out:$@ -debug $(AVAHISOURCES) -pkg:gtk-sharp-2.0 -r:$(top_builddir)/avahi-sharp/avahi-sharp.dll -r:Mono.Posix
+
+$(ASSEMBLY).config: $(ASSEMBLY).config.in
+ $(srcdir)/gencfg.sh $(top_builddir)/avahi-common/libavahi-common.la < $< > $@
+
+if HAVE_MONO
+if HAVE_DBUS
+all: $(ASSEMBLY) $(ASSEMBLY).config
+
+if HAVE_MONODOC
+update-docs: $(ASSEMBLY)
+ $(MONODOCER) -assembly:$(ASSEMBLY) -path:en
+
+avahi-ui-sharp-docs.zip: avahi-ui-sharp-docs.tree
+
+avahi-ui-sharp-docs.tree: $(srcdir)/en/*/*
+ $(MDASSEMBLER) --out avahi-ui-sharp-docs --ecma $(srcdir)/en
+
+monodocdir = $(MONODOC_DIR)
+monodoc_DATA = avahi-ui-sharp-docs.zip avahi-ui-sharp-docs.tree avahi-ui-sharp-docs.source
+
+endif
+
+install-data-hook: $(ASSEMBLY)
+ $(GACUTIL) /i $(ASSEMBLY) /package avahi-ui-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
+
+uninstall-hook: $(ASSEMBLY)
+ $(GACUTIL) /u avahi-sharp /package avahi-ui-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
+
+endif
+endif
--- /dev/null
+using System;
+using System.Net;
+using System.Collections;
+using System.Runtime.InteropServices;
+using Gtk;
+using Mono.Unix;
+using Mono.Unix.Native;
+
+namespace Avahi.UI
+{
+ public class ServiceDialog : Dialog
+ {
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_new (string title, IntPtr parent, IntPtr dummy);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_browse_service_typesv (IntPtr dialog, IntPtr[] types);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_browse_service_types (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_domain (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_domain (IntPtr dialog, IntPtr domain);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_service_type (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_service_type (IntPtr dialog, IntPtr type);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_service_name (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_service_name (IntPtr dialog, IntPtr type);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_address (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern UInt16 aui_service_dialog_get_port (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_host_name (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_txt_data (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern bool aui_service_dialog_get_resolve_service (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_resolve_service (IntPtr dialog, bool val);
+
+ [DllImport ("avahi-ui")]
+ private static extern bool aui_service_dialog_get_resolve_host_name (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_resolve_host_name (IntPtr dialog, bool val);
+
+ [DllImport ("avahi-ui")]
+ private static extern Protocol aui_service_dialog_get_address_family (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_address_family (IntPtr dialog, Protocol proto);
+
+ [DllImport ("avahi-common")]
+ private static extern IntPtr avahi_address_snprint (IntPtr buf, int size, IntPtr address);
+
+ [DllImport ("avahi-common")]
+ private static extern IntPtr avahi_string_list_get_next (IntPtr list);
+
+ [DllImport ("avahi-common")]
+ private static extern IntPtr avahi_string_list_get_text (IntPtr list);
+
+ [DllImport ("avahi-common")]
+ private static extern int avahi_string_list_get_size (IntPtr list);
+
+ public string[] BrowseServiceTypes {
+ get {
+ IntPtr arr = aui_service_dialog_get_browse_service_types (Raw);
+
+ ArrayList values = new ArrayList ();
+
+ for (int i = 0;;i++) {
+ IntPtr ptr = Marshal.ReadIntPtr (arr, i * Marshal.SizeOf (typeof (IntPtr)));
+
+ if (ptr == IntPtr.Zero)
+ break;
+
+ values.Add (GLib.Marshaller.Utf8PtrToString (ptr));
+ }
+
+ return (string[]) values.ToArray (typeof (string));
+ } set {
+ IntPtr[] types;
+ if (value == null) {
+ types = new IntPtr[] { IntPtr.Zero };
+ } else {
+ types = new IntPtr[value.Length + 1];
+
+ for (int i = 0; i < value.Length; i++) {
+ types[i] = GLib.Marshaller.StringToPtrGStrdup (value[i]);
+ }
+
+ types[value.Length] = IntPtr.Zero;
+ }
+
+ aui_service_dialog_set_browse_service_typesv (Raw, types);
+
+ for (int i = 0;;i++) {
+ if (types[i] != IntPtr.Zero)
+ break;
+
+ GLib.Marshaller.Free (types[i]);
+ }
+ }
+ }
+
+ public string ServiceType {
+ get {
+ return GLib.Marshaller.Utf8PtrToString (aui_service_dialog_get_service_type (Raw));
+ } set {
+ IntPtr type = GLib.Marshaller.StringToPtrGStrdup (value);
+ aui_service_dialog_set_service_type (Raw, type);
+ GLib.Marshaller.Free (type);
+ }
+ }
+
+ public string ServiceName {
+ get {
+ return GLib.Marshaller.Utf8PtrToString (aui_service_dialog_get_service_name (Raw));
+ } set {
+ IntPtr name = GLib.Marshaller.StringToPtrGStrdup (value);
+ aui_service_dialog_set_service_name (Raw, name);
+ GLib.Marshaller.Free (name);
+ }
+ }
+
+ public IPAddress Address {
+ get {
+ return PtrToAddress (aui_service_dialog_get_address (Raw));
+ }
+ }
+
+ public UInt16 Port {
+ get {
+ return aui_service_dialog_get_port (Raw);
+ }
+ }
+
+ public string HostName {
+ get {
+ return GLib.Marshaller.Utf8PtrToString (aui_service_dialog_get_host_name (Raw));
+ }
+ }
+
+ public string Domain {
+ get {
+ return GLib.Marshaller.Utf8PtrToString (aui_service_dialog_get_domain (Raw));
+ } set {
+ IntPtr domain = GLib.Marshaller.StringToPtrGStrdup (value);
+ aui_service_dialog_set_domain (Raw, domain);
+ GLib.Marshaller.Free (domain);
+ }
+ }
+
+ public byte[][] TxtData {
+ get {
+ ArrayList txtlist = new ArrayList ();
+ IntPtr txt = aui_service_dialog_get_txt_data (Raw);
+
+ for (IntPtr l = txt; l != IntPtr.Zero; l = avahi_string_list_get_next (l)) {
+ IntPtr buf = avahi_string_list_get_text (l);
+ int len = avahi_string_list_get_size (l);
+
+ byte[] txtbuf = new byte[len];
+ Marshal.Copy (buf, txtbuf, 0, len);
+ txtlist.Add (txtbuf);
+ }
+
+ return (byte[][]) txtlist.ToArray (typeof (byte[]));
+ }
+ }
+
+ public bool ResolveServiceEnabled {
+ get {
+ return aui_service_dialog_get_resolve_service (Raw);
+ } set {
+ aui_service_dialog_set_resolve_service (Raw, value);
+ }
+ }
+
+ public bool ResolveHostNameEnabled {
+ get {
+ return aui_service_dialog_get_resolve_host_name (Raw);
+ } set {
+ aui_service_dialog_set_resolve_host_name (Raw, value);
+ }
+ }
+
+ public Protocol AddressFamily {
+ get {
+ return aui_service_dialog_get_address_family (Raw);
+ } set {
+ aui_service_dialog_set_address_family (Raw, value);
+ }
+ }
+
+ public ServiceDialog (string title, Window parent, params object[] buttonData)
+ {
+ Raw = aui_service_dialog_new (title, parent == null ? IntPtr.Zero : parent.Handle,
+ IntPtr.Zero);
+
+ for (int i = 0; i < buttonData.Length - 1; i += 2) {
+ AddButton ((string) buttonData[i], (int) buttonData[i + 1]);
+ }
+ }
+
+ private static IPAddress PtrToAddress (IntPtr ptr)
+ {
+ IPAddress address = null;
+
+ if (ptr != IntPtr.Zero) {
+ IntPtr buf = Stdlib.malloc (256);
+ IntPtr addrPtr = avahi_address_snprint (buf, 256, ptr);
+ address = IPAddress.Parse (GLib.Marshaller.Utf8PtrToString (addrPtr));
+
+ Stdlib.free (addrPtr);
+ }
+
+ return address;
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0"?>
+<monodoc>
+ <source provider="ecma" basefile="avahi-ui-sharp-docs" path="various" title="Avahi" />
+</monodoc>
--- /dev/null
+<configuration>
+ <dllmap dll="avahi-ui" target="libavahi-ui.so.0"/>
+ <dllmap dll="avahi-common" target="@COMMON_DLNAME@"/>
+</configuration>
--- /dev/null
+<Namespace Name="Avahi.UI">
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+</Namespace>
--- /dev/null
+<Type Name="ServiceDialog" FullName="Avahi.UI.ServiceDialog">
+ <TypeSignature Language="C#" Value="public class ServiceDialog : Gtk.Dialog" />
+ <AssemblyInfo>
+ <AssemblyName>avahi-ui-sharp</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Base>
+ <BaseTypeName>Gtk.Dialog</BaseTypeName>
+ </Base>
+ <Interfaces />
+ <Members>
+ <Member MemberName=".ctor">
+ <MemberSignature Language="C#" Value="public ServiceDialog (string title, Gtk.Window parent, object[] buttonData);" />
+ <MemberType>Constructor</MemberType>
+ <Parameters>
+ <Parameter Name="title" Type="System.String" />
+ <Parameter Name="parent" Type="Gtk.Window" />
+ <Parameter Name="buttonData" Type="System.Object[]">
+ <Attributes>
+ <Attribute>
+ <AttributeName>System.ParamArray</AttributeName>
+ </Attribute>
+ </Attributes>
+ </Parameter>
+ </Parameters>
+ <Docs>
+ <param name="title">To be added.</param>
+ <param name="parent">To be added.</param>
+ <param name="buttonData">To be added.</param>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="Address">
+ <MemberSignature Language="C#" Value="public System.Net.IPAddress Address { get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.Net.IPAddress</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="AddressFamily">
+ <MemberSignature Language="C#" Value="public Avahi.Protocol AddressFamily { set; get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>Avahi.Protocol</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="BrowseServiceTypes">
+ <MemberSignature Language="C#" Value="public string[] BrowseServiceTypes { set; get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.String[]</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="Domain">
+ <MemberSignature Language="C#" Value="public string Domain { set; get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.String</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="HostName">
+ <MemberSignature Language="C#" Value="public string HostName { get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.String</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="Port">
+ <MemberSignature Language="C#" Value="public ushort Port { get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.UInt16</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="ResolveHostNameEnabled">
+ <MemberSignature Language="C#" Value="public bool ResolveHostNameEnabled { set; get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="ResolveServiceEnabled">
+ <MemberSignature Language="C#" Value="public bool ResolveServiceEnabled { set; get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="ServiceName">
+ <MemberSignature Language="C#" Value="public string ServiceName { set; get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.String</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="ServiceType">
+ <MemberSignature Language="C#" Value="public string ServiceType { set; get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.String</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="TxtData">
+ <MemberSignature Language="C#" Value="public byte[][] TxtData { get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.Byte[][]</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ </Members>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+</Type>
--- /dev/null
+<Overview>
+ <Assemblies>
+ <Assembly Name="avahi-ui-sharp" Version="0.0.0.0" />
+ </Assemblies>
+ <Remarks>To be added.</Remarks>
+ <Copyright>To be added.</Copyright>
+ <Types>
+ <Namespace Name="Avahi.UI">
+ <Type Name="ServiceDialog" />
+ </Namespace>
+ </Types>
+ <Title>avahi-ui-sharp</Title>
+</Overview>
--- /dev/null
+#!/bin/sh
+
+. $1
+common_dlname=$dlname
+
+exec sed -e "s,@COMMON_DLNAME\@,${common_dlname},g"
--- /dev/null
+using System;
+using System.Diagnostics;
+using Gtk;
+using Avahi.UI;
+
+public class EntryPoint {
+ public static void Main () {
+ Application.Init ();
+
+ ServiceDialog dialog = new ServiceDialog ("Choose SSH Server", null, Stock.Close, ResponseType.Cancel);
+ dialog.BrowseServiceTypes = new string[] { "_ssh._tcp" };
+ dialog.ResolveServiceEnabled = true;
+
+ if (dialog.Run () == (int) ResponseType.Accept) {
+ Console.WriteLine ("Connecting to {0}:{1}", dialog.Address, dialog.Port);
+
+ string user = Environment.UserName;
+
+ foreach (byte[] txtBytes in dialog.TxtData) {
+ string txt = System.Text.Encoding.UTF8.GetString (txtBytes);
+ string[] splitTxt = txt.Split(new char[] { '=' }, 2);
+
+ if (splitTxt.Length != 2)
+ continue;
+
+ if (splitTxt[0] == "u") {
+ user = splitTxt[1];
+ }
+
+ string args = String.Format ("gnome-terminal -t {0} -x ssh -p {1} -l {2} {3}",
+ dialog.HostName, dialog.Port, user, dialog.Address.ToString ());
+ Console.WriteLine ("Launching: " + args);
+ Process.Start (args);
+ }
+ }
+ }
+}
tests/Makefile
service-type-database/Makefile
avahi-sharp/Makefile
+avahi-ui-sharp/Makefile
avahi-compat-libdns_sd/Makefile
avahi-compat-howl/Makefile
avahi-compat-howl/samples/Makefile