| LUFA Library 140302 |

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Enumerations | Functions
RNDIS Class Host Mode Driver
RNDIS (Networking) Class Driver

## Data Structures
struct | USB_ClassInfo_RNDIS_Host_t
| RNDIS Class Host Mode Configuration and State Structure. More...

## Enumerations
enum | RNDIS_Host_EnumerationFailure_ErrorCodes_t { RNDIS_ENUMERROR_NoError = 0, RNDIS_ENUMERROR_InvalidConfigDescriptor = 1, RNDIS_ENUMERROR_NoCompatibleInterfaceFound = 2, RNDIS_ENUMERROR_PipeConfigurationFailed = 3 }

## Functions
uint8_t | RNDIS_Host_ConfigurePipes (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo, uint16_t ConfigDescriptorSize, void *ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3)
uint8_t | RNDIS_Host_InitializeDevice (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1)
bool | RNDIS_Host_IsPacketReceived (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1)
uint8_t | RNDIS_Host_QueryRNDISProperty (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo, const uint32_t Oid, void *Buffer, const uint16_t MaxLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3)
uint8_t | RNDIS_Host_ReadPacket (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo, void *Buffer, uint16_t *const PacketLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3)
uint8_t | RNDIS_Host_SendKeepAlive (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1)
uint8_t | RNDIS_Host_SendPacket (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo, void *Buffer, const uint16_t PacketLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2)
uint8_t | RNDIS_Host_SetRNDISProperty (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo, const uint32_t Oid, void *Buffer, const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3)
static void | RNDIS_Host_USBTask (USB_ClassInfo_RNDIS_Host_t *const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE

## Detailed Description

# Module Source Dependencies

The following files must be built with any user project that uses this module:

- LUFA/Drivers/USB/Class/Host/RNDISClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS)

# Module Description

Host Mode USB Class driver framework interface, for the Microsoft RNDIS Ethernet USB Class driver.

## Enumeration Type Documentation

enum RNDIS_Host_EnumerationFailure_ErrorCodes_t

Enum for the possible error codes returned by the RNDIS_Host_ConfigurePipes() function.

Enumerator
RNDIS_ENUMERROR_NoError | Configuration Descriptor was processed successfully.
RNDIS_ENUMERROR_InvalidConfigDescriptor | The device returned an invalid Configuration Descriptor.
RNDIS_ENUMERROR_NoCompatibleInterfaceFound | A compatible RNDIS interface was not found in the device's Configuration Descriptor.
RNDIS_ENUMERROR_PipeConfigurationFailed | One or more pipes for the specified interface could not be configured correctly.

## Function Documentation

uint8_t RNDIS_Host_ConfigurePipes | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo,
|  | uint16_t | ConfigDescriptorSize,
|  | void * | ConfigDescriptorData
| ) |  |

Host interface configuration routine, to configure a given RNDIS host interface instance using the Configuration Descriptor read from an attached USB device. This function automatically updates the given RNDIS Host instance's state values and configures the pipes required to communicate with the interface if it is found within the device. This should be called once after the stack has enumerated the attached device, while the host state machine is in the Addressed state.

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.
  [in] | ConfigDescriptorSize | Length of the attached device's Configuration Descriptor.
  [in] | ConfigDescriptorData | Pointer to a buffer containing the attached device's Configuration Descriptor.

Returns
  A value from the RNDIS_Host_EnumerationFailure_ErrorCodes_t enum.

uint8_t RNDIS_Host_InitializeDevice | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo | ) |

Initializes the attached RNDIS device's RNDIS interface. This should be called after the device's pipes have been configured via the call to RNDIS_Host_ConfigurePipes().

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.

Returns
  A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_ERROR_LOGICAL_CMD_FAILED if the device returned a logical command failure.

bool RNDIS_Host_IsPacketReceived | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo | ) |

Determines if a packet is currently waiting for the host to read in and process.

Precondition
  This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the call will fail.

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.

Returns
  Boolean `true` if a packet is waiting to be read in by the host, `false` otherwise.

uint8_t RNDIS_Host_QueryRNDISProperty | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo,
|  | const uint32_t | Oid,
|  | void * | Buffer,
|  | const uint16_t | MaxLength
| ) |  |

Gets a given RNDIS property of an attached RNDIS device.

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.
  [in] | Oid | OID number of the parameter to get.
  [in] | Buffer | Pointer to where the property data is to be written to.
  [in] | MaxLength | Length in bytes of the destination buffer size.

Returns
  A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_ERROR_LOGICAL_CMD_FAILED if the device returned a logical command failure.

uint8_t RNDIS_Host_ReadPacket | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo,
|  | void * | Buffer,
|  | uint16_t *const | PacketLength
| ) |  |

Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave only the packet contents for processing by the host in the nominated buffer.

Precondition
  This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the call will fail.

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.
  [out] | Buffer | Pointer to a buffer where the packer data is to be written to.
  [out] | PacketLength | Pointer to where the length in bytes of the read packet is to be stored.

Returns
  A value from the Pipe_Stream_RW_ErrorCodes_t enum.

uint8_t RNDIS_Host_SendKeepAlive | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo | ) |

Sends a RNDIS KEEPALIVE command to the device, to ensure that it does not enter standby mode after periods of long inactivity.

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.

Returns
  A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_ERROR_LOGICAL_CMD_FAILED if the device returned a logical command failure.

uint8_t RNDIS_Host_SendPacket | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo,
|  | void * | Buffer,
|  | const uint16_t | PacketLength
| ) |  |

Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header.

Precondition
  This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the call will fail.

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.
  [in] | Buffer | Pointer to a buffer where the packer data is to be read from.
  [in] | PacketLength | Length in bytes of the packet to send.

Returns
  A value from the Pipe_Stream_RW_ErrorCodes_t enum.

uint8_t RNDIS_Host_SetRNDISProperty | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo,
|  | const uint32_t | Oid,
|  | void * | Buffer,
|  | const uint16_t | Length
| ) |  |

Sets a given RNDIS property of an attached RNDIS device.

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.
  [in] | Oid | OID number of the parameter to set.
  [in] | Buffer | Pointer to where the property data is to be sourced from.
  [in] | Length | Length in bytes of the property data to sent to the device.

Returns
  A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_ERROR_LOGICAL_CMD_FAILED if the device returned a logical command failure.

static void RNDIS_Host_USBTask | ( | USB_ClassInfo_RNDIS_Host_t *const | RNDISInterfaceInfo | ) |
| inline static

General management task for a given RNDIS host class interface, required for the correct operation of the interface. This should be called frequently in the main program loop, before the master USB management task USB_USBTask().

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class host configuration and state.