Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
net_test.c
00001 /* 00002 * Copyright (c) 2016-2017, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #include "nsconfig.h" 00019 00020 #include <string.h> 00021 #include "nsdynmemLIB.h" 00022 #include "NWK_INTERFACE/Include/protocol.h" 00023 00024 #include "net_test_api.h" 00025 #include "Common_Protocols/tcp.h" 00026 00027 #include "ns_trace.h" 00028 00029 #define TRACE_GROUP "nTES" 00030 00031 bool validate_tcp_state_name(int state) 00032 { 00033 switch (state) { 00034 case TCP_STATE_LISTEN: 00035 case TCP_STATE_SYN_SENT: 00036 case TCP_STATE_SYN_RECEIVED: 00037 case TCP_STATE_ESTABLISHED: 00038 case TCP_STATE_CLOSE_WAIT: 00039 case TCP_STATE_LAST_ACK: 00040 case TCP_STATE_FIN_WAIT_1: 00041 case TCP_STATE_FIN_WAIT_2: 00042 case TCP_STATE_CLOSING: 00043 case TCP_STATE_TIME_WAIT: 00044 return true; 00045 default: 00046 return false; 00047 } 00048 } 00049 00050 int8_t arm_nwk_test_tcp_drop_tx(int state, uint8_t count) 00051 { 00052 int8_t retcode = -1; 00053 if (validate_tcp_state_name(state)) { 00054 if (count > 200) { 00055 count = 200; 00056 } 00057 retcode = tcp_test_drop_tx(state, count); 00058 } 00059 00060 return retcode; 00061 } 00062 00063 int8_t arm_nwk_test_tcp_drop_rx(int state, uint8_t count) 00064 { 00065 int8_t retcode = -1; 00066 if (validate_tcp_state_name(state)) { 00067 if (count > 200) { 00068 count = 200; 00069 } 00070 retcode = tcp_test_drop_rx(state, count); 00071 } 00072 00073 return retcode; 00074 } 00075 00076 void arm_nwk_test_tcp_drop_reset() { 00077 tcp_test_drop_reset(); 00078 }
Generated on Tue Jul 12 2022 12:22:14 by
