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 #include "Service_Libs/mle_service/mle_service_api.h" 00024 00025 #include "net_test_api.h" 00026 #include "Common_Protocols/tcp.h" 00027 00028 #include "ns_trace.h" 00029 00030 #define TRACE_GROUP "nTES" 00031 00032 bool validate_tcp_state_name(int state) 00033 { 00034 switch (state) { 00035 case TCP_STATE_LISTEN: 00036 case TCP_STATE_SYN_SENT: 00037 case TCP_STATE_SYN_RECEIVED: 00038 case TCP_STATE_ESTABLISHED: 00039 case TCP_STATE_CLOSE_WAIT: 00040 case TCP_STATE_LAST_ACK: 00041 case TCP_STATE_FIN_WAIT_1: 00042 case TCP_STATE_FIN_WAIT_2: 00043 case TCP_STATE_CLOSING: 00044 case TCP_STATE_TIME_WAIT: 00045 return true; 00046 default: 00047 return false; 00048 } 00049 } 00050 00051 int8_t arm_nwk_test_tcp_drop_tx(int state, uint8_t count) 00052 { 00053 int8_t retcode = -1; 00054 if (validate_tcp_state_name(state)) { 00055 if (count > 200) { 00056 count = 200; 00057 } 00058 retcode = tcp_test_drop_tx(state, count); 00059 } 00060 00061 return retcode; 00062 } 00063 00064 int8_t arm_nwk_test_tcp_drop_rx(int state, uint8_t count) 00065 { 00066 int8_t retcode = -1; 00067 if (validate_tcp_state_name(state)) { 00068 if (count > 200) { 00069 count = 200; 00070 } 00071 retcode = tcp_test_drop_rx(state, count); 00072 } 00073 00074 return retcode; 00075 } 00076 00077 void arm_nwk_test_tcp_drop_reset() { 00078 tcp_test_drop_reset(); 00079 } 00080 00081 void arm_nwk_test_mle_receive_filter_set(mle_service_filter_cb *response_filter_cb) 00082 { 00083 mle_service_receive_filter_cb_set(response_filter_cb); 00084 }
Generated on Tue Jul 12 2022 12:45:36 by
