mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-25 11:39:01 +08:00
Remove extra error message
PUBLISHED_FROM=8b7fcfc1bc32ff9ff38e2904ddb730c83bf9fae4
This commit is contained in:
parent
53ed8502c9
commit
e406de7e00
@ -8,6 +8,6 @@ signature: |
|
||||
size_t len);
|
||||
---
|
||||
|
||||
Adds a new option to mg_coap_message structure.
|
||||
Add new option to mg_coap_message structure.
|
||||
Returns pointer to the newly created option.
|
||||
|
||||
|
@ -6,6 +6,6 @@ signature: |
|
||||
void mg_coap_free_options(struct mg_coap_message *cm);
|
||||
---
|
||||
|
||||
Frees the memory allocated for options.
|
||||
If the cm paramater doesn't contain any option it does nothing.
|
||||
Free the memory allocated for options,
|
||||
if cm paramater doesn't contain any option does nothing.
|
||||
|
||||
|
@ -6,13 +6,13 @@ signature: |
|
||||
uint32_t mg_coap_parse(struct mbuf *io, struct mg_coap_message *cm);
|
||||
---
|
||||
|
||||
Parses CoAP message and fills mg_coap_message and returns cm->flags.
|
||||
Parse COAP message and fills mg_coap_message and returns cm->flags.
|
||||
This is a helper function.
|
||||
|
||||
NOTE: usually CoAP works over UDP, so lack of data means format error.
|
||||
But, in theory, it is possible to use CoAP over TCP (according to RFC)
|
||||
NOTE: usually CoAP work over UDP, so lack of data means format error,
|
||||
but in theory it is possible to use CoAP over TCP (according to RFC)
|
||||
|
||||
The caller has to check results and treat COAP_NOT_ENOUGH_DATA according to
|
||||
The caller have to check results and treat COAP_NOT_ENOUGH_DATA according to
|
||||
underlying protocol:
|
||||
|
||||
- in case of UDP COAP_NOT_ENOUGH_DATA means COAP_FORMAT_ERROR,
|
||||
|
@ -6,7 +6,7 @@ signature: |
|
||||
uint32_t mg_coap_send_ack(struct mg_connection *nc, uint16_t msg_id);
|
||||
---
|
||||
|
||||
Composes CoAP acknowledgement from `mg_coap_message`
|
||||
and sends it into `nc` connection.
|
||||
Compose CoAP acknowledgement from `mg_coap_message`
|
||||
and send it into `nc` connection.
|
||||
Return value: see `mg_coap_send_message()`
|
||||
|
||||
|
@ -7,9 +7,9 @@ signature: |
|
||||
struct mg_coap_message *cm);
|
||||
---
|
||||
|
||||
Composes a CoAP message from `mg_coap_message`
|
||||
and sends it into `nc` connection.
|
||||
Returns 0 on success. On error, it is a bitmask:
|
||||
Compose CoAP message from `mg_coap_message`
|
||||
and send it into `nc` connection.
|
||||
Return 0 on success. On error, it is a bitmask:
|
||||
|
||||
- `#define MG_COAP_ERROR 0x10000`
|
||||
- `#define MG_COAP_FORMAT_ERROR (MG_COAP_ERROR | 0x20000)`
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
int mg_set_protocol_coap(struct mg_connection *nc);
|
||||
---
|
||||
|
||||
Sets CoAP protocol handler - triggers CoAP specific events.
|
||||
Set CoAP protocol handler - trigger CoAP specific events
|
||||
|
||||
|
@ -7,18 +7,18 @@ signature: |
|
||||
struct mg_dns_message *msg);
|
||||
---
|
||||
|
||||
Creates a DNS reply.
|
||||
Create a DNS reply.
|
||||
|
||||
The reply will be based on an existing query message `msg`.
|
||||
The query body will be appended to the output buffer.
|
||||
"reply + recursion allowed" will be added to the message flags and the
|
||||
"reply + recursion allowed" will be added to the message flags and
|
||||
message's num_answers will be set to 0.
|
||||
|
||||
Answer records can be appended with `mg_dns_send_reply` or by lower
|
||||
level function defined in the DNS API.
|
||||
|
||||
In order to send a reply use `mg_dns_send_reply`.
|
||||
It's possible to use a connection's send buffer as reply buffer,
|
||||
In order to send the reply use `mg_dns_send_reply`.
|
||||
It's possible to use a connection's send buffer as reply buffers,
|
||||
and it will work for both UDP and TCP connections.
|
||||
|
||||
Example:
|
||||
|
@ -9,10 +9,10 @@ signature: |
|
||||
size_t rdata_len);
|
||||
---
|
||||
|
||||
Appends a DNS reply record to the IO buffer and to the DNS message.
|
||||
Append a DNS reply record to the IO buffer and to the DNS message.
|
||||
|
||||
The message's num_answers field will be incremented. It's the caller's duty
|
||||
to ensure num_answers is properly initialised.
|
||||
The message num_answers field will be incremented. It's caller's duty
|
||||
to ensure num_answers is propertly initialized.
|
||||
|
||||
Returns -1 on error.
|
||||
|
||||
|
@ -6,11 +6,11 @@ signature: |
|
||||
void mg_dns_send_reply(struct mg_connection *nc, struct mg_dns_reply *r);
|
||||
---
|
||||
|
||||
Sends a DNS reply through a connection.
|
||||
Send a DNS reply through a connection.
|
||||
|
||||
The DNS data is stored in an IO buffer pointed by reply structure in `r`.
|
||||
This function mutates the content of that buffer in order to ensure that
|
||||
the DNS header reflects the size and flags of the message, that might have been
|
||||
the DNS header reflects size and flags of the mssage, that might have been
|
||||
updated either with `mg_dns_reply_record` or by direct manipulation of
|
||||
`r->message`.
|
||||
|
||||
|
@ -6,10 +6,10 @@ signature: |
|
||||
int mg_dns_copy_questions(struct mbuf *io, struct mg_dns_message *msg);
|
||||
---
|
||||
|
||||
Appends already encoded questions from an existing message.
|
||||
Append already encoded questions from an existing message.
|
||||
|
||||
This is useful when generating a DNS reply message which includes
|
||||
all question records.
|
||||
|
||||
Returns the number of appened bytes.
|
||||
Return number of appened bytes.
|
||||
|
||||
|
@ -8,11 +8,11 @@ signature: |
|
||||
size_t rlen);
|
||||
---
|
||||
|
||||
Encodes and appends a DNS resource record to an IO buffer.
|
||||
Encode and append a DNS resource record to an IO buffer.
|
||||
|
||||
The record metadata is taken from the `rr` parameter, while the name and data
|
||||
are taken from the parameters, encoded in the appropriate format depending on
|
||||
record type and stored in the IO buffer. The encoded values might contain
|
||||
record type, and stored in the IO buffer. The encoded values might contain
|
||||
offsets within the IO buffer. It's thus important that the IO buffer doesn't
|
||||
get trimmed while a sequence of records are encoded while preparing a DNS
|
||||
*reply.
|
||||
@ -21,5 +21,5 @@ This function doesn't update the `name` and `rdata` pointers in the `rr`
|
||||
*struct
|
||||
because they might be invalidated as soon as the IO buffer grows again.
|
||||
|
||||
Returns the number of bytes appened or -1 in case of error.
|
||||
Return the number of bytes appened or -1 in case of error.
|
||||
|
||||
|
@ -7,7 +7,7 @@ signature: |
|
||||
struct mg_dns_message *msg);
|
||||
---
|
||||
|
||||
Inserts a DNS header to an IO buffer.
|
||||
Insert a DNS header to an IO buffer.
|
||||
|
||||
Returns the number of bytes inserted.
|
||||
Return number of bytes inserted.
|
||||
|
||||
|
@ -8,7 +8,7 @@ signature: |
|
||||
size_t data_len);
|
||||
---
|
||||
|
||||
Parses the record data from a DNS resource record.
|
||||
Parse the record data from a DNS resource record.
|
||||
|
||||
- A: struct in_addr *ina
|
||||
- AAAA: struct in6_addr *ina
|
||||
|
@ -7,15 +7,15 @@ signature: |
|
||||
char *dst, int dst_len);
|
||||
---
|
||||
|
||||
Uncompresses a DNS compressed name.
|
||||
Uncompress a DNS compressed name.
|
||||
|
||||
The containing DNS message is required because of the compressed encoding
|
||||
The containing dns message is required because the compressed encoding
|
||||
and reference suffixes present elsewhere in the packet.
|
||||
|
||||
If the name is less than `dst_len` characters long, the remainder
|
||||
of `dst` is terminated with `\0` characters. Otherwise, `dst` is not
|
||||
If name is less than `dst_len` characters long, the remainder
|
||||
of `dst` is terminated with `\0' characters. Otherwise, `dst` is not
|
||||
*terminated.
|
||||
|
||||
If `dst_len` is 0 `dst` can be NULL.
|
||||
Returns the uncompressed name length.
|
||||
Return the uncompressed name length.
|
||||
|
||||
|
@ -7,5 +7,5 @@ signature: |
|
||||
int query_type);
|
||||
---
|
||||
|
||||
Sends a DNS query to the remote end.
|
||||
Send a DNS query to the remote end.
|
||||
|
||||
|
@ -6,11 +6,11 @@ signature: |
|
||||
void mg_set_protocol_dns(struct mg_connection *nc);
|
||||
---
|
||||
|
||||
Attaches a built-in DNS event handler to the given listening connection.
|
||||
Attach built-in DNS event handler to the given listening connection.
|
||||
|
||||
The DNS event handler parses the incoming UDP packets, treating them as DNS
|
||||
requests. If an incoming packet gets successfully parsed by the DNS event
|
||||
handler, a user event handler will receive an `MG_DNS_REQUEST` event, with
|
||||
DNS event handler parses incoming UDP packets, treating them as DNS
|
||||
requests. If incoming packet gets successfully parsed by the DNS event
|
||||
handler, a user event handler will receive `MG_DNS_REQUEST` event, with
|
||||
`ev_data` pointing to the parsed `struct mg_dns_message`.
|
||||
|
||||
See
|
||||
|
@ -6,9 +6,9 @@ signature: |
|
||||
void mg_mqtt_broker(struct mg_connection *brk, int ev, void *data);
|
||||
---
|
||||
|
||||
Processes a MQTT broker message.
|
||||
Process a MQTT broker message.
|
||||
|
||||
The listening connection expects a pointer to an initialised `mg_mqtt_broker`
|
||||
Listening connection expects a pointer to an initialized `mg_mqtt_broker`
|
||||
structure in the `user_data` field.
|
||||
|
||||
Basic usage:
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_broker_init(struct mg_mqtt_broker *brk, void *user_data);
|
||||
---
|
||||
|
||||
Initialises a MQTT broker.
|
||||
Initialize a MQTT broker.
|
||||
|
||||
|
@ -7,7 +7,7 @@ signature: |
|
||||
struct mg_mqtt_session *s);
|
||||
---
|
||||
|
||||
Iterates over all MQTT session connections. Example:
|
||||
Iterate over all mqtt sessions connections. Example:
|
||||
|
||||
```c
|
||||
struct mg_mqtt_session *s;
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_connack(struct mg_connection *nc, uint8_t return_code);
|
||||
---
|
||||
|
||||
Sends a CONNACK command with a given `return_code`.
|
||||
Send a CONNACK command with a given `return_code`.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_disconnect(struct mg_connection *nc);
|
||||
---
|
||||
|
||||
Sends a DISCONNECT command.
|
||||
Send a DISCONNECT command.
|
||||
|
||||
|
@ -7,9 +7,9 @@ signature: |
|
||||
struct mg_str *topic, uint8_t *qos, int pos);
|
||||
---
|
||||
|
||||
Extracts the next topic expression from a SUBSCRIBE command payload.
|
||||
Extract the next topic expression from a SUBSCRIBE command payload.
|
||||
|
||||
The topic expression name will point to a string in the payload buffer.
|
||||
Returns the pos of the next topic expression or -1 when the list
|
||||
Topic expression name will point to a string in the payload buffer.
|
||||
Return the pos of the next topic expression or -1 when the list
|
||||
of topics is exhausted.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_ping(struct mg_connection *nc);
|
||||
---
|
||||
|
||||
Sends a PINGREQ command.
|
||||
Send a PINGREQ command.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_pong(struct mg_connection *nc);
|
||||
---
|
||||
|
||||
Sends a PINGRESP command.
|
||||
Send a PINGRESP command.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_puback(struct mg_connection *nc, uint16_t message_id);
|
||||
---
|
||||
|
||||
Sends a PUBACK command with a given `message_id`.
|
||||
Send a PUBACK command with a given `message_id`.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_pubcomp(struct mg_connection *nc, uint16_t message_id);
|
||||
---
|
||||
|
||||
Sends a PUBCOMP command with a given `message_id`.
|
||||
Send a PUBCOMP command with a given `message_id`.
|
||||
|
||||
|
@ -8,5 +8,5 @@ signature: |
|
||||
size_t len);
|
||||
---
|
||||
|
||||
Publishes a message to a given topic.
|
||||
Publish a message to a given topic.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_pubrec(struct mg_connection *nc, uint16_t message_id);
|
||||
---
|
||||
|
||||
Sends a PUBREC command with a given `message_id`.
|
||||
Send a PUBREC command with a given `message_id`.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_pubrel(struct mg_connection *nc, uint16_t message_id);
|
||||
---
|
||||
|
||||
Sends a PUBREL command with a given `message_id`.
|
||||
Send a PUBREL command with a given `message_id`.
|
||||
|
||||
|
@ -7,6 +7,6 @@ signature: |
|
||||
uint16_t message_id);
|
||||
---
|
||||
|
||||
Sends a SUBACK command with a given `message_id`
|
||||
Send a SUBACK command with a given `message_id`
|
||||
and a sequence of granted QoSs.
|
||||
|
||||
|
@ -8,5 +8,5 @@ signature: |
|
||||
size_t topics_len, uint16_t message_id);
|
||||
---
|
||||
|
||||
Subscribes to a bunch of topics.
|
||||
Subscribe to a bunch of topics.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_mqtt_unsuback(struct mg_connection *nc, uint16_t message_id);
|
||||
---
|
||||
|
||||
Sends a UNSUBACK command with a given `message_id`.
|
||||
Send a UNSUBACK command with a given `message_id`.
|
||||
|
||||
|
@ -7,5 +7,5 @@ signature: |
|
||||
size_t topics_len, uint16_t message_id);
|
||||
---
|
||||
|
||||
Unsubscribes from a bunch of topics.
|
||||
Unsubscribe from a bunch of topics.
|
||||
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
void mg_send_mqtt_handshake(struct mg_connection *nc, const char *client_id);
|
||||
---
|
||||
|
||||
Sends an MQTT handshake.
|
||||
Send MQTT handshake.
|
||||
|
||||
|
@ -7,5 +7,5 @@ signature: |
|
||||
struct mg_send_mqtt_handshake_opts);
|
||||
---
|
||||
|
||||
Sends an MQTT handshake with optional parameters.
|
||||
Send MQTT handshake with optional parameters.
|
||||
|
||||
|
@ -6,7 +6,7 @@ signature: |
|
||||
void mg_set_protocol_mqtt(struct mg_connection *nc);
|
||||
---
|
||||
|
||||
Attaches a built-in MQTT event handler to the given connection.
|
||||
Attach built-in MQTT event handler to the given connection.
|
||||
|
||||
The user-defined event handler will receive following extra events:
|
||||
|
||||
|
@ -6,9 +6,9 @@ signature: |
|
||||
int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap);
|
||||
---
|
||||
|
||||
Prints message to the buffer. If the buffer is large enough to hold the message,
|
||||
it returns buffer. If buffer is to small, it allocates a large enough buffer on heap
|
||||
and returns allocated buffer.
|
||||
Print message to buffer. If buffer is large enough to hold the message,
|
||||
return buffer. If buffer is to small, allocate large enough buffer on heap,
|
||||
and return allocated buffer.
|
||||
This is a supposed use case:
|
||||
|
||||
char buf[5], *p = buf;
|
||||
|
@ -6,11 +6,11 @@ signature: |
|
||||
int mg_base64_decode(const unsigned char *s, int len, char *dst);
|
||||
---
|
||||
|
||||
Decodes base64-encoded string `s`, `len` into the destination `dst`.
|
||||
The destination has to have enough space to hold the decoded buffer.
|
||||
Decoding stops either when all strings have been decoded or invalid an
|
||||
Decode base64-encoded string `s`, `len` into the destination `dst`.
|
||||
Destination has to have enough space to hold decoded buffer.
|
||||
Decoding stops either when all string has been decoded, or invalid
|
||||
character appeared.
|
||||
Destination is '\0'-terminated.
|
||||
Returns the number of decoded characters. On success, that should be equal to
|
||||
Return number of decoded characters. On success, that should be equal to
|
||||
`len`. On error (invalid character) the return value is smaller then `len`.
|
||||
|
||||
|
@ -7,9 +7,9 @@ signature: |
|
||||
int flags);
|
||||
---
|
||||
|
||||
Converts a connection's local or remote address into string.
|
||||
Convert connection's local or remote address into string.
|
||||
|
||||
The `flags` parameter is a bit mask that controls the behaviour;
|
||||
The `flags` parameter is a bit mask that controls the behavior,
|
||||
see `MG_SOCK_STRINGIFY_*` definitions.
|
||||
|
||||
- MG_SOCK_STRINGIFY_IP - print IP address
|
||||
|
@ -6,7 +6,7 @@ signature: |
|
||||
FILE *mg_fopen(const char *path, const char *mode);
|
||||
---
|
||||
|
||||
Opens the given file and returns a file stream.
|
||||
Open the given file and return a file stream.
|
||||
|
||||
`path` and `mode` should be UTF8 encoded.
|
||||
|
||||
|
@ -6,10 +6,10 @@ signature: |
|
||||
int mg_hexdump(const void *buf, int len, char *dst, int dst_len);
|
||||
---
|
||||
|
||||
Generates a human-readable hexdump of memory chunk.
|
||||
Generates human-readable hexdump of memory chunk.
|
||||
|
||||
Takes a memory buffer `buf` of length `len` and creates a hex dump of that
|
||||
buffer in `dst`. The generated output is a-la hexdump(1).
|
||||
Returns the length of generated string, excluding terminating `\0`. If returned
|
||||
length is bigger than `dst_len`, the overflow bytes are discarded.
|
||||
buffer in `dst`. Generated output is a-la hexdump(1).
|
||||
Return length of generated string, excluding terminating `\0`. If returned
|
||||
length is bigger than `dst_len`, overflow bytes are discarded.
|
||||
|
||||
|
@ -7,7 +7,7 @@ signature: |
|
||||
const void *buf, int num_bytes, int ev);
|
||||
---
|
||||
|
||||
Generates human-readable hexdump of the data sent or received by the connection.
|
||||
Generates human-readable hexdump of the data sent or received by connection.
|
||||
`path` is a file name where hexdump should be written. `num_bytes` is
|
||||
a number of bytes sent/received. `ev` is one of the `MG_*` events sent to
|
||||
an event handler. This function is supposed to be called from the
|
||||
|
@ -6,5 +6,5 @@ signature: |
|
||||
int mg_is_big_endian(void);
|
||||
---
|
||||
|
||||
Returns true if the target platform is big endian.
|
||||
Return true if target platform is big endian.
|
||||
|
||||
|
@ -6,7 +6,7 @@ signature: |
|
||||
int mg_open(const char *path, int flag, int mode);
|
||||
---
|
||||
|
||||
Opens the given file and returns a file stream.
|
||||
Open the given file and return a file stream.
|
||||
|
||||
`path` should be UTF8 encoded.
|
||||
|
||||
|
@ -7,11 +7,11 @@ signature: |
|
||||
const char *delimiters, struct mg_str *v);
|
||||
---
|
||||
|
||||
Fetches substring from input string `s`, `end` into `v`.
|
||||
Fetch substring from input string `s`, `end` into `v`.
|
||||
Skips initial delimiter characters. Records first non-delimiter character
|
||||
at the beginning of substring `v`. Then scans the rest of the string
|
||||
as the beginning of substring `v`. Then scans the rest of the string
|
||||
until a delimiter character or end-of-string is found.
|
||||
`delimiters` is a 0-terminated string containing delimiter characters.
|
||||
Either one of `delimiters` or `end_string` terminates the search.
|
||||
Returns an `s` pointer, advanced forward where parsing has stopped.
|
||||
Return an `s` pointer, advanced forward where parsing stopped.
|
||||
|
||||
|
@ -7,7 +7,7 @@ signature: |
|
||||
int flags);
|
||||
---
|
||||
|
||||
Converts the socket's address into string.
|
||||
Convert socket's address into string.
|
||||
|
||||
`flags` is MG_SOCK_STRINGIFY_IP and/or MG_SOCK_STRINGIFY_PORT.
|
||||
|
||||
|
@ -6,8 +6,8 @@ signature: |
|
||||
void *mg_start_thread(void *(*thread_func);
|
||||
---
|
||||
|
||||
Starts a new detached thread.
|
||||
Arguments and semantics are the same as pthead's `pthread_create()`.
|
||||
Start a new detached thread.
|
||||
Arguments and semantic is the same as pthead's `pthread_create()`.
|
||||
`thread_func` is a thread function, `thread_func_param` is a parameter
|
||||
that is passed to the thread function.
|
||||
|
||||
|
@ -6,7 +6,7 @@ signature: |
|
||||
int mg_stat(const char *path, cs_stat_t *st);
|
||||
---
|
||||
|
||||
Performs a 64-bit `stat()` call against a given file.
|
||||
Perform a 64-bit `stat()` call against given file.
|
||||
|
||||
`path` should be UTF8 encoded.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user