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

PEthSocket::MediumTypes PEthSocket::GetMedium (  ) 

Return the type of the interface.

Returns:
Type enum for the interface, or NumMediumTypes if interface not open.

Definition at line 1689 of file ethsock.cxx.

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

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

  DWORD medium = 0xffffffff;
  if (!driver->QueryOid(OID_GEN_MEDIA_SUPPORTED, medium) || medium == 0xffffffff) {
    SetErrorValues(Miscellaneous, driver->GetLastError()|PWIN32ErrorFlag);
    return NumMediumTypes;
  }

  static const DWORD MediumValues[NumMediumTypes] = {
    0xffffffff, NdisMedium802_3, NdisMediumWan, 0xffffffff
  };

  for (int type = Medium802_3; type < NumMediumTypes; type++) {
    if (MediumValues[type] == medium)
      return (MediumTypes)type;
  }

  return MediumUnknown;
}


Generated by  Doxygen 1.6.0   Back to index