2 This file is part of avahi.
4 avahi is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
9 avahi is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
12 Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with avahi; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 using System.Runtime.InteropServices;
26 public enum ErrorCode {
30 InvalidHostName = - 3,
31 InvalidDomainName = -4,
37 InvalidServiceName = -10,
38 InvalidServiceType = -11,
48 InvalidOperation = -21,
54 InvalidInterface = -27,
55 InvalidProtocol = -28,
59 VersionMismatch = -32,
60 InvalidServiceSubtype = -33,
62 InvalidDnsError = -35,
74 InvalidDnsClass = -47,
80 public delegate void ErrorCodeHandler (object o, ErrorCodeArgs args);
82 public class ErrorCodeArgs : EventArgs
84 private ErrorCode code;
86 public ErrorCode ErrorCode
91 public ErrorCodeArgs (ErrorCode code)
97 public class ClientException : ApplicationException
99 private ErrorCode code;
101 [DllImport ("avahi-common")]
102 private static extern IntPtr avahi_strerror (ErrorCode code);
104 public ErrorCode ErrorCode
109 internal ClientException (int code) : this ((ErrorCode) code) {
112 internal ClientException (ErrorCode code) : base (GetErrorString (code))
117 private static string GetErrorString (ErrorCode code)
119 IntPtr str = avahi_strerror (code);
120 return Utility.PtrToString (str);