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 /** Internet Protocol (IP) */
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_ip.h"
30 #include "nx_packet.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _nx_ip_delete_queue_clear PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Yuxin Zhou, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function releases all packets in a packet queue. */
46 /* */
47 /* INPUT */
48 /* */
49 /* head_ptr Pointer to head of queue */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* status Completion status */
54 /* */
55 /* CALLS */
56 /* */
57 /* _nx_packet_release Release data packet */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* Application */
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_ip_delete_queue_clear(NX_PACKET * head_ptr)72 VOID _nx_ip_delete_queue_clear(NX_PACKET *head_ptr)
73 {
74
75 NX_PACKET *next_packet;
76 NX_PACKET *current_packet;
77
78
79 /* Setup next packet to queue head. */
80 next_packet = head_ptr;
81
82 /* Release any raw IP packets queued up. */
83 while (next_packet)
84 {
85
86 /* Setup the current packet pointer. */
87 current_packet = next_packet;
88
89 /* Move to the next packet. */
90 next_packet = next_packet -> nx_packet_queue_next;
91
92 /* Release the current packet. */
93 _nx_packet_release(current_packet);
94 }
95 }
96
97