Add diagrams

This commit is contained in:
cpq 2022-12-21 11:18:50 +00:00
parent 92aa538a84
commit 3dd8d7d8e5
3 changed files with 37 additions and 19 deletions

View File

@ -256,6 +256,18 @@ struct mg_connection {
By default, IO buffer allocation size `MG_IO_SIZE` is 2048: change it to 512
to trim run-time per-connection memory consumption.
## Architecture diagram
In the Operating System environment, Mongoose uses BSD sockets API provided
by the OS's TCP/IP stack:
![](images/arch2.svg)
In the embedded bare metal environment, Mongoose can utilise its own built-in
stack with network drivers - i.e. it can run directly on top of the hardware:
![](images/arch1.svg)
## Build options
Mongoose source code ships in two files:
@ -355,7 +367,6 @@ systems, follow the outline below:
are relevant to your platform. Mongoose uses `bool` type, `MG_DIRSEP` define,
and optionally other structures like `DIR *` depending on the functionality
you have enabled - see previous section. Below is an example:
```c
#include <stdbool.h>
#include <stdarg.h>
@ -363,11 +374,10 @@ you have enabled - see previous section. Below is an example:
#define MG_DIRSEP '/'
#define MG_INT64_FMT "%lld"
```
You can also add
You can also add a `MG_ARCH` definition:
```c
#define MG_ARCH MG_ARCH_CUSTOM
```
To this file, instead of adding build flags.
3. This step is optional, and only required if you intend to use a custom
TCP/IP stack. To do that, you should:
* Disable BSD socket API: in the `mongoose_custom.h`, add

4
docs/images/arch1.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 164 KiB

4
docs/images/arch2.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 158 KiB