• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
18 
19 
20 #pragma once
21 
22 #include "resource.h"       // main symbols
23 
24 
25 
26 #include "DLLX.h"
27 
28 #include "DNSSDService.h"
29 
30 #include <dns_sd.h>
31 
32 
33 
34 
35 
36 #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
37 
38 #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."
39 
40 #endif
41 
42 
43 
44 
45 
46 
47 
48 // CDNSSDRecord
49 
50 
51 
52 class ATL_NO_VTABLE CDNSSDRecord :
53 
54 	public CComObjectRootEx<CComSingleThreadModel>,
55 
56 	public CComCoClass<CDNSSDRecord, &CLSID_DNSSDRecord>,
57 
58 	public IDispatchImpl<IDNSSDRecord, &IID_IDNSSDRecord, &LIBID_Bonjour, /*wMajor =*/ 1, /*wMinor =*/ 0>
59 
60 {
61 
62 public:
63 
CDNSSDRecord()64 	CDNSSDRecord()
65 
66 	{
67 
68 	}
69 
70 
71 
72 DECLARE_REGISTRY_RESOURCEID(IDR_DNSSDRECORD)
73 
74 
75 
76 
77 
BEGIN_COM_MAP(CDNSSDRecord)78 BEGIN_COM_MAP(CDNSSDRecord)
79 
80 	COM_INTERFACE_ENTRY(IDNSSDRecord)
81 
82 	COM_INTERFACE_ENTRY(IDispatch)
83 
84 END_COM_MAP()
85 
86 
87 
88 
89 
90 
91 
92 	DECLARE_PROTECT_FINAL_CONSTRUCT()
93 
94 
95 
96 	HRESULT FinalConstruct()
97 
98 	{
99 
100 		return S_OK;
101 
102 	}
103 
104 
105 
FinalRelease()106 	void FinalRelease()
107 
108 	{
109 
110 	}
111 
112 
113 
114 	inline CDNSSDService*
115 
GetServiceObject()116 	GetServiceObject()
117 
118 	{
119 
120 		return m_serviceObject;
121 
122 	}
123 
124 
125 
126 	inline void
127 
SetServiceObject(CDNSSDService * serviceObject)128 	SetServiceObject( CDNSSDService * serviceObject )
129 
130 	{
131 
132 		m_serviceObject = serviceObject;
133 
134 	}
135 
136 
137 
138 	inline DNSRecordRef
139 
GetRecordRef()140 	GetRecordRef()
141 
142 	{
143 
144 		return m_rref;
145 
146 	}
147 
148 
149 
150 	inline void
151 
SetRecordRef(DNSRecordRef rref)152 	SetRecordRef( DNSRecordRef rref )
153 
154 	{
155 
156 		m_rref = rref;
157 
158 	}
159 
160 
161 
162 public:
163 
164 
165 
166 	STDMETHOD(Update)(DNSSDFlags flags, VARIANT rdata, ULONG ttl);
167 
168 	STDMETHOD(Remove)(DNSSDFlags flags);
169 
170 
171 
172 private:
173 
174 
175 
176 	CDNSSDService *	m_serviceObject;
177 
178 	DNSRecordRef	m_rref;
179 
180 };
181 
182 
183 
184 OBJECT_ENTRY_AUTO(__uuidof(DNSSDRecord), CDNSSDRecord)
185 
186