1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** NetX Component */ 17 /** */ 18 /** Reverse Address Resolution Protocol (RARP) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 #define NX_SOURCE_CODE 24 25 26 /* Include necessary system files. */ 27 28 #include "nx_api.h" 29 #include "nx_rarp.h" 30 31 #ifndef NX_DISABLE_IPV4 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _nx_rarp_queue_process PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Yuxin Zhou, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function processes the received RARP messages on the RARP */ 45 /* queue placed there by nx_rarp_deferred_receive. */ 46 /* */ 47 /* INPUT */ 48 /* */ 49 /* ip_ptr Pointer to IP instance */ 50 /* */ 51 /* OUTPUT */ 52 /* */ 53 /* None */ 54 /* */ 55 /* CALLS */ 56 /* */ 57 /* _nx_rarp_packet_receive Process received RARP packet */ 58 /* */ 59 /* CALLED BY */ 60 /* */ 61 /* _nx_ip_thread_entry IP helper thread */ 62 /* */ 63 /* RELEASE HISTORY */ 64 /* */ 65 /* DATE NAME DESCRIPTION */ 66 /* */ 67 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 68 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 69 /* resulting in version 6.1 */ 70 /* */ 71 /**************************************************************************/ _nx_rarp_queue_process(NX_IP * ip_ptr)72VOID _nx_rarp_queue_process(NX_IP *ip_ptr) 73 { 74 75 TX_INTERRUPT_SAVE_AREA 76 77 NX_PACKET *packet_ptr; 78 79 80 /* Loop to process all RARP deferred packet requests. */ 81 while (ip_ptr -> nx_ip_rarp_deferred_received_packet_head) 82 { 83 84 /* Remove the first packet and process it! */ 85 86 /* Disable interrupts. */ 87 TX_DISABLE 88 89 /* Pickup the first packet. */ 90 packet_ptr = ip_ptr -> nx_ip_rarp_deferred_received_packet_head; 91 92 /* Move the head pointer to the next packet. */ 93 ip_ptr -> nx_ip_rarp_deferred_received_packet_head = packet_ptr -> nx_packet_queue_next; 94 95 /* Check for end of RARP deferred processing queue. */ 96 if (ip_ptr -> nx_ip_rarp_deferred_received_packet_head == NX_NULL) 97 { 98 99 /* Yes, the RARP deferred queue is empty. Set the tail pointer to NULL. */ 100 ip_ptr -> nx_ip_rarp_deferred_received_packet_tail = NX_NULL; 101 } 102 103 /* Restore interrupts. */ 104 TX_RESTORE 105 106 /* Call the actual RARP packet receive function. */ 107 _nx_rarp_packet_receive(ip_ptr, packet_ptr); 108 } 109 } 110 #endif /* !NX_DISABLE_IPV4 */ 111 112