Docs spelling

This commit is contained in:
Sergey Lyubka committed 2021-09-22 11:51:16 +01:00
1 parent 90a131bd29
commit ad3655fb92
1 file changed
+42 -42
+42 -42
View File
@@ -63,6 +63,13 @@ int main() {
receives data, closes connections and calls event handler functions for the receives data, closes connections and calls event handler functions for the
respective events. respective events.
Each connection has two event handler functions: `c->fn` and `c->pfn`. The
`c->fn` is a user-specified event handler function. The `c->pfn` is a
protocol-specific handler function that is set implicitly. For example, a
`mg_http_listen()` sets `c->pfn` to a Mongoose's HTTP event handler. A
protocol-specific handler is called before user-specific handler. It parses
incoming data and may invoke protocol-specific events like `MG_EV_HTTP_MSG`.
<span class="badge bg-danger">NOTE:</span> <span class="badge bg-danger">NOTE:</span>
Since the Mongoose's core is not protected against concurrent accesses, make Since the Mongoose's core is not protected against concurrent accesses, make
@@ -452,16 +459,9 @@ Perform a single poll iteration. For each connection in the `mgr->conns` list,
- If a connection is listening, accept an incoming connection if any, and send `MG_EV_ACCEPT` event to it - If a connection is listening, accept an incoming connection if any, and send `MG_EV_ACCEPT` event to it
- Send `MG_EV_POLL` event - Send `MG_EV_POLL` event
Each connection has two event handler functions: `c->fn` and `c->pfn`. The
`c->fn` is a user-specified event handler function. The `c->pfn` is a
protocol-specific handler function that is set implicitly. For example, a
`mg_http_listen()` sets `c->pfn` to a Mongoose's HTTP event handler. A
protocol-specific handler is called before user-specific handler. It parses
incoming data and may invoke protocol-specific events like `MG_EV_HTTP_MSG`.
Parameters: Parameters:
- `mgr` - event manager to use - `mgr` - an event manager to use
- `ms` - timeout (maximum time to block current thread), milliseconds - `ms` - a timeout in milliseconds
Return value: none Return value: none
@@ -480,7 +480,7 @@ void mg_mgr_free(struct mg_mgr *mgr);
Close all connections, and free all resources. Close all connections, and free all resources.
Parameters: Parameters:
- `mgr` - event manager to free - `mgr` - an event manager to cleanup
Return value: none Return value: none
@@ -503,8 +503,8 @@ struct mg_connection *mg_listen(struct mg_mgr *mgr, const char *url,
Create a listening connection, append this connection to `mgr->conns`. Create a listening connection, append this connection to `mgr->conns`.
Parameters: Parameters:
- `mgr` - event manager to use - `mgr` - an event manager to use
- `url` - specifies local IP address and port to listen on, e.g. - `url` - a URL. Specifies local IP address and port to listen on, e.g.
`tcp://127.0.0.1:1234` or `udp://0.0.0.0:9000` `tcp://127.0.0.1:1234` or `udp://0.0.0.0:9000`
- `fn` - an event handler function - `fn` - an event handler function
- `fn_data` - an arbitrary pointer, which will be passed as `fn_data` when an - `fn_data` - an arbitrary pointer, which will be passed as `fn_data` when an
@@ -529,8 +529,8 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *url,
Create an outbound connection, append this connection to `mgr->conns`. Create an outbound connection, append this connection to `mgr->conns`.
Parameters: Parameters:
- `mgr` - event manager to use - `mgr` - an event manager to use
- `url` - specifies remote IP address/port to connect to, e.g. `http://a.com` - `url` - a URL, specifies remote IP address/port to connect to, e.g. `http://a.com`
- `fn` - an event handler function - `fn` - an event handler function
- `fn_data` - an arbitrary pointer, which will be passed as `fn_data` when an - `fn_data` - an arbitrary pointer, which will be passed as `fn_data` when an
event handler is called. This pointer is also stored in a connection event handler is called. This pointer is also stored in a connection
@@ -562,9 +562,9 @@ the output buffer. The data is being sent when `mg_mgr_poll()` is called. If
`mg_send()` is called multiple times, the output buffer grows. `mg_send()` is called multiple times, the output buffer grows.
Parameters: Parameters:
- `c` - connection to use - `c` - a connection pointer
- `data` - data to append - `data` - a pointer to data to append to the send buffer
- `size` - size of data - `size` - a data size
Return value: `true` if data appended successfully and `false` otherwise Return value: `true` if data appended successfully and `false` otherwise
@@ -584,8 +584,8 @@ Same as `mg_send()`, but formats data using `printf()` semantics. Return
number of bytes appended to the output buffer. number of bytes appended to the output buffer.
Parameters: Parameters:
- `c` - connection to use - `c` - a connection pointer
- `fmt` - format string in `printf` semantics - `fmt` - a format string in `printf` semantics
Return value: number of bytes appended to the output buffer. Return value: number of bytes appended to the output buffer.
@@ -604,9 +604,9 @@ int mg_vprintf(struct mg_connection *, const char *fmt, va_list ap);
Same as `mg_printf()`, but takes `va_list` argument as a parameter. Same as `mg_printf()`, but takes `va_list` argument as a parameter.
Parameters: Parameters:
- `c` - connection to use - `c` - a connection pointer
- `fmt` - format string in `printf` semantics - `fmt` - a format string in `printf` semantics
- `ap` - arguments list - `ap` - an arguments list
Return value: number of bytes appended to the output buffer. Return value: number of bytes appended to the output buffer.
@@ -630,9 +630,9 @@ char *mg_straddr(struct mg_connection *c, char *buf, size_t len);
Write stringified IP address, associated with given connection to `buf` (maximum size `len`) Write stringified IP address, associated with given connection to `buf` (maximum size `len`)
Parameters: Parameters:
- `c` - connection to use - `c` - a connection pointer
- `buf` - buffer to write data - `buf` - a pointer to a buffer that will hold stringified address
- `len` - buffer (`buf`) size - `len` - a buffer size
Return value: `buf` value Return value: `buf` value
@@ -670,9 +670,9 @@ using `mg_mgr_wakeup()`. When an event manager is woken up, a pipe
connection event handler function receives `MG_EV_READ` event. connection event handler function receives `MG_EV_READ` event.
Parameters: Parameters:
- `mgr` - event manager to use - `mgr` - an event manager
- `fn` - pointer to event handler function - `fn` - a pointer to event handler function
- `ud` - user data, which will be passed to `fn` - `ud` - a user data pointer. It will be passed to `fn` as `fn_data` parameter
Return value: pointer to created connection or `NULL` in case of error Return value: pointer to created connection or `NULL` in case of error
@@ -734,8 +734,8 @@ struct mg_connection *mg_http_listen(struct mg_mgr *mgr, const char *url,
Create HTTP listener. Create HTTP listener.
Parameters: Parameters:
- `mgr` - event manager to use - `mgr` - an event manager
- `url` - specifies local IP address and port to listen on, e.g. `http://0.0.0.0:8000` - `url` - a URL, specifies local IP address and port to listen on, e.g. `http://0.0.0.0:8000`
- `fn` - an event handler function - `fn` - an event handler function
- `fn_data` - an arbitrary pointer, which will be passed as `fn_data` when an - `fn_data` - an arbitrary pointer, which will be passed as `fn_data` when an
event handler is called. This pointer is also stored in a connection event handler is called. This pointer is also stored in a connection
@@ -764,8 +764,8 @@ starts connect process. Once peer is really connected `MG_EV_CONNECT` event is
sent to connection event handler. sent to connection event handler.
Parameters: Parameters:
- `mgr` - event manager to use - `mgr` - an event manager
- `url` - specifies remote URL, e.g. `http://google.com` - `url` - a URL, specifies remote URL, e.g. `http://google.com`
- `fn` - an event handler function - `fn` - an event handler function
- `fn_data` - an arbitrary pointer, which will be passed as `fn_data` when an - `fn_data` - an arbitrary pointer, which will be passed as `fn_data` when an
event handler is called. This pointer is also stored in a connection event handler is called. This pointer is also stored in a connection
@@ -793,8 +793,8 @@ The length of request is a number of bytes till the end of HTTP headers. It does
not include length of HTTP body. not include length of HTTP body.
Parameters: Parameters:
- `buf` - pointer to buffer with request - `buf` - a pointer to a buffer with request
- `buf_len` - maximum request length - `buf_len` - buffer length
Return value: -1 on error, 0 if a message is incomplete, or the length of request. Return value: -1 on error, 0 if a message is incomplete, or the length of request.
@@ -816,9 +816,9 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm);
Parse string request into `mg_http_message` structure Parse string request into `mg_http_message` structure
Parameters: Parameters:
- `s` - request string - `s` - a request string
- `len` - maximum request length - `len` - a request string length
- `hm` - pointer to `mg_http_message` structure to receive result - `hm` - a pointer to a structure to store parsed request
Return value: request length (see `mg_http_get_request_len()`). Return value: request length (see `mg_http_get_request_len()`).
@@ -839,8 +839,8 @@ void mg_http_printf_chunk(struct mg_connection *c, const char *fmt, ...);
Write a chunk of data in chunked encoding format, using `printf()` semantic. Write a chunk of data in chunked encoding format, using `printf()` semantic.
Parameters: Parameters:
- `c` - connection to use - `c` - a connection pointer
- `fmt` - format string in `printf` semantics - `fmt` - a string, format specified in `printf` semantics
Return value: none Return value: none
@@ -859,9 +859,9 @@ void mg_http_write_chunk(struct mg_connection *c, const char *buf, size_t len);
Write a chunk of data in chunked encoding format. Write a chunk of data in chunked encoding format.
Parameters: Parameters:
- `c` - connection to use - `c` - a connection pointer
- `buf` - data to write - `buf` - data to write
- `len` - number of bytes to write - `len` - data length
Return value: none Return value: none
@@ -880,7 +880,7 @@ void mg_http_delete_chunk(struct mg_connection *c, struct mg_http_message *hm);
Remove chunk specified from input buffer. Remove chunk specified from input buffer.
Parameters: Parameters:
- `c` - connection to use - `c` - a connection pointer
- `hm` - chunk to delete - `hm` - chunk to delete
Return value: none Return value: none