ReactOS  0.4.15-dev-1638-gc0caa5c
ipv6.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/ipv6.cpp
5  * PURPOSE: IBDA_IPV6Filter interface
6  *
7  * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8  */
9 #include "precomp.h"
10 
12 {
13 public:
17 
18  //IBDA_IPV6Filter
20  HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE * pAddressList);
21  HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList);
24 
25  CIPV6Filter(IBDA_NetworkProvider * pNetworkProvider);
26  virtual ~CIPV6Filter();
27 
28 protected:
33 };
34 
36  IBDA_NetworkProvider * pNetworkProvider) : m_pNetworkProvider(pNetworkProvider),
37  m_ulcbAddresses(0),
38  m_pAddressList(0),
39  m_ulModeMask(0)
40 {
41 }
42 
44 {
45  if (m_pAddressList)
47 }
48 
49 HRESULT
52  REFIID InterfaceId,
54 {
56  return m_pNetworkProvider->QueryInterface(InterfaceId, Interface);
57 }
58 
59 ULONG
62 {
64  return m_pNetworkProvider->AddRef();
65 }
66 
67 ULONG
70 {
72  return m_pNetworkProvider->Release();
73 }
74 
75 //-------------------------------------------------------------------
76 //IBDA_IPV6Filter
77 //
78 
79 HRESULT
82  ULONG *pulcbAddresses)
83 {
84  if (!pulcbAddresses)
85  return E_POINTER;
86 
87  *pulcbAddresses = 0;
88  return NOERROR;
89 }
90 
91 HRESULT
94  ULONG *pulcbAddresses,
95  BYTE *pAddressList)
96 {
97  if (!pulcbAddresses || !pAddressList)
98  return E_POINTER;
99 
100  if (*pulcbAddresses < m_ulcbAddresses)
101  return E_OUTOFMEMORY;
102 
103  CopyMemory(pAddressList, m_pAddressList, m_ulcbAddresses);
104  *pulcbAddresses = m_ulcbAddresses;
105  return NOERROR;
106 }
107 
108 HRESULT
111  ULONG ulcbAddresses,
112  BYTE * pAddressList)
113 {
114  if (!ulcbAddresses || !pAddressList)
115  return E_POINTER;
116 
117  if (m_pAddressList)
119 
120  m_pAddressList = (BYTE*)CoTaskMemAlloc(ulcbAddresses);
121  if (!m_pAddressList)
122  return E_OUTOFMEMORY;
123 
124  CopyMemory(m_pAddressList, pAddressList, ulcbAddresses);
125  m_ulcbAddresses = ulcbAddresses;
126  return NOERROR;
127 }
128 
129 HRESULT
132  ULONG ulModeMask)
133 {
134  m_ulModeMask = ulModeMask;
135  return NOERROR;
136 }
137 
138 HRESULT
141  ULONG *pulModeMask)
142 {
143  *pulModeMask = m_ulModeMask;
144  return NOERROR;
145 }
146 
147 HRESULT
148 WINAPI
150  IBDA_NetworkProvider * pNetworkProvider,
151  REFIID riid,
152  LPVOID * ppv)
153 {
154  CIPV6Filter * filter = new CIPV6Filter(pNetworkProvider);
155 
156  if (!filter)
157  return E_OUTOFMEMORY;
158 
159  if (FAILED(filter->QueryInterface(riid, ppv)))
160  {
161  /* not supported */
162  delete filter;
163  return E_NOINTERFACE;
164  }
165 
166  return NOERROR;
167 }
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: ipv6.cpp:51
#define REFIID
Definition: guiddef.h:118
STDMETHODIMP_(ULONG) AddRef()
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define NOERROR
Definition: winerror.h:2354
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT STDMETHODCALLTYPE GetMulticastMode(ULONG *pulModeMask)
Definition: ipv6.cpp:140
#define assert(x)
Definition: debug.h:53
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define STDMETHODIMP
Definition: basetyps.h:43
ULONG Release()
HRESULT STDMETHODCALLTYPE PutMulticastMode(ULONG ulModeMask)
Definition: ipv6.cpp:131
HRESULT WINAPI CIPV6Filter_fnConstructor(IBDA_NetworkProvider *pNetworkProvider, REFIID riid, LPVOID *ppv)
Definition: ipv6.cpp:149
HRESULT STDMETHODCALLTYPE PutMulticastList(ULONG ulcbAddresses, BYTE *pAddressList)
Definition: ipv6.cpp:110
HRESULT STDMETHODCALLTYPE GetMulticastList(ULONG *pulcbAddresses, BYTE *pAddressList)
Definition: ipv6.cpp:93
LONG HRESULT
Definition: typedefs.h:79
ULONG m_ulcbAddresses
Definition: ipv6.cpp:30
#define WINAPI
Definition: msvc.h:6
#define CopyMemory
Definition: winbase.h:1646
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
ULONG AddRef()
IBDA_NetworkProvider * m_pNetworkProvider
Definition: ipv6.cpp:29
BYTE * m_pAddressList
Definition: ipv6.cpp:31
unsigned char BYTE
Definition: xxhash.c:193
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
CIPV6Filter(IBDA_NetworkProvider *pNetworkProvider)
Definition: ipv6.cpp:35
ULONG m_ulModeMask
Definition: ipv6.cpp:32
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
virtual ~CIPV6Filter()
Definition: ipv6.cpp:43
unsigned int ULONG
Definition: retypes.h:1
HRESULT STDMETHODCALLTYPE GetMulticastListSize(ULONG *pulcbAddresses)
Definition: ipv6.cpp:81
#define E_POINTER
Definition: winerror.h:2365
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005