source: azure_iot_hub_f767zi/trunk/asp_baseplatform/lwip/contrib-2.1.0/examples/lwiperf/lwiperf_example.c@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 2.3 KB
Line 
1/*
2 * Redistribution and use in source and binary forms, with or without modification,
3 * are permitted provided that the following conditions are met:
4 *
5 * 1. Redistributions of source code must retain the above copyright notice,
6 * this list of conditions and the following disclaimer.
7 * 2. Redistributions in binary form must reproduce the above copyright notice,
8 * this list of conditions and the following disclaimer in the documentation
9 * and/or other materials provided with the distribution.
10 * 3. The name of the author may not be used to endorse or promote products
11 * derived from this software without specific prior written permission.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
22 * OF SUCH DAMAGE.
23 *
24 * This file is part of the lwIP TCP/IP stack.
25 *
26 * Author: Dirk Ziegelmeier <dziegel@gmx.de>
27 *
28 */
29
30#include "lwip/apps/lwiperf.h"
31#include "lwiperf_example.h"
32
33#if LWIP_TCP
34static void
35lwiperf_report(void *arg, enum lwiperf_report_type report_type,
36 const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port,
37 u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec)
38{
39 LWIP_UNUSED_ARG(arg);
40 LWIP_UNUSED_ARG(local_addr);
41 LWIP_UNUSED_ARG(local_port);
42
43 printf("IPERF report: type=%d, remote: %s:%d, total bytes: %"U32_F", duration in ms: %"U32_F", kbits/s: %"U32_F"\n",
44 (int)report_type, ipaddr_ntoa(remote_addr), (int)remote_port, bytes_transferred, ms_duration, bandwidth_kbitpsec);
45}
46#endif /* LWIP_TCP */
47
48void
49lwiperf_example_init(void)
50{
51#if LWIP_TCP
52 lwiperf_start_tcp_server_default(lwiperf_report, NULL);
53#endif
54}
Note: See TracBrowser for help on using the repository browser.