ReactOS 0.4.15-dev-7704-gc07eb9f
ipv4.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/ipv4.cpp
5 * PURPOSE: IBDA_IPV4Filter interface
6 *
7 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9#include "precomp.h"
10
12{
13public:
17
18 //IBDA_IPV4Filter
20 HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE * pAddressList);
21 HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList);
24
25
26 CIPV4Filter(IBDA_NetworkProvider * pNetworkProvider);
27 virtual ~CIPV4Filter();
28
29protected:
34};
35
37 IBDA_NetworkProvider * pNetworkProvider) : m_pNetworkProvider(pNetworkProvider),
38 m_ulcbAddresses(0),
39 m_pAddressList(0),
40 m_ulModeMask(0)
41{
42}
43
45{
48}
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_IPV4Filter
79//
80
81
85 ULONG *pulcbAddresses)
86{
87 if (!pulcbAddresses)
88 return E_POINTER;
89
90 *pulcbAddresses = 0;
91 return NOERROR;
92}
93
97 ULONG ulcbAddresses,
98 BYTE * pAddressList)
99{
100 if (!ulcbAddresses || !pAddressList)
101 return E_POINTER;
102
103 if (m_pAddressList)
105
106 m_pAddressList = (BYTE*)CoTaskMemAlloc(ulcbAddresses);
107 if (!m_pAddressList)
108 return E_OUTOFMEMORY;
109
110 CopyMemory(m_pAddressList, pAddressList, ulcbAddresses);
111 m_ulcbAddresses = ulcbAddresses;
112 return NOERROR;
113}
114
118 ULONG *pulcbAddresses,
119 BYTE *pAddressList)
120{
121 if (!pulcbAddresses || !pAddressList)
122 return E_POINTER;
123
124 if (*pulcbAddresses < m_ulcbAddresses)
125 return E_OUTOFMEMORY;
126
128 *pulcbAddresses = m_ulcbAddresses;
129 return NOERROR;
130}
131
135 ULONG ulModeMask)
136{
137 m_ulModeMask = ulModeMask;
138 return NOERROR;
139}
140
144 ULONG *pulModeMask)
145{
146 *pulModeMask = m_ulModeMask;
147 return NOERROR;
148}
149
151WINAPI
153 IBDA_NetworkProvider * pNetworkProvider,
154 REFIID riid,
155 LPVOID * ppv)
156{
157 CIPV4Filter * filter = new CIPV4Filter(pNetworkProvider);
158
159 if (!filter)
160 return E_OUTOFMEMORY;
161
162 if (FAILED(filter->QueryInterface(riid, ppv)))
163 {
164 /* not supported */
165 delete filter;
166 return E_NOINTERFACE;
167 }
168
169 return NOERROR;
170}
#define STDMETHODIMP
Definition: basetyps.h:43
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: ipv4.cpp:53
HRESULT STDMETHODCALLTYPE PutMulticastMode(ULONG ulModeMask)
Definition: ipv4.cpp:134
HRESULT STDMETHODCALLTYPE GetMulticastMode(ULONG *pulModeMask)
Definition: ipv4.cpp:143
ULONG m_ulModeMask
Definition: ipv4.cpp:33
STDMETHODIMP_(ULONG) Release()
HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList)
Definition: ipv4.cpp:117
HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE *pAddressList)
Definition: ipv4.cpp:96
IBDA_NetworkProvider * m_pNetworkProvider
Definition: ipv4.cpp:30
HRESULT STDMETHODCALLTYPE GetMulticastListSize(ULONG *pulcbAddresses)
Definition: ipv4.cpp:84
ULONG m_ulcbAddresses
Definition: ipv4.cpp:31
virtual ~CIPV4Filter()
Definition: ipv4.cpp:44
BYTE * m_pAddressList
Definition: ipv4.cpp:32
STDMETHODIMP_(ULONG) AddRef()
CIPV4Filter(IBDA_NetworkProvider *pNetworkProvider)
Definition: ipv4.cpp:36
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define assert(x)
Definition: debug.h:53
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
HRESULT WINAPI CIPV4Filter_fnConstructor(IBDA_NetworkProvider *pNetworkProvider, REFIID riid, LPVOID *ppv)
Definition: ipv4.cpp:152
#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