ReactOS 0.4.15-dev-8116-gf69e256
ethernetfilter.cpp
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS BDA Proxy
4 * FILE: dll/directx/msdvbnp/ethernetfilter.cpp
5 * PURPOSE: IBDA_EthernetFilter interface
6 *
7 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9#include "precomp.h"
10
12{
13public:
15
18
19 //IBDA_EthernetFilter
21 HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE * pAddressList);
22 HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList);
25
26
27 CEthernetFilter(IBDA_NetworkProvider * pNetworkProvider);
28 virtual ~CEthernetFilter();
29
30protected:
35};
36
38 IBDA_NetworkProvider * pNetworkProvider) : m_pNetworkProvider(pNetworkProvider),
39 m_ulcbAddresses(0),
40 m_pAddressList(0),
41 m_ulModeMask(0)
42{
43}
44
46{
49}
50
54 REFIID InterfaceId,
56{
58 return m_pNetworkProvider->QueryInterface(InterfaceId, Interface);
59}
60
64{
66 return m_pNetworkProvider->AddRef();
67}
68
72{
75}
76
77//-------------------------------------------------------------------
78//IBDA_EthernetFilter
79//
80
84 ULONG ulcbAddresses,
85 BYTE * pAddressList)
86{
87 if (!ulcbAddresses || !pAddressList)
88 return E_POINTER;
89
92
93 m_pAddressList = (BYTE*)CoTaskMemAlloc(ulcbAddresses);
94 if (!m_pAddressList)
95 return E_OUTOFMEMORY;
96
97 CopyMemory(m_pAddressList, pAddressList, ulcbAddresses);
98 m_ulcbAddresses = ulcbAddresses;
99 return NOERROR;
100}
101
105 ULONG *pulcbAddresses,
106 BYTE *pAddressList)
107{
108 if (!pulcbAddresses || !pAddressList)
109 return E_POINTER;
110
111 if (*pulcbAddresses < m_ulcbAddresses)
112 return E_OUTOFMEMORY;
113
115 *pulcbAddresses = m_ulcbAddresses;
116 return NOERROR;
117}
118
122 ULONG *pulcbAddresses)
123{
124 if (!pulcbAddresses)
125 return E_POINTER;
126
127 *pulcbAddresses = m_ulcbAddresses;
128 return NOERROR;
129}
130
134 ULONG ulModeMask)
135{
136 m_ulModeMask = ulModeMask;
137 return NOERROR;
138}
139
143 ULONG *pulModeMask)
144{
145 *pulModeMask = m_ulModeMask;
146 return NOERROR;
147}
148
150WINAPI
152 IBDA_NetworkProvider * pNetworkProvider,
153 REFIID riid,
154 LPVOID * ppv)
155{
156 CEthernetFilter * filter = new CEthernetFilter(pNetworkProvider);
157
158 if (!filter)
159 return E_OUTOFMEMORY;
160
161 if (FAILED(filter->QueryInterface(riid, ppv)))
162 {
163 /* not supported */
164 delete filter;
165 return E_NOINTERFACE;
166 }
167
168 return NOERROR;
169}
#define STDMETHODIMP
Definition: basetyps.h:43
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
STDMETHODIMP_(ULONG) Release()
HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE *pAddressList)
STDMETHODIMP_(ULONG) AddRef()
HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList)
CEthernetFilter(IBDA_NetworkProvider *pNetworkProvider)
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
HRESULT STDMETHODCALLTYPE GetMulticastListSize(ULONG *pulcbAddresses)
virtual ~CEthernetFilter()
IBDA_NetworkProvider * m_pNetworkProvider
HRESULT STDMETHODCALLTYPE PutMulticastMode(ULONG ulModeMask)
HRESULT STDMETHODCALLTYPE GetMulticastMode(ULONG *pulModeMask)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define assert(x)
Definition: debug.h:53
HRESULT WINAPI CEthernetFilter_fnConstructor(IBDA_NetworkProvider *pNetworkProvider, REFIID riid, LPVOID *ppv)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
ULONG AddRef()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
#define FAILED(hr)
Definition: intsafe.h:51
#define REFIID
Definition: guiddef.h:118
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
#define CopyMemory
Definition: winbase.h:1710
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define NOERROR
Definition: winerror.h:2354
#define E_POINTER
Definition: winerror.h:2365
unsigned char BYTE
Definition: xxhash.c:193