Media Sense Implementation (Windows Embedded CE 6.0)

1/6/2010

The NDIS, TCP/IP stack and NIC miniport work hand in hand to implement Media Sense. The NIC is required to use media presence detection along with an interface for querying the current media state. A majority of modern NICs implement Media Sense with the exception of 10Base2 cards due to the lack of line voltage on coaxial cable. The miniport works together with the NIC hardware to implement several callouts related to Media Sense:

  • A query through OID_GEN_MEDIA_CONNECT_STATUS. NDIS can call upon this object identifier to obtain the present media state.
  • The miniport notifies NDIS whenever the media state has changed from connected to disconnected or vice versa through the NdisMediaStateConnected and NdisMediaStateDisconnected flags for use with the NdisMIndicateStatus API.

The miniport supports a query as well as a notification of the media state by NDIS. On some older NICs the notification of the media state may not be supported, in which case it is simulated by NDIS through periodic queries. If the query is also not supported then the operation will always return the non-zero value of True.

TCP/IP is the only protocol in Windows Embedded CE implementing Media Sense event processing. It uses all NDIS functions to configure and query the current media state and be notified of Media Sense events. The default-damping interval is 20 seconds for disconnect events and 10 seconds for connect events. Upon receiving a notification, TCP/IP starts/restarts the interfaces and adds/removes the corresponding IP addresses and route entries. TCP/IP starts up/tears down the network connectivity at the transport level in response to the Media Connect/Disconnect events and notifies Dynamic Host Configuration Protocol (DHCP). The DHCP client has been modified to send both requests and renewals on a Media Sense connect event through a notification from TCP/IP. The TCP/IP protocol then passes the notification on to DHCP. TCP/IP maintains a connection state and this state may at time be different than that of NDIS due to the damping interval. It is important to note that the Winsock API blocking routines such as recv on blocking socket return on a Media Sense disconnect event.

It is possible to disable Media Sense at the TCP/IP level through a DisableDHCPMediaSense registry value.

Key Value type Value range Description Default

Comm\Tcpip\Parms

REG_DWORD

0 to 1

0 - Enables Media Sense on the DHCP client

1 - Disables Media Sense on the DHCP client.

0

DisableDHCPMediaSense directs the DHCP client to ignore Media Sense events from the interface. Media Sense provides a mechanism for network adapters to notify the protocol stack when a network media is connected or disconnected. The protocol stack can then update the network configuration parameters. Media Sense is extremely useful on a portable device that is commonly disconnected from one network and then connected to a different one. Media Sense events direct the DHCP client to take an action such as attempting to obtain a lease when media is connected or invalidating the interface and routes when media is disconnected.

TCP/IP provides an interface for applications allowing them to query the connection state at TCP/IP and request a notification on change of state.

The damping intervals for TCP/IP can be adjusted through two registry values.

ConnectDampingInterval specifies the amount of time, in seconds, by which TCP/IP will delay any action in response to a Media Sense connect event.

Key Value type Default

Comm\<Adapter Name>\Parms\Tcpip

REG_DWORD

10

DisconnectDampInterval specifies the amount of time, in seconds, by which TCP/IP will delay any action in response to a Media Sense disconnect event.

Key Value type Default

Comm\<Adapter Name>\Parms\Tcpip

REG_DWORD

15

Note

The HKEY_LOCAL_MACHINE\Comm</STRONG><Adapter Name>\Parms\Tcpip registry key default damping intervals are accurate for the default delay time or longer. However, settings shorter than the default value may produce damping intervals that are unreliable. It is recommended that you use a damping interval that is equal to or greater than the default value.

See Also

Reference

OID_GEN_MEDIA_CONNECT_STATUS
NdisMIndicateStatus

Concepts

NDIS Support for Media Sense