4 This file is part of avahi.
6 avahi is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 avahi is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
14 Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with avahi; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 using System.Runtime.InteropServices;
28 public enum ErrorCode {
32 InvalidHostName = - 3,
33 InvalidDomainName = -4,
39 InvalidServiceName = -10,
40 InvalidServiceType = -11,
50 InvalidOperation = -21,
56 InvalidInterface = -27,
57 InvalidProtocol = -28,
61 VersionMismatch = -32,
62 InvalidServiceSubtype = -33,
64 InvalidDnsError = -35,
76 InvalidDnsClass = -47,
82 public delegate void ErrorCodeHandler (object o, ErrorCodeArgs args);
84 public class ErrorCodeArgs : EventArgs
86 private ErrorCode code;
88 public ErrorCode ErrorCode
93 public ErrorCodeArgs (ErrorCode code)
99 public class ClientException : ApplicationException
101 private ErrorCode code;
103 [DllImport ("avahi-common")]
104 private static extern IntPtr avahi_strerror (ErrorCode code);
106 public ErrorCode ErrorCode
111 internal ClientException (int code) : this ((ErrorCode) code) {
114 internal ClientException (ErrorCode code) : base (GetErrorString (code))
119 private static string GetErrorString (ErrorCode code)
121 IntPtr str = avahi_strerror (code);
122 return Utility.PtrToString (str);