Mono.Zeroconf – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | // |
2 | // Native.cs |
||
3 | // |
||
4 | // Authors: |
||
5 | // Aaron Bockover <abockover@novell.com> |
||
6 | // |
||
7 | // Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) |
||
8 | // |
||
9 | // Permission is hereby granted, free of charge, to any person obtaining |
||
10 | // a copy of this software and associated documentation files (the |
||
11 | // "Software"), to deal in the Software without restriction, including |
||
12 | // without limitation the rights to use, copy, modify, merge, publish, |
||
13 | // distribute, sublicense, and/or sell copies of the Software, and to |
||
14 | // permit persons to whom the Software is furnished to do so, subject to |
||
15 | // the following conditions: |
||
16 | // |
||
17 | // The above copyright notice and this permission notice shall be |
||
18 | // included in all copies or substantial portions of the Software. |
||
19 | // |
||
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||
22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
||
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
||
24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
||
25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
||
26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
27 | // |
||
28 | |||
29 | using System; |
||
30 | using System.Runtime.InteropServices; |
||
31 | |||
32 | namespace Mono.Zeroconf.Providers.Bonjour |
||
33 | { |
||
34 | public static class Native |
||
35 | { |
||
36 | // ServiceRef |
||
37 | |||
38 | [DllImport("dnssd.dll")] |
||
39 | public static extern void DNSServiceRefDeallocate(IntPtr sdRef); |
||
40 | |||
41 | [DllImport("dnssd.dll")] |
||
42 | public static extern ServiceError DNSServiceProcessResult(IntPtr sdRef); |
||
43 | |||
44 | [DllImport("dnssd.dll")] |
||
45 | public static extern int DNSServiceRefSockFD(IntPtr sdRef); |
||
46 | |||
47 | [DllImport("dnssd.dll")] |
||
48 | public static extern ServiceError DNSServiceCreateConnection(out ServiceRef sdRef); |
||
49 | |||
50 | // DNSServiceBrowse |
||
51 | |||
52 | public delegate void DNSServiceBrowseReply(ServiceRef sdRef, ServiceFlags flags, uint interfaceIndex, |
||
53 | ServiceError errorCode, string serviceName, string regtype, string replyDomain, |
||
54 | IntPtr context); |
||
55 | |||
56 | [DllImport("dnssd.dll")] |
||
57 | public static extern ServiceError DNSServiceBrowse(out ServiceRef sdRef, ServiceFlags flags, |
||
58 | uint interfaceIndex, string regtype, string domain, DNSServiceBrowseReply callBack, |
||
59 | IntPtr context); |
||
60 | |||
61 | // DNSServiceResolve |
||
62 | |||
63 | public delegate void DNSServiceResolveReply(ServiceRef sdRef, ServiceFlags flags, uint interfaceIndex, |
||
64 | ServiceError errorCode, string fullname, string hosttarget, ushort port, ushort txtLen, |
||
65 | IntPtr txtRecord, IntPtr context); |
||
66 | |||
67 | [DllImport("dnssd.dll")] |
||
68 | public static extern ServiceError DNSServiceResolve(out ServiceRef sdRef, ServiceFlags flags, |
||
69 | uint interfaceIndex, string name, string regtype, string domain, DNSServiceResolveReply callBack, |
||
70 | IntPtr context); |
||
71 | |||
72 | // DNSServiceRegister |
||
73 | |||
74 | public delegate void DNSServiceRegisterReply(ServiceRef sdRef, ServiceFlags flags, ServiceError errorCode, |
||
75 | string name, string regtype, string domain, IntPtr context); |
||
76 | |||
77 | [DllImport("dnssd.dll")] |
||
78 | public static extern ServiceError DNSServiceRegister(out ServiceRef sdRef, ServiceFlags flags, |
||
79 | uint interfaceIndex, string name, string regtype, string domain, string host, ushort port, |
||
80 | ushort txtLen, byte [] txtRecord, DNSServiceRegisterReply callBack, IntPtr context); |
||
81 | |||
82 | // DNSServiceQueryRecord |
||
83 | |||
84 | public delegate void DNSServiceQueryRecordReply(ServiceRef sdRef, ServiceFlags flags, uint interfaceIndex, |
||
85 | ServiceError errorCode, string fullname, ServiceType rrtype, ServiceClass rrclass, ushort rdlen, |
||
86 | IntPtr rdata, uint ttl, IntPtr context); |
||
87 | |||
88 | [DllImport("dnssd.dll")] |
||
89 | public static extern ServiceError DNSServiceQueryRecord(out ServiceRef sdRef, ServiceFlags flags, |
||
90 | uint interfaceIndex, string fullname, ServiceType rrtype, ServiceClass rrclass, |
||
91 | DNSServiceQueryRecordReply callBack, IntPtr context); |
||
92 | |||
93 | // TXT Record Handling |
||
94 | |||
95 | [DllImport("dnssd.dll")] |
||
96 | public static extern void TXTRecordCreate( IntPtr txtRecord, ushort bufferLen, IntPtr buffer); |
||
97 | |||
98 | [DllImport("dnssd.dll")] |
||
99 | public static extern void TXTRecordDeallocate(IntPtr txtRecord); |
||
100 | |||
101 | [DllImport("dnssd.dll")] |
||
102 | public static extern ServiceError TXTRecordGetItemAtIndex(ushort txtLen, IntPtr txtRecord, |
||
103 | ushort index, ushort keyBufLen, byte [] key, out byte valueLen, out IntPtr value); |
||
104 | |||
105 | [DllImport("dnssd.dll")] |
||
106 | public static extern ServiceError TXTRecordSetValue(IntPtr txtRecord, byte [] key, |
||
107 | sbyte valueSize, byte [] value); |
||
108 | |||
109 | [DllImport("dnssd.dll")] |
||
110 | public static extern ServiceError TXTRecordRemoveValue(IntPtr txtRecord, byte [] key); |
||
111 | |||
112 | [DllImport("dnssd.dll")] |
||
113 | public static extern ushort TXTRecordGetLength(IntPtr txtRecord); |
||
114 | |||
115 | [DllImport("dnssd.dll")] |
||
116 | public static extern IntPtr TXTRecordGetBytesPtr(IntPtr txtRecord); |
||
117 | |||
118 | [DllImport("dnssd.dll")] |
||
119 | public static extern ushort TXTRecordGetCount(ushort txtLen, IntPtr txtRecord); |
||
120 | } |
||
121 | } |