Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PEthSocket::GetFilter ( unsigned &  mask,
WORD &  type 
)

Get the current filtering criteria for receiving packets.

A bit-wise OR of the FilterMask values will filter packets so that they do not appear in the Read() function at all.

The type is be the specific frame type to accept. A value of TypeAll may be used to match all frame types.

Returns:
A bit mask is returned, a value of 0 indicates an error.
Parameters:
mask  Bits for filtering on address
type  Code for filtering on type.

Definition at line 1647 of file ethsock.cxx.

References FilterDirected, PChannel::IsOpen(), PChannel::Miscellaneous, PChannel::NotOpen, and PChannel::SetErrorValues().

{
  if (!IsOpen())
    return SetErrorValues(NotOpen, EBADF);

  DWORD filter = 0;
  if (!driver->QueryOid(OID_GEN_CURRENT_PACKET_FILTER, filter))
    return SetErrorValues(Miscellaneous, driver->GetLastError()|PWIN32ErrorFlag);

  if (filter == 0)
    return PEthSocket::FilterDirected;

  mask = 0;
  for (PINDEX i = 0; i < PARRAYSIZE(FilterMasks); i++) {
    if ((filter&FilterMasks[i].ndis) != 0)
      mask |= FilterMasks[i].pwlib;
  }

  type = (WORD)filterType;
  return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index