rndis.c
Go to the documentation of this file.
1 /**
2  * @file rndis.c
3  * @brief RNDIS (Remote Network Driver Interface Specification)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL TRACE_LEVEL_INFO
33 
34 //Dependencies
35 #include "usbd_def.h"
36 #include "usbd_rndis.h"
37 #include "os_port.h"
38 #include "core/net.h"
39 #include "usbd_desc.h"
40 #include "rndis.h"
41 #include "rndis_driver.h"
42 #include "rndis_debug.h"
43 #include "debug.h"
44 
45 //Debug macros
46 #if (TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
47  #undef TRACE_DEBUG
48  #define TRACE_DEBUG(...) fprintf(stderr, __VA_ARGS__)
49  #undef TRACE_DEBUG_ARRAY
50  #define TRACE_DEBUG_ARRAY(p, a, n) debugDisplayArray(stderr, p, a, n)
51 #endif
52 
53 //RNDIS context
55 
56 //List of supported OIDs
57 const uint32_t rndisSupportOidList[] =
58 {
59  //Mandatory general OIDs
74  //Mandatory 802.3 OIDs
82 };
83 
84 
85 /**
86  * @brief RNDIS core initialization
87  **/
88 
89 void rndisInit(void)
90 {
91  //Initialize RNDIS context
101 }
102 
103 
104 /**
105  * @brief Process incoming RNDIS message
106  * @param[in] message Pointer to the RNDIS message
107  * @param[in] length Length of the RNDIS message, in bytes
108  * @return Error code
109  **/
110 
112 {
113  error_t error;
114 
115  //Check the length of the message
116  if(length < sizeof(RndisMsg))
117  return ERROR_INVALID_LENGTH;
118 
119  //Debug message
120  TRACE_DEBUG("RNDIS message received (%" PRIuSIZE " bytes)...\r\n", length);
121  //Dump RNDIS message contents
123 
124  //Check message type
125  switch(message->messageType)
126  {
127  //RNDIS Initialize message?
130  break;
131  //RNDIS Halt message?
132  case RNDIS_HALT_MSG:
134  break;
135  //RNDIS Query message?
136  case RNDIS_QUERY_MSG:
138  break;
139  //RNDIS Set message?
140  case RNDIS_SET_MSG:
142  break;
143  //RNDIS Reset message?
144  case RNDIS_RESET_MSG:
146  break;
147  //RNDIS Keep-Alive message?
148  case RNDIS_KEEPALIVE_MSG:
150  break;
151  //Unknown message type?
152  default:
153  error = ERROR_INVALID_TYPE;
154  break;
155  }
156 
157  //Return status code
158  return error;
159 }
160 
161 
162 /**
163  * @brief Process RNDIS Initialize message
164  * @param[in] message Pointer to the RNDIS message
165  * @param[in] length Length of the RNDIS message, in bytes
166  * @return Error code
167  **/
168 
170 {
171  //Check the length of the message
172  if(length < sizeof(RndisInitializeMsg))
173  return ERROR_INVALID_LENGTH;
174 
175  //Debug message
176  TRACE_DEBUG("RNDIS Initialize message received (%" PRIuSIZE " bytes)...\r\n", length);
177 
178  //Format the response to the Initialize message
180 
181  //Send a notification to the host
183 
184  //Successful processing
185  return NO_ERROR;
186 }
187 
188 
189 /**
190  * @brief Process RNDIS Halt message
191  * @param[in] message Pointer to the RNDIS message
192  * @param[in] length Length of the RNDIS message, in bytes
193  * @return Error code
194  **/
195 
197 {
198  //Check the length of the message
199  if(length < sizeof(RndisHaltMsg))
200  return ERROR_INVALID_LENGTH;
201 
202  //Debug message
203  TRACE_DEBUG("RNDIS Halt message received (%" PRIuSIZE " bytes)...\r\n", length);
204 
205  //Switch to the RNDIS_UNINITIALIZED state
207 
208  //Successful processing
209  return NO_ERROR;
210 }
211 
212 
213 /**
214  * @brief Process RNDIS Query message
215  * @param[in] message Pointer to the RNDIS message
216  * @param[in] length Length of the RNDIS message, in bytes
217  * @return Error code
218  **/
219 
221 {
222  size_t n;
223  uint32_t status;
224  uint8_t *buffer;
225  MacAddr macAddr;
226 
227  //Check the length of the message
228  if(length < sizeof(RndisQueryMsg))
229  return ERROR_INVALID_LENGTH;
230 
231  //Debug message
232  TRACE_DEBUG("RNDIS Query message received (%" PRIuSIZE " bytes)...\r\n", length);
233 
234  //Point to the buffer where to format the response data
235  buffer = rndisContext.encapsulatedResp + sizeof(RndisQueryCmplt);
236 
237  //Clear status code
238  status = RNDIS_STATUS_SUCCESS;
239 
240  //Check the identifier of the object being queried for
241  switch(message->oid)
242  {
244  //Retrieve the length of the list
245  n = sizeof(rndisSupportOidList);
246  //Copy the list
247  osMemcpy(buffer, rndisSupportOidList, n);
248  break;
250  //Current hardware status of the underlying NIC
252  n = sizeof(uint32_t);
253  break;
255  //Media types that a NIC can support
256  STORE32LE(RNDIS_MEDIUM_802_3, buffer);
257  n = sizeof(uint32_t);
258  break;
260  //Complete list of the media types that the NIC currently uses
261  STORE32LE(RNDIS_MEDIUM_802_3, buffer);
262  n = sizeof(uint32_t);
263  break;
265  //Maximum network packet size, in bytes, that the NIC supports
266  STORE32LE(1500, buffer);
267  n = sizeof(uint32_t);
268  break;
269  case OID_GEN_LINK_SPEED:
270  //Maximum speed of the NIC
271  STORE32LE(10000000 / 100, buffer);
272  n = sizeof(uint32_t);
273  break;
275  //Minimum number of bytes that a single net packet occupies in
276  //the transmit buffer space of the NIC
277  STORE32LE(1518, buffer);
278  n = sizeof(uint32_t);
279  break;
281  //Amount of storage, in bytes, that a single packet occupies in
282  //the receive buffer space of the NIC
283  STORE32LE(1518, buffer);
284  n = sizeof(uint32_t);
285  break;
286  case OID_GEN_VENDOR_ID:
287  //Three-byte IEEE-registered vendor code, followed by a single byte
288  //that the vendor assigns to identify a particular NIC
289  buffer[0] = 0xFF;
290  buffer[1] = 0xFF;
291  buffer[2] = 0xFF;
292  buffer[3] = 0x00;
293  n = 4;
294  break;
296  //NULL-terminated string describing the NIC
299  break;
301  //Types of net packets for which a protocol receives indications
302  //from a miniport driver
304  n = sizeof(uint32_t);
305  break;
307  //Maximum total packet length, in bytes, the NIC supports
308  STORE32LE(1518, buffer);
309  n = sizeof(uint32_t);
310  break;
312  //Connection status of the NIC on the network
314  n = sizeof(uint32_t);
315  break;
317  //Maximum number of send packet descriptors that can be accepted
318  STORE32LE(1, buffer);
319  n = sizeof(uint32_t);
320  break;
322  //The address of the NIC encoded in the hardware
324  //The address the NIC is currently using
325  macStringToAddr(RNDIS_MAC_ADDR, &macAddr);
326  macCopyAddr(buffer, &macAddr);
327  n = sizeof(MacAddr);
328  break;
330  //Maximum number of 6-byte addresses that the multicast address list can hold
331  STORE32LE(16, buffer);
332  n = sizeof(uint32_t);
333  break;
335  //Number of frames received with alignment errors
337  //Number of frames successfully transmitted after exactly one collision
339  //Number of frames successfully transmitted after more than one collision
340  STORE32LE(0, buffer);
341  n = sizeof(uint32_t);
342  break;
343  default:
344  //Unknown OID
345  n = 0;
346  //Report an error
347  status = RNDIS_STATUS_FAILURE;
348  break;
349  }
350 
351  //Format the response to the Query message
352  rndisFormatQueryCmplt(message->requestId, status, n);
353 
354  //Send a notification to the host
356 
357  //Successful processing
358  return NO_ERROR;
359 }
360 
361 
362 /**
363  * @brief Process RNDIS Set message
364  * @param[in] message Pointer to the RNDIS message
365  * @param[in] length Length of the RNDIS message, in bytes
366  * @return Error code
367  **/
368 
370 {
371  uint32_t status;
372 
373  //Check the length of the message
374  if(length < sizeof(RndisSetMsg))
375  return ERROR_INVALID_LENGTH;
376 
377  //Debug message
378  TRACE_DEBUG("RNDIS Set message received (%" PRIuSIZE " bytes)...\r\n", length);
379 
380  //Clear status code
381  status = RNDIS_STATUS_SUCCESS;
382 
383  //Check the identifier of the object being queried for
384  switch(message->oid)
385  {
387  //Types of net packets for which a protocol receives indications
388  //from a miniport driver
389  rndisContext.packetFilter = LOAD32LE(message->oidInputBuffer);
390  break;
392  //List of multicast addresses on a miniport adapter
393  break;
394  default:
395  //Report an error
396  status = RNDIS_STATUS_FAILURE;
397  break;
398  }
399 
400  //Format the response to the Set message
401  rndisFormatSetCmplt(message->requestId, status);
402 
403  //Send a notification to the host
405 
406  //Successful processing
407  return NO_ERROR;
408 }
409 
410 
411 /**
412  * @brief Process RNDIS Reset message
413  * @param[in] message Pointer to the RNDIS message
414  * @param[in] length Length of the RNDIS message, in bytes
415  * @return Error code
416  **/
417 
419 {
420  //Check the length of the message
421  if(length < sizeof(RndisResetMsg))
422  return ERROR_INVALID_LENGTH;
423 
424  //Debug message
425  TRACE_DEBUG("RNDIS Reset message received (%" PRIuSIZE " bytes)...\r\n", length);
426 
427  //Switch to the RNDIS_UNINITIALIZED state
429 
430  //Format the response to the Reset message
432 
433  //Send a notification to the host
435 
436  //Successful processing
437  return NO_ERROR;
438 }
439 
440 
441 /**
442  * @brief Process RNDIS Keep-Alive message
443  * @param[in] message Pointer to the RNDIS message
444  * @param[in] length Length of the RNDIS message, in bytes
445  * @return Error code
446  **/
447 
449 {
450  //Check the length of the message
451  if(length < sizeof(RndisKeepAliveMsg))
452  return ERROR_INVALID_LENGTH;
453 
454  //Debug message
455  TRACE_DEBUG("RNDIS Keep-Alive message received (%" PRIuSIZE " bytes)...\r\n", length);
456 
457  //Format the response to the Keep-Alive message
459 
460  //Send a notification to the host
462 
463  //Successful processing
464  return NO_ERROR;
465 }
466 
467 
468 /**
469  * @brief Format RNDIS Halt message
470  * @return Error code
471  **/
472 
474 {
476 
477  //Point to the buffer where to format the message
479 
480  //Format the RNDIS Halt message
481  message->messageType = RNDIS_HALT_MSG;
482  message->messageLength = sizeof(RndisHaltMsg);
483  message->requestId = 0;
484 
485  //Set the length of the response
486  rndisContext.encapsulatedRespLen = message->messageLength;
487 
488  //Successful processing
489  return NO_ERROR;
490 }
491 
492 
493 /**
494  * @brief Format RNDIS Indicate Status message
495  * @param[in] status RNDIS status code
496  * @return Error code
497  **/
498 
500 {
502 
503  //Point to the buffer where to format the message
505 
506  //Format the RNDIS Indicate Status message
507  message->messageType = RNDIS_INDICATE_STATUS_MSG;
508  message->messageLength = sizeof(RndisIndicateStatusMsg);
509  message->status = status;
510  message->statusBufferLength = 0;
511  message->statusBufferOffset = 0;
512 
513  //Set the length of the response
514  rndisContext.encapsulatedRespLen = message->messageLength;
515 
516  //Successful processing
517  return NO_ERROR;
518 }
519 
520 
521 /**
522  * @brief Format RNDIS Initialize Cmplt message
523  * @param[in] requestId Request identifier
524  * @return Error code
525  **/
526 
528 {
530 
531  //Point to the buffer where to format the response
533 
534  //Format the RNDIS Initialize Cmplt message
535  message->messageType = RNDIS_INITIALIZE_CMPLT;
536  message->messageLength = sizeof(RndisInitializeCmplt);
537  message->requestId = requestId;
538  message->status = RNDIS_STATUS_SUCCESS;
539  message->majorVersion = RNDIS_MAJOR_VERSION;
540  message->minorVersion = RNDIS_MINOR_VERSION;
541  message->deviceFlags = RNDIS_DF_CONNECTIONLESS;
542  message->medium = RNDIS_MEDIUM_802_3;
543  message->maxPacketsPerTransfer = 1;
544  message->maxTransferSize = RNDIS_MAX_TRANSFER_SIZE;
545  message->packetAlignmentFactor = 0;
546  message->afListOffset = 0;
547  message->afListSize = 0;
548 
549  //Set the length of the response
550  rndisContext.encapsulatedRespLen = message->messageLength;
551 
552  //Switch to the RNDIS_INITIALIZED state
554 
555  //Successful processing
556  return NO_ERROR;
557 }
558 
559 
560 /**
561  * @brief Format RNDIS Query Cmplt message
562  * @param[in] requestId Request identifier
563  * @param[in] status RNDIS status code
564  * @param[in] length Length of the response data, in bytes
565  * @return Error code
566  **/
567 
568 error_t rndisFormatQueryCmplt(uint32_t requestId, uint32_t status, uint32_t length)
569 {
571 
572  //Point to the buffer where to format the response
574 
575  //Format the Query Cmplt message
576  message->messageType = RNDIS_QUERY_CMPLT;
577  message->messageLength = sizeof(RndisQueryCmplt) + length;
578  message->requestId = requestId;
579  message->status = status;
580  message->infoBufferLength = length;
581  message->infoBufferOffset = sizeof(RndisQueryCmplt) - 8;
582 
583  //Save the length of the response
584  rndisContext.encapsulatedRespLen = message->messageLength;
585 
586  //Successful processing
587  return NO_ERROR;
588 }
589 
590 
591 /**
592  * @brief Format RNDIS Set Cmplt message
593  * @param[in] requestId Request identifier
594  * @param[in] status RNDIS status code
595  * @return Error code
596  **/
597 
598 error_t rndisFormatSetCmplt(uint32_t requestId, uint32_t status)
599 {
601 
602  //Point to the buffer where to format the response
604 
605  //Format the RNDIS Set Cmplt message
606  message->messageType = RNDIS_SET_CMPLT;
607  message->messageLength = sizeof(RndisSetCmplt);
608  message->requestId = requestId;
609  message->status = status;
610 
611  //Set the length of the response
612  rndisContext.encapsulatedRespLen = message->messageLength;
613 
614  //Switch to the RNDIS_DATA_INITIALIZED state
616 
617  //Successful processing
618  return NO_ERROR;
619 }
620 
621 
622 /**
623  * @brief Format RNDIS Reset Cmplt message
624  * @return Error code
625  **/
626 
628 {
630 
631  //Point to the buffer where to format the response
633 
634  //Format the RNDIS Reset Cmplt message
635  message->messageType = RNDIS_RESET_CMPLT;
636  message->messageLength = sizeof(RndisResetCmplt);
637  message->status = RNDIS_STATUS_SUCCESS;
638  message->addressingReset = 1;
639 
640  //Set the length of the response
641  rndisContext.encapsulatedRespLen = message->messageLength;
642 
643  //Switch to the RNDIS_INITIALIZED state
645 
646  //Successful processing
647  return NO_ERROR;
648 }
649 
650 
651 /**
652  * @brief Format RNDIS Keep-Alive Cmplt message
653  * @param[in] requestId Request identifier
654  * @return Error code
655  **/
656 
658 {
660 
661  //Point to the buffer where to format the response
663 
664  //Format the RNDIS Keep-Alive Cmplt message
665  message->messageType = RNDIS_KEEPALIVE_CMPLT;
666  message->messageLength = sizeof(RndisKeepAliveCmplt);
667  message->requestId = requestId;
668  message->status = RNDIS_STATUS_SUCCESS;
669 
670  //Set the length of the response
671  rndisContext.encapsulatedRespLen = message->messageLength;
672 
673  //Successful processing
674  return NO_ERROR;
675 }
676 
677 
678 /**
679  * @brief Send RNDIS notification message
680  * @param[in] notification Device notification
681  * @return Error code
682  **/
683 
684 error_t rndisSendNotification(uint32_t notification)
685 {
687 
688  //Prepare a notification message
690  message.reserved = 0;
691 
692  //Debug message
693  TRACE_DEBUG("Sending RNDIS notification...\r\n");
694  TRACE_DEBUG(" Notification = 0x%08" PRIX32 "\r\n", message.notification);
695  TRACE_DEBUG(" Reserved = 0x%08" PRIX32 "\r\n", message.reserved);
696 
697  //Send the notification to the USB host
698  USBD_LL_Transmit(&USBD_Device, RNDIS_NOTIFICATION_EP,
699  (uint8_t *) &message, sizeof(RndisNotificationMsg));
700 
701  //Successful processing
702  return NO_ERROR;
703 }
704 
705 
706 /**
707  * @brief Update RNDIS state
708  * @param[in] newState New RNDIS state to switch to
709  **/
710 
712 {
713  //Check transition event
715  newState == RNDIS_STATE_DATA_INITIALIZED)
716  {
717  //The link is up
720 
721  //Sanity check
722  if(rndisDriverInterface != NULL)
723  {
724  //Notify the user that the link state has changed
725  rndisDriverInterface->nicEvent = TRUE;
727  }
728  }
730  newState == RNDIS_STATE_UNINITIALIZED)
731  {
732  //The link is down
735 
736  //Sanity check
737  if(rndisDriverInterface != NULL)
738  {
739  //Notify the user that the link state has changed
740  rndisDriverInterface->nicEvent = TRUE;
742  }
743  }
744 
745  //Switch to the new state
746  rndisContext.state = newState;
747 }
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
error_t rndisSendNotification(uint32_t notification)
Send RNDIS notification message.
Definition: rndis.c:684
#define RNDIS_HARDWARE_STATUS_READY
Definition: rndis.h:163
Response to a RNDIS Initialize message.
Definition: rndis.h:331
#define RNDIS_KEEPALIVE_CMPLT
Definition: rndis.h:68
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: rndis.h:102
#define OID_802_3_CURRENT_ADDRESS
Definition: rndis.h:147
error_t rndisProcessInitializeMsg(const RndisInitializeMsg *message, size_t length)
Process RNDIS Initialize message.
Definition: rndis.c:169
USB descriptors.
#define netEvent
Definition: net_legacy.h:196
#define RNDIS_QUERY_MSG
Definition: rndis.h:60
uint8_t CmdOpCode
Definition: rndis.h:479
error_t rndisProcessSetMsg(const RndisSetMsg *message, size_t length)
Process RNDIS Set message.
Definition: rndis.c:369
size_t encapsulatedRespLen
Definition: rndis.h:476
void rndisInit(void)
RNDIS core initialization.
Definition: rndis.c:89
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: rndis.h:151
#define RNDIS_QUERY_CMPLT
Definition: rndis.h:61
uint8_t message[]
Definition: chap.h:154
#define TRUE
Definition: os_port.h:50
#define RNDIS_SET_MSG
Definition: rndis.h:62
RNDIS Query message.
Definition: rndis.h:247
#define STORE32LE(a, p)
Definition: cpu_endian.h:279
USBD_HandleTypeDef USBD_Device
#define RNDIS_HALT_MSG
Definition: rndis.h:59
NetInterface * rndisDriverInterface
Definition: rndis_driver.c:44
uint32_t packetFilter
Definition: rndis.h:472
RNDIS Reset message.
Definition: rndis.h:281
RNDIS Indicate Status message.
Definition: rndis.h:293
error_t rndisProcessQueryMsg(const RndisQueryMsg *message, size_t length)
Process RNDIS Query message.
Definition: rndis.c:220
#define RNDIS_KEEPALIVE_MSG
Definition: rndis.h:67
#define osStrlen(s)
Definition: os_port.h:165
RndisState state
Definition: rndis.h:467
error_t rndisFormatIndicateStatusMsg(uint32_t status)
Format RNDIS Indicate Status message.
Definition: rndis.c:499
error_t rndisFormatKeepAliveCmplt(uint32_t requestId)
Format RNDIS Keep-Alive Cmplt message.
Definition: rndis.c:657
uint8_t encapsulatedResp[RNDIS_MAX_TRANSFER_SIZE]
Definition: rndis.h:475
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: rndis.h:108
Response to a RNDIS Query message.
Definition: rndis.h:353
#define RNDIS_DF_CONNECTIONLESS
Definition: rndis.h:82
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: rndis.h:98
#define macCopyAddr(destMacAddr, srcMacAddr)
Definition: ethernet.h:127
bool_t linkState
Definition: rndis.h:469
Device notification message.
Definition: rndis.h:455
#define RNDIS_NOTIFICATION_EP
Definition: usbd_rndis.h:38
uint8_t CmdLength
Definition: rndis.h:480
RNDIS (Remote Network Driver Interface Specification)
#define RNDIS_STATUS_SUCCESS
Definition: rndis.h:74
#define RNDIS_INDICATE_STATUS_MSG
Definition: rndis.h:66
Response to a RNDIS Keep-Alive message.
Definition: rndis.h:395
#define FALSE
Definition: os_port.h:46
USB RNDIS class.
#define osMemcpy(dest, src, length)
Definition: os_port.h:141
error_t rndisFormatSetCmplt(uint32_t requestId, uint32_t status)
Format RNDIS Set Cmplt message.
Definition: rndis.c:598
error_t
Error codes.
Definition: error.h:43
#define RNDIS_RESET_MSG
Definition: rndis.h:64
#define OID_GEN_VENDOR_DESCRIPTION
Definition: rndis.h:101
#define RNDIS_INITIALIZE_MSG
Definition: rndis.h:57
#define OID_GEN_VENDOR_ID
Definition: rndis.h:100
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: rndis.h:94
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: rndis.h:109
error_t rndisFormatHaltMsg(void)
Format RNDIS Halt message.
Definition: rndis.c:473
error_t rndisProcessKeepAliveMsg(const RndisKeepAliveMsg *message, size_t length)
Process RNDIS Keep-Alive message.
Definition: rndis.c:448
#define RNDIS_MAC_ADDR
Definition: rndis.h:40
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: rndis.h:105
bool_t txState
Definition: rndis.h:470
RndisState
RNDIS states.
Definition: rndis.h:196
#define RNDIS_RESET_CMPLT
Definition: rndis.h:65
#define OID_GEN_MEDIA_IN_USE
Definition: rndis.h:92
Response to a RNDIS Set message.
Definition: rndis.h:369
RNDIS Initialize message.
Definition: rndis.h:220
#define OID_GEN_HARDWARE_STATUS
Definition: rndis.h:90
@ ERROR_INVALID_LENGTH
Definition: error.h:111
error_t rndisFormatQueryCmplt(uint32_t requestId, uint32_t status, uint32_t length)
Format RNDIS Query Cmplt message.
Definition: rndis.c:568
#define OID_GEN_SUPPORTED_LIST
Definition: rndis.h:89
bool_t linkEvent
Definition: rndis.h:468
void rndisChangeState(RndisState newState)
Update RNDIS state.
Definition: rndis.c:711
error_t rndisFormatInitializeCmplt(uint32_t requestId)
Format RNDIS Initialize Cmplt message.
Definition: rndis.c:527
error_t macStringToAddr(const char_t *str, MacAddr *macAddr)
Convert a string representation of a MAC address to a binary MAC address.
Definition: ethernet.c:821
@ ERROR_INVALID_TYPE
Definition: error.h:115
#define RNDIS_VENDOR_DESCRIPTION
Definition: rndis.h:45
uint8_t length
Definition: tcp.h:368
Generic RNDIS message.
Definition: rndis.h:209
#define OID_802_3_PERMANENT_ADDRESS
Definition: rndis.h:146
bool_t rxState
Definition: rndis.h:471
MacAddr
Definition: ethernet.h:195
#define RNDIS_NOTIFICATION_RESP_AVAILABLE
Definition: rndis.h:71
const uint32_t rndisSupportOidList[]
Definition: rndis.c:57
#define RNDIS_MAX_TRANSFER_SIZE
Definition: rndis.h:53
char char_t
Definition: compiler_port.h:48
RNDIS (Remote Network Driver Interface Specification)
RNDIS Set message.
Definition: rndis.h:264
#define RNDIS_STATUS_FAILURE
Definition: rndis.h:75
#define RNDIS_MEDIUM_802_3
Definition: rndis.h:170
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: rndis.h:149
RNDIS driver.
uint8_t n
error_t rndisDumpMsg(const RndisMsg *message, size_t length)
Dump RNDIS message for debugging purpose.
Definition: rndis_debug.c:124
error_t rndisProcessResetMsg(const RndisResetMsg *message, size_t length)
Process RNDIS Reset message.
Definition: rndis.c:418
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: rndis.h:99
#define OID_802_3_XMIT_MORE_COLLISIONS
Definition: rndis.h:153
#define TRACE_DEBUG(...)
Definition: rndis.c:48
RndisContext rndisContext
Definition: rndis.c:54
RNDIS context.
Definition: rndis.h:466
@ RNDIS_STATE_INITIALIZED
Definition: rndis.h:199
#define OID_802_3_XMIT_ONE_COLLISION
Definition: rndis.h:152
#define OID_802_3_MULTICAST_LIST
Definition: rndis.h:148
#define RNDIS_MAJOR_VERSION
Definition: rndis.h:49
#define OID_GEN_LINK_SPEED
Definition: rndis.h:95
#define OID_GEN_MEDIA_SUPPORTED
Definition: rndis.h:91
size_t rxBufferLen
Definition: rndis.h:474
@ RNDIS_STATE_UNINITIALIZED
Definition: rndis.h:197
#define LOAD32LE(p)
Definition: cpu_endian.h:203
Response to a RNDIS Reset message.
Definition: rndis.h:382
#define RNDIS_MEDIA_STATE_CONNECTED
Definition: rndis.h:173
#define PRIuSIZE
error_t rndisProcessMsg(const RndisMsg *message, size_t length)
Process incoming RNDIS message.
Definition: rndis.c:111
error_t rndisFormatResetCmplt(void)
Format RNDIS Reset Cmplt message.
Definition: rndis.c:627
TCP/IP stack core.
@ RNDIS_STATE_DATA_INITIALIZED
Definition: rndis.h:200
#define RNDIS_INITIALIZE_CMPLT
Definition: rndis.h:58
#define osStrcpy(s1, s2)
Definition: os_port.h:207
RTOS abstraction layer.
RNDIS Keep-Alive message.
Definition: rndis.h:319
error_t rndisProcessHaltMsg(const RndisHaltMsg *message, size_t length)
Process RNDIS Halt message.
Definition: rndis.c:196
#define RNDIS_MINOR_VERSION
Definition: rndis.h:50
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
RNDIS Halt message.
Definition: rndis.h:235
#define RNDIS_SET_CMPLT
Definition: rndis.h:63