| LUFA Library 140302 |

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

## Data Structures
struct | USB_ClassInfo_RNDIS_Device_t
| RNDIS Class Device Mode Configuration and State Structure. More...

## Functions
bool | RNDIS_Device_ConfigureEndpoints (USB_ClassInfo_RNDIS_Device_t *const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1)
bool | RNDIS_Device_IsPacketReceived (USB_ClassInfo_RNDIS_Device_t *const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1)
void | RNDIS_Device_ProcessControlRequest (USB_ClassInfo_RNDIS_Device_t *const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1)
uint8_t | RNDIS_Device_ReadPacket (USB_ClassInfo_RNDIS_Device_t *const RNDISInterfaceInfo, void *Buffer, uint16_t *const PacketLength) ATTR_NON_NULL_PTR_ARG(1)
uint8_t | RNDIS_Device_SendPacket (USB_ClassInfo_RNDIS_Device_t *const RNDISInterfaceInfo, void *Buffer, const uint16_t PacketLength) ATTR_NON_NULL_PTR_ARG(1)
void | RNDIS_Device_USBTask (USB_ClassInfo_RNDIS_Device_t *const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1)

## Detailed Description

# Module Source Dependencies

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

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

# Module Description

Device Mode USB Class driver framework interface, for the RNDIS USB Class driver.

## Function Documentation

bool RNDIS_Device_ConfigureEndpoints | ( | USB_ClassInfo_RNDIS_Device_t *const | RNDISInterfaceInfo | ) |

Configures the endpoints of a given RNDIS interface, ready for use. This should be linked to the library EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the given RNDIS interface is selected.

Parameters

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

Returns
  Boolean `true` if the endpoints were successfully configured, `false` otherwise.

bool RNDIS_Device_IsPacketReceived | ( | USB_ClassInfo_RNDIS_Device_t *const | RNDISInterfaceInfo | ) |

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

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

Parameters

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

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

void RNDIS_Device_ProcessControlRequest | ( | USB_ClassInfo_RNDIS_Device_t *const | RNDISInterfaceInfo | ) |

Processes incoming control requests from the host, that are directed to the given RNDIS class interface. This should be linked to the library EVENT_USB_Device_ControlRequest() event.

Parameters

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

uint8_t RNDIS_Device_ReadPacket | ( | USB_ClassInfo_RNDIS_Device_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 device in the nominated buffer.

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

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class 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 Endpoint_Stream_RW_ErrorCodes_t enum.

uint8_t RNDIS_Device_SendPacket | ( | USB_ClassInfo_RNDIS_Device_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 Device state machine is in the DEVICE_STATE_Configured state or the call will fail.

Parameters

  [in,out] | RNDISInterfaceInfo | Pointer to a structure containing an RNDIS Class 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 Endpoint_Stream_RW_ErrorCodes_t enum.

void RNDIS_Device_USBTask | ( | USB_ClassInfo_RNDIS_Device_t *const | RNDISInterfaceInfo | ) |

General management task for a given RNDIS 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 a RNDIS Class configuration and state.