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 
31 /* Bring in externs for caller checking code.  */
32 NX_CALLER_CHECKING_EXTERNS
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _nxe_ip_info_get                                    PORTABLE C      */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Yuxin Zhou, Microsoft Corporation                                   */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function checks for errors in the IP information get           */
47 /*    function call.                                                      */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    ip_ptr                                Pointer to IP instance        */
52 /*    ip_total_packets_sent                 Destination for number of     */
53 /*                                            packets sent                */
54 /*    ip_total_bytes_sent                   Destination for number of     */
55 /*                                            bytes sent                  */
56 /*    ip_total_packets_received             Destination for number of     */
57 /*                                            packets received            */
58 /*    ip_total_bytes_received               Destination for number of     */
59 /*                                            bytes received              */
60 /*    ip_invalid_packets                    Destination for number of     */
61 /*                                            invalid packets             */
62 /*    ip_receive_packets_dropped            Destination for number of     */
63 /*                                            packets dropped             */
64 /*    ip_receive_checksum_errors            Destination for number of     */
65 /*                                            checksum errors             */
66 /*    ip_send_packets_dropped               Destination for number of     */
67 /*                                            send packets dropped        */
68 /*    ip_total_fragments_sent               Destination for number of     */
69 /*                                            fragments sent              */
70 /*    ip_total_fragments_received           Destination for number of     */
71 /*                                            fragments received          */
72 /*                                                                        */
73 /*  OUTPUT                                                                */
74 /*                                                                        */
75 /*    status                                Completion status             */
76 /*                                                                        */
77 /*  CALLS                                                                 */
78 /*                                                                        */
79 /*    _nx_ip_info_get                       Actual IP information get     */
80 /*                                            function                    */
81 /*                                                                        */
82 /*  CALLED BY                                                             */
83 /*                                                                        */
84 /*    Application                                                         */
85 /*                                                                        */
86 /*  RELEASE HISTORY                                                       */
87 /*                                                                        */
88 /*    DATE              NAME                      DESCRIPTION             */
89 /*                                                                        */
90 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
91 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
92 /*                                            resulting in version 6.1    */
93 /*                                                                        */
94 /**************************************************************************/
_nxe_ip_info_get(NX_IP * ip_ptr,ULONG * ip_total_packets_sent,ULONG * ip_total_bytes_sent,ULONG * ip_total_packets_received,ULONG * ip_total_bytes_received,ULONG * ip_invalid_packets,ULONG * ip_receive_packets_dropped,ULONG * ip_receive_checksum_errors,ULONG * ip_send_packets_dropped,ULONG * ip_total_fragments_sent,ULONG * ip_total_fragments_received)95 UINT  _nxe_ip_info_get(NX_IP *ip_ptr, ULONG *ip_total_packets_sent, ULONG *ip_total_bytes_sent,
96                        ULONG *ip_total_packets_received, ULONG *ip_total_bytes_received,
97                        ULONG *ip_invalid_packets, ULONG *ip_receive_packets_dropped,
98                        ULONG *ip_receive_checksum_errors, ULONG *ip_send_packets_dropped,
99                        ULONG *ip_total_fragments_sent, ULONG *ip_total_fragments_received)
100 {
101 
102 UINT status;
103 
104 
105     /* Check for invalid input pointers.  */
106     if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
107     {
108         return(NX_PTR_ERROR);
109     }
110 
111     /* Check for appropriate caller.  */
112     NX_INIT_AND_THREADS_CALLER_CHECKING
113 
114     /* Call actual IP information get function.  */
115     status =  _nx_ip_info_get(ip_ptr, ip_total_packets_sent, ip_total_bytes_sent, ip_total_packets_received,
116                               ip_total_bytes_received, ip_invalid_packets, ip_receive_packets_dropped,
117                               ip_receive_checksum_errors, ip_send_packets_dropped,
118                               ip_total_fragments_sent, ip_total_fragments_received);
119 
120     /* Return completion status.  */
121     return(status);
122 }
123 
124