README.md
1# ESP-NETIF architecture
2
3 | (A) USER CODE |
4 | |
5 .............| init settings events |
6 . +----------------------------------------+
7 . . | *
8 . . V *
9 --------+ +===========================+ * +-----------------------+
10 | | new/config get/set | * | |
11 | | |...*.....| init |
12 | |---------------------------| * | |
13 init | | |**** | |
14 start |********| event handler |*********| DHCP |
15 stop | | | | |
16 | |---------------------------| | |
17 | | | | NETIF |
18 +-----| | | +-----------------+ |
19 | glue|----<---| esp_netif_transmit |--<------| netif_output | |
20 | | | | | | |
21 | |---->---| esp_netif_receive |-->------| netif_input | |
22 | | | | + ----------------+ |
23 | |....<...| esp_netif_free_rx_buffer |...<.....| packet buffer |
24 +-----| | | | |
25 | | | | |
26 (B) | | | +-----------------------+
27 --------+ +===========================+
28 communication NETWORK STACK
29 DRIVER ESP-NETIF
30
31
32## Components:
33
34### A) User code, boiler plate
35Overall application interaction with communication media and network stack
36
37 * initialization code
38 - create a new instance of ESP-NETIF
39 - configure the object with
40 1) netif specific options (flags, behaviour, name)
41 2) network stack options (netif init and input functions, not publicly available)
42 3) IO driver specific options (transmit, tx_free functions, IO driver handle)
43 - setup event handlers
44 - use default handlers for common interfaces defined in IO drivers; or define a specific handlers
45 for customised behaviour/new interfaces
46 - register handlers for app related events (such as IP lost/acquired)
47 - interact with network interfaces using ESP-NETIF API
48
49### B) Communication driver, IO driver, media driver
50 * event handler
51 - define behaviour patterns of interaction with ESP-NETIF (example: ehternet link-up -> turn netif on)
52 * glue IO layer: adapt the input/output functions to use esp-netif transmit/input/free_rx
53 - install driver_transmit to appropriate ESP-NETIF object, so that outgoing packets from
54 network stack are passed to the IO driver
55 - calls esp_netif_receive to pass incoming data to network stack
56
57### C) ESP-NETIF, former tcpip_adapter
58* init API (new, configure)
59* IO API: for passing data between IO driver and network stack
60* event/action API (esp-netif lifecycle management)
61 - building blocks for designing event handlers
62* setters, getters
63* network stack abstraction: enabling user interaction with TCP/IP stack
64 - netif up/down
65 - DHCP server, client
66 - DNS API
67* driver conversion utilities
68
69### D) Network stack: no public interaction with user code (wrtt interfaces)
70
71
72## Data/event flow:
73
74* `........` Initialization line from user code to esp-netif and comm driver
75
76* `--<--->--` Data packets going from communication media to TCP/IP stack and back
77
78* `********` Events agregated in ESP-NETIP propagates to driver, user code and network stack
79
80* `|` User settings and runtime configuration
81
82