mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-13 05:12:51 +08:00
move to new skeleton
This commit is contained in:
parent
4f15392440
commit
a0b6e70ff8
@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
@ -1 +0,0 @@
|
|||||||
../device-dashboard/net.c
|
|
@ -1 +0,0 @@
|
|||||||
../device-dashboard/net.h
|
|
@ -1 +0,0 @@
|
|||||||
../device-dashboard/packed_fs.c
|
|
@ -14,14 +14,14 @@ IPV6 ?= 1
|
|||||||
ASAN ?= -fsanitize=address,undefined,alignment -fno-sanitize-recover=all -fno-omit-frame-pointer -fno-common
|
ASAN ?= -fsanitize=address,undefined,alignment -fno-sanitize-recover=all -fno-omit-frame-pointer -fno-common
|
||||||
ASAN_OPTIONS ?= detect_leaks=1
|
ASAN_OPTIONS ?= detect_leaks=1
|
||||||
EXAMPLES := $(dir $(wildcard ../examples/*/Makefile))
|
EXAMPLES := $(dir $(wildcard ../examples/*/Makefile))
|
||||||
EXAMPLES_QUICK := $(filter-out ../examples/mip-pcap/ ../examples/micropython/, $(EXAMPLES))
|
EXAMPLES_QUICK := $(filter-out ../examples/micropython/, $(EXAMPLES))
|
||||||
EXAMPLES_MAC := $(filter-out ../examples/mip-pcap/ ../examples/mip-tap/ ../examples/micropython/, $(EXAMPLES))
|
EXAMPLES_MAC := $(filter-out ../examples/micropython/, $(EXAMPLES))
|
||||||
EXAMPLES_WIN := $(dir $(wildcard ../examples/device-dashboard/Makefile) $(wildcard ../examples/file-*/Makefile) $(wildcard ../examples/http-*/Makefile) $(wildcard ../examples/mqtt-*/Makefile) $(wildcard ../examples/websocket-*/Makefile) $(wildcard ../examples/webui-*/Makefile))
|
EXAMPLES_WIN := $(dir $(wildcard ../examples/device-dashboard/Makefile) $(wildcard ../examples/file-*/Makefile) $(wildcard ../examples/http-*/Makefile) $(wildcard ../examples/mqtt-*/Makefile) $(wildcard ../examples/websocket-*/Makefile) $(wildcard ../examples/webui-*/Makefile))
|
||||||
EXAMPLES_EMBEDDED := $(filter-out $(wildcard ../examples/zephyr/*/), $(dir $(wildcard ../examples/*/*/Makefile)))
|
EXAMPLES_EMBEDDED := $(filter-out $(wildcard ../examples/zephyr/*/), $(dir $(wildcard ../examples/*/*/Makefile)))
|
||||||
REFPROJS := $(dir $(wildcard ../reference-projects/windows-macos-linux/*/Makefile))
|
REFPROJS := $(dir $(wildcard ../reference-projects/windows-macos-linux/*/Makefile))
|
||||||
TUTORIALS := $(dir $(wildcard ../tutorials/*/*/Makefile))
|
TUTORIALS := $(dir $(wildcard ../tutorials/*/*/Makefile))
|
||||||
TUTORIALS_QUICK := $(filter-out ../tutorials/tcpip_stack/pcap/ , $(TUTORIALS))
|
TUTORIALS_QUICK := $(filter-out ../tutorials/tcpip/pcap-driver/ , $(TUTORIALS))
|
||||||
TUTORIALS_MAC := TUTORIALS
|
TUTORIALS_MAC := $(filter-out ../tutorials/tcpip/pcap-driver/ ../tutorials/tcpip/tap-driver/, $(TUTORIALS))
|
||||||
TUTORIALS_WIN := $(dir $(wildcard ../tutorials/http/file-*/Makefile) $(wildcard ../tutorials/http/http-*/Makefile) $(wildcard ../tutorials/mqtt/mqtt-*/Makefile) $(wildcard ../tutorials/websocket/websocket-*/Makefile) $(wildcard ../tutorials/webui/webui-*/Makefile))
|
TUTORIALS_WIN := $(dir $(wildcard ../tutorials/http/file-*/Makefile) $(wildcard ../tutorials/http/http-*/Makefile) $(wildcard ../tutorials/mqtt/mqtt-*/Makefile) $(wildcard ../tutorials/websocket/websocket-*/Makefile) $(wildcard ../tutorials/webui/webui-*/Makefile))
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
LIBDIR ?= $(PREFIX)/lib
|
LIBDIR ?= $(PREFIX)/lib
|
||||||
|
1
tutorials/tcpip/README.md
Normal file
1
tutorials/tcpip/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
See detailed tutorials at https://mongoose.ws/documentation/#drivers-for-mongoose-built-in-tcpip-stack
|
@ -41,10 +41,7 @@ $ sudo ifconfig bridge0 addm feth1
|
|||||||
We can start an example using the `feth0`:
|
We can start an example using the `feth0`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ make -C examples/mip-pcap/ clean all ARGS="-i feth0"
|
$ make -C tutorials/tcpip/pcap-driver/ clean all ARGS="-i feth0"
|
||||||
...
|
|
||||||
2386718 3 mip.c:279:arp_cache_add ARP cache: added 0xc0a80201 @ 36:77:4d:be:e0:80
|
|
||||||
2386718 2 mip.c:300:onstatechange READY, IP: 192.168.2.17
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The diagram of the setup is below:
|
The diagram of the setup is below:
|
||||||
@ -59,7 +56,7 @@ The diagram of the setup is below:
|
|||||||
┌─────────┐ │ └─────────┘ │ └────┬────┘
|
┌─────────┐ │ └─────────┘ │ └────┬────┘
|
||||||
│ en0 │ │ │ │
|
│ en0 │ │ │ │
|
||||||
└────┬────┘ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
|
└────┬────┘ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
|
||||||
│ │ │ en1 │ │ en2 │ │ en3 │ │ mip-pcap
|
│ │ │ en1 │ │ en2 │ │ en3 │ │ pcap-driver
|
||||||
│ └────┬────┘ └────┬────┘ └────┬────┘ │
|
│ └────┬────┘ └────┬────┘ └────┬────┘ │
|
||||||
WiFi │ │ │ │ │
|
WiFi │ │ │ │ │
|
||||||
└──────┼───────────┼───────────┼──────┘
|
└──────┼───────────┼───────────┼──────┘
|
||||||
@ -97,11 +94,11 @@ This is similar to using the loopback device, Mongoose is only reachable from th
|
|||||||
- Start your DHCP server at that interface serving that subnet, or otherwise configure Mongoose to use a fixed address within that subnet.
|
- Start your DHCP server at that interface serving that subnet, or otherwise configure Mongoose to use a fixed address within that subnet.
|
||||||
- Now start the example opening the other end of the virtual interface:
|
- Now start the example opening the other end of the virtual interface:
|
||||||
```sh
|
```sh
|
||||||
$ make -C examples/mip-pcap/ clean all ARGS="-i my0"
|
$ make -C tutorials/tcpip/pcap-driver/ clean all ARGS="-i my0"
|
||||||
```
|
```
|
||||||
- In some systems, you will probably need superuser privileges to open the device:
|
- In some systems, you will probably need superuser privileges to open the device:
|
||||||
```sh
|
```sh
|
||||||
$ sudo examples/mip-pcap/example -i my0
|
$ sudo tutorials/tcpip/pcap-driver/example -i my0
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -112,7 +109,7 @@ This is similar to using the loopback device, Mongoose is only reachable from th
|
|||||||
└─────────┘ └────┬────┘
|
└─────────┘ └────┬────┘
|
||||||
│
|
│
|
||||||
│
|
│
|
||||||
mip-pcap
|
pcap-driver
|
||||||
```
|
```
|
||||||
|
|
||||||
As you can't access any other host than your workstation, you need to add any required services (as DNS) there, and configure Mongoose appropriately. This is a foundation, you can expand it by choosing one of the solutions that follow.
|
As you can't access any other host than your workstation, you need to add any required services (as DNS) there, and configure Mongoose appropriately. This is a foundation, you can expand it by choosing one of the solutions that follow.
|
||||||
@ -144,11 +141,11 @@ We will attach one end of the virtual interface to a bridge, which will also be
|
|||||||
```
|
```
|
||||||
- Now start the example opening the other end of the virtual interface:
|
- Now start the example opening the other end of the virtual interface:
|
||||||
```sh
|
```sh
|
||||||
$ make -C examples/mip-pcap/ clean all ARGS="-i my0"
|
$ make -C tutorials/tcpip/pcap-driver/ clean all ARGS="-i my0"
|
||||||
```
|
```
|
||||||
- In some systems, you will probably need superuser privileges to open the device:
|
- In some systems, you will probably need superuser privileges to open the device:
|
||||||
```sh
|
```sh
|
||||||
$ sudo examples/mip-pcap/example -i my0
|
$ sudo tutorials/tcpip/pcap-driver/example -i my0
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -162,7 +159,7 @@ We will attach one end of the virtual interface to a bridge, which will also be
|
|||||||
│ └─────────┘ │ └────┬────┘
|
│ └─────────┘ │ └────┬────┘
|
||||||
│ │ │
|
│ │ │
|
||||||
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
|
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
|
||||||
│ │ vnet1 │ │ enp9s0 │ │ vnet2 │ │ mip-pcap
|
│ │ vnet1 │ │ enp9s0 │ │ vnet2 │ │ pcap-driver
|
||||||
│ └────┬────┘ └────┬────┘ └────┬────┘ │
|
│ └────┬────┘ └────┬────┘ └────┬────┘ │
|
||||||
│ │ │ │ │
|
│ │ │ │ │
|
||||||
└──────┼───────────┼───────────┼──────┘
|
└──────┼───────────┼───────────┼──────┘
|
||||||
@ -189,11 +186,11 @@ Once you have your virtual interface up and running with an IP address, you can
|
|||||||
Remember to use the proper network interface name
|
Remember to use the proper network interface name
|
||||||
- Now start the example opening the other end of the virtual interface:
|
- Now start the example opening the other end of the virtual interface:
|
||||||
```sh
|
```sh
|
||||||
$ make -C examples/mip-pcap/ clean all ARGS="-i my0"
|
$ make -C tutorials/tcpip/pcap-driver/ clean all ARGS="-i my0"
|
||||||
```
|
```
|
||||||
- In some systems, you will probably need superuser privileges to open the device:
|
- In some systems, you will probably need superuser privileges to open the device:
|
||||||
```sh
|
```sh
|
||||||
$ sudo examples/mip-pcap/example -i my0
|
$ sudo tutorials/tcpip/pcap-driver/example -i my0
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -204,7 +201,7 @@ Once you have your virtual interface up and running with an IP address, you can
|
|||||||
│ └─────────┘ └────┬────┘
|
│ └─────────┘ └────┬────┘
|
||||||
▼ │
|
▼ │
|
||||||
Your IP (LAN / Public) │
|
Your IP (LAN / Public) │
|
||||||
┌─────────┐ mip-pcap
|
┌─────────┐ pcap-driver
|
||||||
│ enp9s0 │
|
│ enp9s0 │
|
||||||
└────┬────┘
|
└────┬────┘
|
||||||
│
|
│
|
||||||
@ -231,7 +228,7 @@ You can also use this setup if your NIC is part of a bridge (for example: you ha
|
|||||||
│ └─────────┘ └────┬────┘
|
│ └─────────┘ └────┬────┘
|
||||||
┌──────────────────┴──────────────────┐ │
|
┌──────────────────┴──────────────────┐ │
|
||||||
│ │ │
|
│ │ │
|
||||||
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ mip-pcap
|
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ pcap-driver
|
||||||
│ │ vnet1 │ │ enp9s0 │ │ vnet2 │ │
|
│ │ vnet1 │ │ enp9s0 │ │ vnet2 │ │
|
||||||
│ └────┬────┘ └────┬────┘ └────┬────┘ │
|
│ └────┬────┘ └────┬────┘ └────┬────┘ │
|
||||||
│ │ │ │ │
|
│ │ │ │ │
|
1
tutorials/tcpip/pcap-driver/mongoose.c
Symbolic link
1
tutorials/tcpip/pcap-driver/mongoose.c
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../mongoose.c
|
1
tutorials/tcpip/pcap-driver/mongoose.h
Symbolic link
1
tutorials/tcpip/pcap-driver/mongoose.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../mongoose.h
|
@ -26,15 +26,15 @@ In this scenario, Mongoose is only reachable from the hosting machine, but you c
|
|||||||
- Start your DHCP server at that interface serving that subnet, or otherwise configure Mongoose to use a fixed address within that subnet.
|
- Start your DHCP server at that interface serving that subnet, or otherwise configure Mongoose to use a fixed address within that subnet.
|
||||||
- Now start the example opening the very same TAP interface:
|
- Now start the example opening the very same TAP interface:
|
||||||
```sh
|
```sh
|
||||||
$ make -C examples/mip-tap/ clean all
|
$ make -C tutorials/tcpip/tap-driver/ clean all
|
||||||
```
|
```
|
||||||
If you are using a different interface name than `tap0`, add `ARGS="-i ifcname"`, and use the proper interface name
|
If you are using a different interface name than `tap0`, add `ARGS="-i ifcname"`, and use the proper interface name
|
||||||
|
|
||||||
```
|
```
|
||||||
[DHCP server for 192.168.0.x]
|
[DHCP server for 192.168.0.x]
|
||||||
192.168.0.1 192.168.0.x
|
192.168.0.1 192.168.0.x
|
||||||
┌─────────┐
|
┌─────────┐
|
||||||
│ tap0 ├──────────────────── mip-tap
|
│ tap0 ├──────────────────── tap-driver
|
||||||
└─────────┘
|
└─────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ We will attach one end of the virtual interface to a bridge, which will also be
|
|||||||
```
|
```
|
||||||
- Now start the example
|
- Now start the example
|
||||||
```sh
|
```sh
|
||||||
$ make -C examples/mip-tap/ clean all
|
$ make -C tutorials/tcpip/tap-driver/ clean all
|
||||||
```
|
```
|
||||||
If you are using a different interface name than `tap0`, add `ARGS="-i ifcname"`, and use the proper interface name
|
If you are using a different interface name than `tap0`, add `ARGS="-i ifcname"`, and use the proper interface name
|
||||||
- Now if everything is fine, besides the example working, you'll see your interface state is UP:
|
- Now if everything is fine, besides the example working, you'll see your interface state is UP:
|
||||||
@ -86,9 +86,9 @@ We will attach one end of the virtual interface to a bridge, which will also be
|
|||||||
virbr0
|
virbr0
|
||||||
│
|
│
|
||||||
┌──────────────────┴──────────────────┐
|
┌──────────────────┴──────────────────┐
|
||||||
│ │ 10.1.0.x
|
│ │ 10.1.0.x
|
||||||
│ ┌────────┐ │
|
│ ┌────────┐ │
|
||||||
│ │ tap0 ├─────────────┼─────── mip-tap
|
│ │ tap0 ├─────────────┼─────── tap-driver
|
||||||
│ └────────┘ │
|
│ └────────┘ │
|
||||||
│ │
|
│ │
|
||||||
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
||||||
@ -119,15 +119,15 @@ Once you have your virtual interface up and running with an IP address, you can
|
|||||||
Remember to use the proper network interface name
|
Remember to use the proper network interface name
|
||||||
- Now start the example
|
- Now start the example
|
||||||
```sh
|
```sh
|
||||||
$ make -C examples/mip-tap/ clean all
|
$ make -C tutorials/tcpip/tap-driver/ clean all
|
||||||
```
|
```
|
||||||
If you are using a different interface name than `tap0`, add `ARGS="-i ifcname"`, and use the proper interface name
|
If you are using a different interface name than `tap0`, add `ARGS="-i ifcname"`, and use the proper interface name
|
||||||
|
|
||||||
```
|
```
|
||||||
[DHCP server for 192.168.0.x]
|
[DHCP server for 192.168.0.x]
|
||||||
┌────────────► 192.168.0.1 192.168.0.x
|
┌────────────► 192.168.0.1 192.168.0.x
|
||||||
│ forwarding ┌─────────┐
|
│ forwarding ┌─────────┐
|
||||||
│ masquerading │ tap0 ├──────────────────── mip-tap
|
│ masquerading │ tap0 ├──────────────────── tap-driver
|
||||||
│ └─────────┘
|
│ └─────────┘
|
||||||
▼
|
▼
|
||||||
Your IP (LAN / Public)
|
Your IP (LAN / Public)
|
||||||
@ -154,7 +154,7 @@ You can also use this setup if your NIC is part of a bridge (for example: you ha
|
|||||||
[DHCP server for 192.168.0.x]
|
[DHCP server for 192.168.0.x]
|
||||||
10.1.0.10 ◀──────────────► 192.168.0.1 192.168.0.x
|
10.1.0.10 ◀──────────────► 192.168.0.1 192.168.0.x
|
||||||
virbr0 forwarding ┌─────────┐
|
virbr0 forwarding ┌─────────┐
|
||||||
│ masquerading │ tap0 ├──────────────────── mip-tap
|
│ masquerading │ tap0 ├──────────────────── tap-driver
|
||||||
│ └─────────┘
|
│ └─────────┘
|
||||||
┌──────────────────┴──────────────────┐
|
┌──────────────────┴──────────────────┐
|
||||||
│ │
|
│ │
|
1
tutorials/tcpip/tap-driver/mongoose.c
Symbolic link
1
tutorials/tcpip/tap-driver/mongoose.c
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../mongoose.c
|
1
tutorials/tcpip/tap-driver/mongoose.h
Symbolic link
1
tutorials/tcpip/tap-driver/mongoose.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../mongoose.h
|
1
tutorials/tcpip/tap-driver/net.c
Symbolic link
1
tutorials/tcpip/tap-driver/net.c
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../examples/device-dashboard/net.c
|
1
tutorials/tcpip/tap-driver/net.h
Symbolic link
1
tutorials/tcpip/tap-driver/net.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../examples/device-dashboard/net.h
|
1
tutorials/tcpip/tap-driver/packed_fs.c
Symbolic link
1
tutorials/tcpip/tap-driver/packed_fs.c
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../examples/device-dashboard/packed_fs.c
|
@ -1 +0,0 @@
|
|||||||
See detailed tutorials at https://mongoose.ws/documentation/#tcpip-stack
|
|
Loading…
Reference in New Issue
Block a user