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

BOOL PEthSocket::SetFilter ( unsigned  mask,
WORD  type = TypeAll 

Set 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.

A value of zero for the filter mask is useless and will assert.

TRUE if the address is returned, FALSE on error.
mask  Bits for filtering on address
type  Code for filtering on type.

Definition at line 1670 of file ethsock.cxx.

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

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

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

  if (!driver->SetOid(OID_GEN_CURRENT_PACKET_FILTER, bits))
    return SetErrorValues(Miscellaneous, driver->GetLastError()|PWIN32ErrorFlag);

  filterType = type;
  return TRUE;

Generated by  Doxygen 1.6.0   Back to index