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 /** Transmission Control Protocol (TCP) */
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_tcp.h"
30
31
32 /* Bring in externs for caller checking code. */
33 NX_CALLER_CHECKING_EXTERNS
34
35
36 /**************************************************************************/
37 /* */
38 /* FUNCTION RELEASE */
39 /* */
40 /* _nxe_tcp_info_get PORTABLE C */
41 /* 6.1 */
42 /* AUTHOR */
43 /* */
44 /* Yuxin Zhou, Microsoft Corporation */
45 /* */
46 /* DESCRIPTION */
47 /* */
48 /* This function checks for errors in the TCP information get */
49 /* function call. */
50 /* */
51 /* INPUT */
52 /* */
53 /* ip_ptr Pointer to the IP instance */
54 /* tcp_packets_sent Destination for number of */
55 /* packets sent */
56 /* tcp_bytes_sent Destination for number of */
57 /* bytes sent */
58 /* tcp_packets_received Destination for number of */
59 /* packets received */
60 /* tcp_bytes_received Destination for number of */
61 /* bytes received */
62 /* tcp_invalid_packets Destination for number of */
63 /* invalid packets */
64 /* tcp_receive_packets_dropped Destination for number of */
65 /* receive packets dropped */
66 /* tcp_checksum_errors Destination for number of */
67 /* checksum errors */
68 /* tcp_connections Destination for number of */
69 /* connections */
70 /* tcp_disconnections Destination for number of */
71 /* disconnections */
72 /* tcp_connections_dropped Destination for number of */
73 /* connections dropped */
74 /* tcp_retransmit_packets Destination for number of */
75 /* retransmit packets */
76 /* */
77 /* OUTPUT */
78 /* */
79 /* status Completion status */
80 /* */
81 /* CALLS */
82 /* */
83 /* _nx_tcp_info_get Actual TCP information get */
84 /* function */
85 /* */
86 /* CALLED BY */
87 /* */
88 /* Application Code */
89 /* */
90 /* RELEASE HISTORY */
91 /* */
92 /* DATE NAME DESCRIPTION */
93 /* */
94 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
95 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
96 /* resulting in version 6.1 */
97 /* */
98 /**************************************************************************/
_nxe_tcp_info_get(NX_IP * ip_ptr,ULONG * tcp_packets_sent,ULONG * tcp_bytes_sent,ULONG * tcp_packets_received,ULONG * tcp_bytes_received,ULONG * tcp_invalid_packets,ULONG * tcp_receive_packets_dropped,ULONG * tcp_checksum_errors,ULONG * tcp_connections,ULONG * tcp_disconnections,ULONG * tcp_connections_dropped,ULONG * tcp_retransmit_packets)99 UINT _nxe_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent,
100 ULONG *tcp_packets_received, ULONG *tcp_bytes_received,
101 ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped,
102 ULONG *tcp_checksum_errors, ULONG *tcp_connections,
103 ULONG *tcp_disconnections, ULONG *tcp_connections_dropped,
104 ULONG *tcp_retransmit_packets)
105 {
106
107 UINT status;
108
109
110 /* Check for invalid input pointers. */
111 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
112 {
113 return(NX_PTR_ERROR);
114 }
115
116 /* Check to see if TCP is enabled. */
117 if (!ip_ptr -> nx_ip_tcp_packet_receive)
118 {
119 return(NX_NOT_ENABLED);
120 }
121
122 /* Check for appropriate caller. */
123 NX_INIT_AND_THREADS_CALLER_CHECKING
124
125 /* Call actual TCP information get function. */
126 status = _nx_tcp_info_get(ip_ptr, tcp_packets_sent, tcp_bytes_sent, tcp_packets_received,
127 tcp_bytes_received, tcp_invalid_packets, tcp_receive_packets_dropped,
128 tcp_checksum_errors, tcp_connections, tcp_disconnections,
129 tcp_connections_dropped, tcp_retransmit_packets);
130
131 /* Return completion status. */
132 return(status);
133 }
134
135