2017-11-24 22:57:22 +08:00
|
|
|
/*
|
2023-04-18 10:26:23 +08:00
|
|
|
* Copyright (c) 2006-2023, RT-Thread Development Team
|
2017-11-24 22:57:22 +08:00
|
|
|
*
|
2018-10-14 19:37:18 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2017-11-24 22:57:22 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2012-12-24 heyuanjie87 first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __RNDIS_H__
|
|
|
|
#define __RNDIS_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
2021-03-08 18:19:04 +08:00
|
|
|
#define USB_ETH_MTU 1500+14
|
2017-11-24 22:57:22 +08:00
|
|
|
#define RNDIS_MESSAGE_BUFFER_SIZE 128
|
|
|
|
|
|
|
|
#define RESPONSE_AVAILABLE 0x00000001
|
|
|
|
|
|
|
|
/* Remote NDIS version numbers */
|
2021-03-08 18:19:04 +08:00
|
|
|
#define RNDIS_MAJOR_VERSION 1
|
2017-11-24 22:57:22 +08:00
|
|
|
#define RNDIS_MINOR_VERSION 0
|
|
|
|
|
|
|
|
/* common status values */
|
2021-03-08 18:19:04 +08:00
|
|
|
#define RNDIS_STATUS_SUCCESS 0X00000000
|
|
|
|
#define RNDIS_STATUS_FAILURE 0XC0000001
|
|
|
|
#define RNDIS_STATUS_INVALID_DATA 0XC0010015
|
|
|
|
#define RNDIS_STATUS_NOT_SUPPORTED 0XC00000BB
|
|
|
|
#define RNDIS_STATUS_MEDIA_CONNECT 0X4001000B
|
|
|
|
#define RNDIS_STATUS_MEDIA_DISCONNECT 0X4001000C
|
2017-11-24 22:57:22 +08:00
|
|
|
|
|
|
|
/* Remote NDIS message types */
|
2021-03-08 18:19:04 +08:00
|
|
|
#define REMOTE_NDIS_PACKET_MSG 0x00000001
|
|
|
|
#define REMOTE_NDIS_INITIALIZE_MSG 0X00000002
|
|
|
|
#define REMOTE_NDIS_HALT_MSG 0X00000003
|
|
|
|
#define REMOTE_NDIS_QUERY_MSG 0X00000004
|
|
|
|
#define REMOTE_NDIS_SET_MSG 0X00000005
|
|
|
|
#define REMOTE_NDIS_RESET_MSG 0X00000006
|
2017-11-24 22:57:22 +08:00
|
|
|
#define REMOTE_NDIS_INDICATE_STATUS_MSG 0X00000007
|
2021-03-08 18:19:04 +08:00
|
|
|
#define REMOTE_NDIS_KEEPALIVE_MSG 0X00000008
|
|
|
|
#define REMOTE_NDIS_INITIALIZE_CMPLT 0X80000002
|
|
|
|
#define REMOTE_NDIS_QUERY_CMPLT 0X80000004
|
|
|
|
#define REMOTE_NDIS_SET_CMPLT 0X80000005
|
|
|
|
#define REMOTE_NDIS_RESET_CMPLT 0X80000006
|
|
|
|
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0X80000008
|
2017-11-24 22:57:22 +08:00
|
|
|
|
|
|
|
/* device flags */
|
2021-03-08 18:19:04 +08:00
|
|
|
#define RNDIS_DF_CONNECTIONLESS 0x00000001
|
|
|
|
#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
|
2017-11-24 22:57:22 +08:00
|
|
|
/* mediums */
|
2021-03-08 18:19:04 +08:00
|
|
|
#define RNDIS_MEDIUM_802_3 0x00000000
|
2017-11-24 22:57:22 +08:00
|
|
|
|
|
|
|
struct ucls_rndis
|
|
|
|
{
|
|
|
|
uep_t notify;
|
|
|
|
rt_uint32_t filter;
|
|
|
|
rt_bool_t header;
|
|
|
|
rt_uint8_t rndis_state;
|
|
|
|
rt_uint8_t media_state;
|
|
|
|
rt_uint8_t ethaddr[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Remote NDIS generic message type */
|
|
|
|
struct rndis_gen_msg
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_gen_msg* rndis_gen_msg_t;
|
|
|
|
|
|
|
|
struct rndis_packet_msg
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t DataOffset;
|
|
|
|
rt_uint32_t DataLength;
|
|
|
|
rt_uint32_t OOBDataOffset;
|
|
|
|
rt_uint32_t OOBDataLength;
|
|
|
|
rt_uint32_t NumOOBDataElements;
|
|
|
|
rt_uint32_t PerPacketInfoOffset;
|
|
|
|
rt_uint32_t PerPacketInfoLength;
|
|
|
|
rt_uint32_t VcHandle;
|
|
|
|
rt_uint32_t Reserved;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_packet_msg* rndis_packet_msg_t;
|
|
|
|
|
|
|
|
/* Remote NDIS Initialize Message */
|
|
|
|
struct rndis_init_msg
|
|
|
|
{
|
|
|
|
rt_uint32_t MessageType;
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestId;
|
|
|
|
rt_uint32_t MajorVersion;
|
|
|
|
rt_uint32_t MinorVersion;
|
|
|
|
rt_uint32_t MaxTransferSize;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_init_msg* rndis_init_msg_t;
|
|
|
|
|
|
|
|
/* Response */
|
|
|
|
struct rndis_init_cmplt
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestId;
|
|
|
|
rt_uint32_t Status;
|
|
|
|
rt_uint32_t MajorVersion;
|
|
|
|
rt_uint32_t MinorVersion;
|
|
|
|
rt_uint32_t DeviceFlags;
|
|
|
|
rt_uint32_t Medium;
|
2017-11-24 22:57:22 +08:00
|
|
|
rt_uint32_t MaxPacketsPerTransfer;
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MaxTransferSize;
|
2017-11-24 22:57:22 +08:00
|
|
|
rt_uint32_t PacketAlignmentFactor;
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t AfListOffset;
|
|
|
|
rt_uint32_t AfListSize;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_init_cmplt* rndis_init_cmplt_t;
|
|
|
|
|
|
|
|
/* Remote NDIS Halt Message */
|
|
|
|
struct rndis_halt_msg
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestId;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Remote NDIS Query Message */
|
|
|
|
struct rndis_query_msg
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestId;
|
|
|
|
rt_uint32_t Oid;
|
|
|
|
rt_uint32_t InformationBufferLength;
|
|
|
|
rt_uint32_t InformationBufferOffset;
|
|
|
|
rt_uint32_t DeviceVcHandle;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_query_msg* rndis_query_msg_t;
|
|
|
|
|
|
|
|
/* Response */
|
|
|
|
struct rndis_query_cmplt
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestId;
|
|
|
|
rt_uint32_t Status;
|
|
|
|
rt_uint32_t InformationBufferLength;
|
|
|
|
rt_uint32_t InformationBufferOffset;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_query_cmplt* rndis_query_cmplt_t;
|
|
|
|
|
|
|
|
/* Remote NDIS Set Message */
|
|
|
|
struct rndis_set_msg
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestId;
|
|
|
|
rt_uint32_t Oid;
|
|
|
|
rt_uint32_t InformationBufferLength;
|
|
|
|
rt_uint32_t InformationBufferOffset;
|
|
|
|
rt_uint32_t DeviceVcHandle;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_set_msg* rndis_set_msg_t;
|
|
|
|
|
|
|
|
/* Response */
|
|
|
|
struct rndis_set_cmplt
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestId;
|
|
|
|
rt_uint32_t Status;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_set_cmplt* rndis_set_cmplt_t;
|
|
|
|
|
|
|
|
/* Remote NDIS Soft Reset Message */
|
|
|
|
struct rndis_reset_msg
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t Reserved;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
|
2019-06-10 14:10:08 +08:00
|
|
|
/* Remote NDIS Soft Reset Response */
|
|
|
|
struct rndis_reset_cmplt
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t Status;
|
|
|
|
rt_uint32_t AddressingReset;
|
2019-06-10 14:10:08 +08:00
|
|
|
};
|
|
|
|
|
2017-11-24 22:57:22 +08:00
|
|
|
/* Remote NDIS Indicate Status Message */
|
|
|
|
struct rndis_indicate_status_msg
|
|
|
|
{
|
|
|
|
rt_uint32_t MessageType;
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t Status;
|
|
|
|
rt_uint32_t StatusBufferLength;
|
|
|
|
rt_uint32_t StatusBufferOffset;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_indicate_status_msg* rndis_indicate_status_msg_t;
|
|
|
|
|
|
|
|
struct rndis_keepalive_msg
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestID;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_keepalive_msg* rndis_keepalive_msg_t;
|
|
|
|
|
|
|
|
/* Response: */
|
|
|
|
struct rndis_keepalive_cmplt
|
|
|
|
{
|
2021-03-08 18:19:04 +08:00
|
|
|
rt_uint32_t MessageType;
|
|
|
|
rt_uint32_t MessageLength;
|
|
|
|
rt_uint32_t RequestId;
|
|
|
|
rt_uint32_t Status;
|
2017-11-24 22:57:22 +08:00
|
|
|
};
|
|
|
|
typedef struct rndis_keepalive_cmplt* rndis_keepalive_cmplt_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|