How can I enable/disable at runtime the Ethernet driver on a Colibri T20?

I have a Colibrì T20 board and for security purposes, I need to turn on the Ethernet only when the board need to trasfer data to the host.
So I need a method that allows the turnig-on/off of the Ethernet at runtime.
When the Ethernet is turned off, the device shall not be visible on the lan.

The OS image I’m using is the Tegra_WinCE_Image_1.4 and the SDK is the toradex_ce6_sdk_2.0.

Many thanks in advance,
Fabrizio

You could either try to achieve this by using NDIS IOCTL:

One other option would be to completely unload the Network driver. As the adapter on the colibri T20 is attached on a USB port, you can disable the USB2 host:

Here some sample code for enabling / disabling the ethernet chip on T20:

#define DEVICE_NAME L"HCD1:"
int main(int argc, char *argv[])
{
    DWORD res;   
    printf("-- DISABLE device %S...\r\n", DEVICE_NAME);

    res = SetDevicePower(DEVICE_NAME, POWER_NAME, D4);
    printf("... DISABLE done, result 0x%x -- \r\n\r\n", res);
    printf("Press button to resume\r\n");
    getchar();
    SetSystemPowerState(NULL, POWER_STATE_SUSPEND, POWER_FORCE);
    printf("++ENABLE device %S\r\n", DEVICE_NAME);
    res = SetDevicePower(DEVICE_NAME, POWER_NAME, D0);
    printf("... ENABLE done++\r\n\r\n");

    return 0;
}

Many thanks samuel.
The solution that uses NDIS IOCTL works fine. I used the IOCTL_NDIS_UNBIND_ADAPTER and IOCTL_NDIS_BIND_ADAPTER to resume the connection.