CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/AP_Bootloader/network.h
Views: 1798
1
/*
2
support for networking enabled bootloader
3
*/
4
5
#include "AP_Bootloader_config.h"
6
7
#if AP_BOOTLOADER_NETWORK_ENABLED
8
9
#include <hal.h>
10
11
class SocketAPM;
12
13
class BL_Network {
14
public:
15
void init(void);
16
void save_comms_ip(void);
17
void status_printf(const char *fmt, ...);
18
19
private:
20
struct netif *thisif;
21
thread_t *net_thread_ctx;
22
23
HAL_Semaphore web_delete_mtx;
24
thread_t *web_delete_list;
25
26
static void net_thread_trampoline(void*);
27
static void web_server_trampoline(void*);
28
29
void net_thread(void);
30
void web_server(void);
31
static void net_request_trampoline(void *);
32
void handle_request(SocketAPM *);
33
void handle_post(SocketAPM *, uint32_t content_length);
34
char *read_headers(SocketAPM *);
35
36
static void link_up_cb(void *p);
37
static void link_down_cb(void *p);
38
static int8_t low_level_output(struct netif *netif, struct pbuf *p);
39
static bool low_level_input(struct netif *netif, struct pbuf **pbuf);
40
static int8_t ethernetif_init(struct netif *netif);
41
42
static char *substitute_vars(const char *msg, uint32_t size);
43
static struct web_var {
44
const char *name;
45
const char *value;
46
} variables[];
47
48
struct {
49
uint32_t ip, gateway, netmask;
50
} addr;
51
52
bool need_reboot;
53
bool need_launch;
54
HAL_Semaphore status_mtx;
55
char bl_status[256];
56
57
};
58
59
#endif // AP_BOOTLOADER_NETWORK_ENABLED
60
61
62