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 /** Packet Pool Management (Packet) */
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_packet.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _nx_packet_length_get PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Yuxin Zhou, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function returns the length of the supplied packet. */
44 /* */
45 /* INPUT */
46 /* */
47 /* packet_ptr Pointer of packet */
48 /* length Destination for the length */
49 /* */
50 /* OUTPUT */
51 /* */
52 /* status Completion status */
53 /* */
54 /* CALLS */
55 /* */
56 /* None */
57 /* */
58 /* CALLED BY */
59 /* */
60 /* Application Code */
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_packet_length_get(NX_PACKET * packet_ptr,ULONG * length)71 UINT _nx_packet_length_get(NX_PACKET *packet_ptr, ULONG *length)
72 {
73
74 /* Return the length of the packet. */
75 *length = packet_ptr -> nx_packet_length;
76
77 /* If trace is enabled, insert this event into the trace buffer. */
78 NX_TRACE_IN_LINE_INSERT(NX_TRACE_PACKET_LENGTH_GET, packet_ptr, *length, 0, 0, NX_TRACE_PACKET_EVENTS, 0, 0);
79
80 /* Return completion status. */
81 return(NX_SUCCESS);
82 }
83
84