aboutsummaryrefslogtreecommitdiff
path: root/src/menu/privinc/menu_net.h
blob: 19809172b18e1a513963aeab352a38d48dff7da0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef MENU_NETCFG_H
#define MENU_NETCFG_H

#include <gui.h>
#include <gui/button.h>
#include <gui/checkbox.h>
#include <gui/container.h>
#include <gui/label.h>
#include <gui/line_edit.h>
#include <net.h>
#include <stdbool.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C"
{
#endif

struct menu_net_gui
{
    char device[32], address[32], port[sizeof "65535"];
    bool update_domain;
    struct gui_container cnt;
    struct gui_label type;
    struct gui_button type_btn;
    enum net_domain domain;

    union
    {
        struct gui_container cnt;

        struct menu_ipv4_gui
        {
            struct gui_container cnt, relay_cnt, announce_cnt;
            struct gui_button next_page_btn;
            struct gui_label address, port, relay, announce;
            struct gui_line_edit address_le, port_le, announce_le;
            struct gui_checkbox relay_ch, announce_ch;
        } ipv4;

        struct menu_serial_gui
        {
            struct gui_container cnt, hw_ctrl_cnt;
            struct gui_label device, speed, hw_ctrl;
            struct gui_button speed_btn;
            struct gui_line_edit device_le;
            struct gui_checkbox hw_ctrl_ch;
            size_t speed_i;
        } serial;
    } gui;
};

int menu_net_gui_init(struct menu_net_gui *m);
void menu_net_gui_update(struct menu_net_gui *m);
int menu_net_server(const struct menu_net_gui *m, union net_server *s);
int menu_net_connect(const struct menu_net_gui *m, union net_connect *c);

#ifdef __cplusplus
}
#endif

#endif /* MENU_NETCFG_H */