2023-07-06 14:46:33 -03:00
|
|
|
#include <AP_HAL/AP_HAL_Boards.h>
|
2024-01-24 00:43:53 -04:00
|
|
|
#include <AP_SerialManager/AP_SerialManager_config.h>
|
2023-07-06 14:46:33 -03:00
|
|
|
|
2023-12-25 15:51:40 -04:00
|
|
|
#if defined(AP_NETWORKING_BACKEND_PPP) && !defined(AP_NETWORKING_ENABLED)
|
2024-09-10 17:16:27 -03:00
|
|
|
// allow --enable-PPP to enable networking
|
2023-12-25 15:51:40 -04:00
|
|
|
#define AP_NETWORKING_ENABLED AP_NETWORKING_BACKEND_PPP
|
|
|
|
#endif
|
|
|
|
|
2023-12-27 18:08:19 -04:00
|
|
|
|
2023-07-06 14:46:33 -03:00
|
|
|
#ifndef AP_NETWORKING_ENABLED
|
2024-01-09 05:59:26 -04:00
|
|
|
#if !defined(__APPLE__) && defined(__clang__)
|
|
|
|
// clang fails on linux
|
2023-12-27 18:08:19 -04:00
|
|
|
#define AP_NETWORKING_ENABLED 0
|
|
|
|
#else
|
|
|
|
#define AP_NETWORKING_ENABLED ((CONFIG_HAL_BOARD == HAL_BOARD_LINUX) || (CONFIG_HAL_BOARD == HAL_BOARD_SITL))
|
|
|
|
#endif
|
2023-07-06 14:46:33 -03:00
|
|
|
#endif
|
|
|
|
|
2023-11-12 18:09:58 -04:00
|
|
|
#ifndef AP_NETWORKING_BACKEND_DEFAULT_ENABLED
|
|
|
|
#define AP_NETWORKING_BACKEND_DEFAULT_ENABLED AP_NETWORKING_ENABLED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ---------------------------
|
|
|
|
// Backends
|
|
|
|
// ---------------------------
|
|
|
|
#ifndef AP_NETWORKING_BACKEND_CHIBIOS
|
2023-12-25 15:27:13 -04:00
|
|
|
#ifndef HAL_USE_MAC
|
|
|
|
#define HAL_USE_MAC 0
|
|
|
|
#endif
|
|
|
|
#define AP_NETWORKING_BACKEND_CHIBIOS (AP_NETWORKING_BACKEND_DEFAULT_ENABLED && (CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS) && HAL_USE_MAC)
|
2023-12-09 16:10:16 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AP_NETWORKING_BACKEND_PPP
|
2023-12-25 17:19:28 -04:00
|
|
|
#define AP_NETWORKING_BACKEND_PPP 0
|
2023-12-09 05:23:15 -04:00
|
|
|
#endif
|
|
|
|
|
2023-11-13 18:08:36 -04:00
|
|
|
#ifndef AP_NETWORKING_BACKEND_SITL
|
2023-11-29 18:16:31 -04:00
|
|
|
#define AP_NETWORKING_BACKEND_SITL (AP_NETWORKING_BACKEND_DEFAULT_ENABLED && (CONFIG_HAL_BOARD == HAL_BOARD_SITL))
|
2023-11-13 18:08:36 -04:00
|
|
|
#endif
|
|
|
|
|
2023-12-25 22:41:28 -04:00
|
|
|
#ifndef AP_NETWORKING_SOCKETS_ENABLED
|
2023-12-25 15:27:13 -04:00
|
|
|
#define AP_NETWORKING_SOCKETS_ENABLED AP_NETWORKING_ENABLED
|
2023-12-25 22:41:28 -04:00
|
|
|
#endif
|
2023-11-12 18:09:58 -04:00
|
|
|
|
2024-01-04 22:39:30 -04:00
|
|
|
#ifndef AP_NETWORKING_CONTROLS_HOST_IP_SETTINGS_ENABLED
|
|
|
|
// AP_NETWORKING_CONTROLS_HOST_IP_SETTINGS_ENABLED should only be true if we have the ability to
|
|
|
|
// change the IP address. If not then the IP, GW, NetMask, MAC and DHCP params are hidden.
|
|
|
|
// This does not mean that the system/OS does not have the ability to set the IP, just that
|
|
|
|
// we have no control from this scope. For example, Linux systems (including SITL) have
|
|
|
|
// their own DHCP client running but we have no control over it.
|
|
|
|
#define AP_NETWORKING_CONTROLS_HOST_IP_SETTINGS_ENABLED AP_NETWORKING_BACKEND_CHIBIOS
|
|
|
|
#endif
|
|
|
|
|
2024-01-03 17:46:59 -04:00
|
|
|
#define AP_NETWORKING_NEED_LWIP (AP_NETWORKING_BACKEND_CHIBIOS || AP_NETWORKING_BACKEND_PPP)
|
|
|
|
|
2023-11-12 18:09:58 -04:00
|
|
|
// ---------------------------
|
|
|
|
// IP Features
|
|
|
|
// ---------------------------
|
2023-11-29 18:16:31 -04:00
|
|
|
#ifndef AP_NETWORKING_DHCP_AVAILABLE
|
|
|
|
// AP_NETWORKING_DHCP_AVAILABLE should only be true if, by setting the NET_DHCP parameter,
|
|
|
|
// we have the ability to turn on/off the DHCP client which effects the assigned IP address.
|
|
|
|
// Otherwise, param NET_DHCP will be hidden. This does not mean that the system/OS does not
|
|
|
|
// have DHCP, just that we have no control from this scope. For example, Linux systems
|
|
|
|
// (including SITL) have their own DHCP client running but we have no control over it.
|
|
|
|
#define AP_NETWORKING_DHCP_AVAILABLE (AP_NETWORKING_CONTROLS_HOST_IP_SETTINGS_ENABLED || AP_NETWORKING_BACKEND_CHIBIOS)
|
2023-07-06 14:46:33 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------
|
|
|
|
// Below are default params
|
|
|
|
// ---------------------------
|
|
|
|
|
|
|
|
// Default DHCP
|
|
|
|
#ifndef AP_NETWORKING_DEFAULT_DHCP_ENABLE
|
2023-11-29 18:16:31 -04:00
|
|
|
#define AP_NETWORKING_DEFAULT_DHCP_ENABLE AP_NETWORKING_DHCP_AVAILABLE
|
2023-07-06 14:46:33 -03:00
|
|
|
#endif
|
|
|
|
|
2023-08-05 00:51:54 -03:00
|
|
|
// Default Static IP Address: 192.168.13.14
|
|
|
|
#ifndef AP_NETWORKING_DEFAULT_STATIC_IP_ADDR
|
|
|
|
#define AP_NETWORKING_DEFAULT_STATIC_IP_ADDR "192.168.13.14"
|
2023-07-06 14:46:33 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Default Netmask: 24
|
|
|
|
// Note, the netmask is the number of consecutive bits
|
|
|
|
#ifndef AP_NETWORKING_DEFAULT_NETMASK
|
2023-07-07 15:15:26 -03:00
|
|
|
#define AP_NETWORKING_DEFAULT_NETMASK 24 // 255.255.255.0 (for 10.0.xxx.xxx or 172.xxx.xxx.xxx type networks)
|
|
|
|
// #define AP_NETWORKING_DEFAULT_NETMASK 16 // 255.255.0.0 (for 192.168.xxx.xxxx type networks)
|
2023-07-06 14:46:33 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Default Static IP Address: 192.168.13.1
|
2023-08-05 00:51:54 -03:00
|
|
|
#ifndef AP_NETWORKING_DEFAULT_STATIC_GW_ADDR
|
|
|
|
#define AP_NETWORKING_DEFAULT_STATIC_GW_ADDR "192.168.13.1"
|
2023-07-06 14:46:33 -03:00
|
|
|
#endif
|
|
|
|
|
2023-08-05 00:51:54 -03:00
|
|
|
// Default MAC Address: C2:AF:51:03:CF:46
|
2023-07-07 15:15:26 -03:00
|
|
|
// Note, lower 3 bytes (ADDR3,4,5) will be replaced with the platform UUID
|
2023-08-05 00:51:54 -03:00
|
|
|
#ifndef AP_NETWORKING_DEFAULT_MAC_ADDR
|
|
|
|
#define AP_NETWORKING_DEFAULT_MAC_ADDR "C2:AF:51:03:CF:46"
|
2023-07-06 14:46:33 -03:00
|
|
|
#endif
|
2023-11-12 21:37:10 -04:00
|
|
|
|
|
|
|
#ifndef AP_NETWORKING_TESTS_ENABLED
|
|
|
|
#define AP_NETWORKING_TESTS_ENABLED 0
|
|
|
|
#endif
|
|
|
|
|
2024-09-07 23:38:47 -03:00
|
|
|
#ifndef AP_NETWORKING_CAN_MCAST_ENABLED
|
|
|
|
#define AP_NETWORKING_CAN_MCAST_ENABLED 0
|
|
|
|
#endif
|
|
|
|
|
2023-11-12 21:37:10 -04:00
|
|
|
#if AP_NETWORKING_TESTS_ENABLED
|
|
|
|
#ifndef AP_NETWORKING_TEST_IP
|
2023-11-13 18:07:25 -04:00
|
|
|
#define AP_NETWORKING_TEST_IP "192.168.13.2"
|
2023-11-12 21:37:10 -04:00
|
|
|
#endif
|
|
|
|
#endif
|
2023-11-15 23:46:08 -04:00
|
|
|
|
|
|
|
#ifndef AP_NETWORKING_NUM_PORTS
|
|
|
|
#define AP_NETWORKING_NUM_PORTS 4
|
|
|
|
#endif
|
2023-12-07 14:32:32 -04:00
|
|
|
|
|
|
|
#ifndef AP_NETWORKING_NUM_SENDFILES
|
|
|
|
#define AP_NETWORKING_NUM_SENDFILES 20
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AP_NETWORKING_SENDFILE_BUFSIZE
|
2024-01-04 22:37:02 -04:00
|
|
|
#define AP_NETWORKING_SENDFILE_BUFSIZE (64*512)
|
2023-12-07 14:32:32 -04:00
|
|
|
#endif
|
2024-01-08 16:27:31 -04:00
|
|
|
|
|
|
|
#ifndef AP_NETWORKING_PPP_GATEWAY_ENABLED
|
|
|
|
#define AP_NETWORKING_PPP_GATEWAY_ENABLED (AP_NETWORKING_BACKEND_CHIBIOS && AP_NETWORKING_BACKEND_PPP)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
the IP address given to the remote end of the PPP link when running
|
|
|
|
as a PPP<->ethernet gateway. If this is on the same subnet as the
|
|
|
|
ethernet interface IP then proxyarp will be used
|
|
|
|
*/
|
|
|
|
#ifndef AP_NETWORKING_REMOTE_PPP_IP
|
|
|
|
#define AP_NETWORKING_REMOTE_PPP_IP "0.0.0.0"
|
|
|
|
#endif
|
|
|
|
|
2024-01-24 00:43:53 -04:00
|
|
|
#ifndef AP_NETWORKING_REGISTER_PORT_ENABLED
|
|
|
|
#define AP_NETWORKING_REGISTER_PORT_ENABLED AP_NETWORKING_ENABLED && AP_SERIALMANAGER_REGISTER_ENABLED
|
|
|
|
#endif
|