]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/DLLX/DNSSDRecord.h
mDNSResponder-214.3.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / DLLX / DNSSDRecord.h
1 /* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2009 Apple Computer, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16
17 Change History (most recent first):
18
19 $Log: DNSSDRecord.h,v $
20 Revision 1.1 2009/05/26 04:43:54 herscher
21 <rdar://problem/3948252> COM component that can be used with any .NET language and VB.
22
23
24 */
25
26 #pragma once
27 #include "resource.h" // main symbols
28
29 #include "DLLX.h"
30 #include "DNSSDService.h"
31 #include <dns_sd.h>
32
33
34 #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
35 #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
36 #endif
37
38
39
40 // CDNSSDRecord
41
42 class ATL_NO_VTABLE CDNSSDRecord :
43 public CComObjectRootEx<CComSingleThreadModel>,
44 public CComCoClass<CDNSSDRecord, &CLSID_DNSSDRecord>,
45 public IDispatchImpl<IDNSSDRecord, &IID_IDNSSDRecord, &LIBID_Bonjour, /*wMajor =*/ 1, /*wMinor =*/ 0>
46 {
47 public:
48 CDNSSDRecord()
49 {
50 }
51
52 DECLARE_REGISTRY_RESOURCEID(IDR_DNSSDRECORD)
53
54
55 BEGIN_COM_MAP(CDNSSDRecord)
56 COM_INTERFACE_ENTRY(IDNSSDRecord)
57 COM_INTERFACE_ENTRY(IDispatch)
58 END_COM_MAP()
59
60
61
62 DECLARE_PROTECT_FINAL_CONSTRUCT()
63
64 HRESULT FinalConstruct()
65 {
66 return S_OK;
67 }
68
69 void FinalRelease()
70 {
71 }
72
73 inline CDNSSDService*
74 GetServiceObject()
75 {
76 return m_serviceObject;
77 }
78
79 inline void
80 SetServiceObject( CDNSSDService * serviceObject )
81 {
82 m_serviceObject = serviceObject;
83 }
84
85 inline DNSRecordRef
86 GetRecordRef()
87 {
88 return m_rref;
89 }
90
91 inline void
92 SetRecordRef( DNSRecordRef rref )
93 {
94 m_rref = rref;
95 }
96
97 public:
98
99 STDMETHOD(Update)(DNSSDFlags flags, VARIANT rdata, ULONG ttl);
100 STDMETHOD(Remove)(DNSSDFlags flags);
101
102 private:
103
104 CDNSSDService * m_serviceObject;
105 DNSRecordRef m_rref;
106 };
107
108 OBJECT_ENTRY_AUTO(__uuidof(DNSSDRecord), CDNSSDRecord)