2011-03-20 19:18:19 +01:00
|
|
|
/****************************************************************************
|
2021-06-16 09:22:16 +02:00
|
|
|
* apps/examples/nettest/nettest.h
|
2011-03-20 19:18:19 +01:00
|
|
|
*
|
2021-06-15 09:09:58 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2011-03-20 19:18:19 +01:00
|
|
|
*
|
2021-06-15 09:09:58 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-03-20 19:18:19 +01:00
|
|
|
*
|
2021-06-15 09:09:58 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2011-03-20 19:18:19 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-16 03:31:55 +01:00
|
|
|
#ifndef __APPS_EXAMPLES_NETTEST_NETTEST_H
|
|
|
|
#define __APPS_EXAMPLES_NETTEST_NETTEST_H
|
2011-03-20 19:18:19 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-07-05 03:13:08 +02:00
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
2013-01-24 17:28:15 +01:00
|
|
|
#ifdef NETTEST_HOST
|
2011-03-20 19:18:19 +01:00
|
|
|
#else
|
|
|
|
# include <debug.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-01-21 01:12:27 +01:00
|
|
|
* Pre-processor Definitions
|
2011-03-20 19:18:19 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-24 17:28:15 +01:00
|
|
|
#ifdef NETTEST_HOST
|
2022-01-16 03:31:55 +01:00
|
|
|
/* HTONS/L macros are unique to uIP */
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2020-02-04 16:30:34 +01:00
|
|
|
# undef HTONS
|
|
|
|
# undef HTONL
|
2011-03-20 19:18:19 +01:00
|
|
|
# define HTONS(a) htons(a)
|
|
|
|
# define HTONL(a) htonl(a)
|
|
|
|
|
2022-01-16 03:31:55 +01:00
|
|
|
/* Have SO_LINGER */
|
2011-03-20 19:18:19 +01:00
|
|
|
|
|
|
|
# define NETTEST_HAVE_SOLINGER 1
|
|
|
|
|
|
|
|
#else
|
2014-10-08 16:33:00 +02:00
|
|
|
# ifdef CONFIG_NET_SOLINGER
|
|
|
|
# define NETTEST_HAVE_SOLINGER 1
|
2011-03-20 19:18:19 +01:00
|
|
|
# else
|
2014-10-08 16:33:00 +02:00
|
|
|
# undef NETTEST_HAVE_SOLINGER
|
2011-03-20 19:18:19 +01:00
|
|
|
# endif
|
2015-01-21 01:12:27 +01:00
|
|
|
#endif /* NETTEST_HOST */
|
|
|
|
|
|
|
|
#ifdef CONFIG_EXAMPLES_NETTEST_IPv6
|
|
|
|
# define AF_INETX AF_INET6
|
|
|
|
# define PF_INETX PF_INET6
|
|
|
|
#else
|
|
|
|
# define AF_INETX AF_INET
|
|
|
|
# define PF_INETX PF_INET
|
2011-03-20 19:18:19 +01:00
|
|
|
#endif
|
|
|
|
|
2017-06-23 20:21:13 +02:00
|
|
|
#ifndef CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO
|
|
|
|
# define CONFIG_EXAMPLES_NETTEST_SERVER_PORTNO 5471
|
|
|
|
#endif
|
|
|
|
|
2017-06-24 17:49:44 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_NETTEST_SENDSIZE
|
|
|
|
# define SENDSIZE CONFIG_EXAMPLES_NETTEST_SENDSIZE
|
|
|
|
#else
|
|
|
|
# define SENDSIZE 4096
|
|
|
|
#endif
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2017-06-23 20:21:13 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_EXAMPLES_NETTEST_IPv6
|
2020-02-04 16:26:47 +01:00
|
|
|
extern uint16_t g_nettestserver_ipv6[8];
|
2017-06-23 20:21:13 +02:00
|
|
|
#else
|
2020-02-04 16:26:47 +01:00
|
|
|
extern uint32_t g_nettestserver_ipv4;
|
2017-06-23 20:21:13 +02:00
|
|
|
#endif
|
|
|
|
|
2011-03-20 19:18:19 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-06-23 19:40:02 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_NETTEST_INIT
|
|
|
|
void nettest_initialize(void);
|
|
|
|
#endif
|
|
|
|
|
2017-06-25 17:15:27 +02:00
|
|
|
void nettest_cmdline(int argc, char **argv);
|
|
|
|
extern void nettest_client(void);
|
|
|
|
extern void nettest_server(void);
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2022-01-16 03:31:55 +01:00
|
|
|
#endif /* __APPS_EXAMPLES_NETTEST_NETTEST_H */
|