1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** NetX Component                                                        */
16 /**                                                                       */
17 /**   Internet Protocol (IP)                                              */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define NX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "nx_api.h"
28 #include "nx_ip.h"
29 #include "nx_packet.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _nx_ip_delete_queue_clear                           PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Yuxin Zhou, Microsoft Corporation                                   */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function releases all packets in a packet queue.               */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    head_ptr                              Pointer to head of queue      */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    status                                Completion status             */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    _nx_packet_release                    Release data packet           */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    Application                                                         */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
67 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
68 /*                                            resulting in version 6.1    */
69 /*                                                                        */
70 /**************************************************************************/
_nx_ip_delete_queue_clear(NX_PACKET * head_ptr)71 VOID  _nx_ip_delete_queue_clear(NX_PACKET *head_ptr)
72 {
73 
74 NX_PACKET *next_packet;
75 NX_PACKET *current_packet;
76 
77 
78     /* Setup next packet to queue head.  */
79     next_packet =  head_ptr;
80 
81     /* Release any raw IP packets queued up.  */
82     while (next_packet)
83     {
84 
85         /* Setup the current packet pointer.  */
86         current_packet =  next_packet;
87 
88         /* Move to the next packet.  */
89         next_packet =  next_packet -> nx_packet_queue_next;
90 
91         /* Release the current packet.  */
92         _nx_packet_release(current_packet);
93     }
94 }
95 
96