View lcov test coverage results on http://www.gnu.org/software/liquidwar6/coverage/src/lib/msg/index.html.
info: the node info to use
Generate a HELLO command.
Return value: newly allocated string.
info: the node info to use
ticket: the ticket to send
Generate a TICKET command.
Return value: newly allocated string.
info: the node info to use
key: the key to identify the message
Generate a FOO command.
Return value: newly allocated string.
info: the node info to use
key: the key to identify the message
Generate a BAR command.
Return value: newly allocated string.
info: the node info to use
Generate a GOODBYE command.
Return value: newly allocated string.
serial: the message serial number
i: the message index in the group
n: the number of messages in the group
round: the message round (can have an offset with real round)
ker_msg: the actual content of the message (passed to core algo)
Generate a DATA command. Serial is an ever increasing number, i and n are most of the time 1 and 1, they are usefull only in long multipart messages.
Return value: newly allocated string.
info: will contain (remote) node info on success
msg: the message to analyse
Analyzes a HELLO message.
Return value: 1 on success, 0 on failure
info: will contain (remote) node info on success
ticket: if not NULL, will contain the ticket value on success
msg: the message to analyse
Analyzes a TICKET message.
Return value: 1 on success, 0 on failure
info: will contain (remote) node info on success
key: if not NULL, will contain the foo/bar key on success
msg: the message to analyse
Analyzes a FOO message.
Return value: 1 on success, 0 on failure
info: will contain (remote) node info on success
key: if not NULL, will contain the foo/bar key on success
msg: the message to analyse
Analyzes a BAR message.
Return value: 1 on success, 0 on failure
info: will contain (remote) node info on success
msg: the message to analyse
Analyzes a GOODBYE message.
Return value: 1 on success, 0 on failure
serial: will contain serial number on success
i: will contain group index on success
n: will contain group size on success
round: will contain round on success (can have an offset with real round)
ker_msg: will contain actual message on success
Analyzes a DATA message.
Return value: 1 on success, 0 on failure
msg: the message to analyse
Analyzes a GOODBYE message.
Return value: the from url, if found (dynamically allocated)
mode: mode to use (a la TELNET or URL compatible)
version: the program version to use (note: can be changed when testing)
password_checksum: the password string to send
physical_ticket_sig: the signature of the message, calculated with ticket + physical from/to
logical_ticket_sig: the signature of the message, calculated with ticket + logical from/to
physical_from_id: the sender id
physical_to_id: the receiver id
logical_from_id: the message creator id
logical_to_id: the message final destination id
msg: the body of the message
Generate an envelope, that is, the complete message sendable on the network.
Return value: newly allocated string.
envelope: the envelope to analyse
mode: mode to use (a la TELNET or URL compatible)
local_url: the url of local server (usefull for password)
password: the password to check against
expected_physical_from_id: the sender id, if NULL, no check performed
expected_physical_to_id: the receiver id, if NULL, no check performed
msg: if not NULL, will contain body of the message
physical_ticket_sig: if not NULL, will contain signature of message, calculated with ticket
logical_ticket_sig: if not NULL, will contain signature of message, calculated with ticket
physical_from_id: if not NULL, will contain sender id
physical_to_id: if not NULL, will contain receiver id
logical_from_id: if not NULL, will contain message creator id
logical_to_id: if not NULL, will contain message final destination id
physical_from_url: if not NULL and if message allows, will contain sender public URL
Generate an envelope, that is, the complete message sendable on the network.
Return value: newly allocated string.
info: the node to generate info about
Generates a standard response to the INFO question for OOB (out of band) messages. The same message is sent, be it on http or tcp or udp, so it's factorized here. Function will lock the info object when needed.
Return value: newly allocated string.
info: the node to generate info about
Generates a standard response to the LIST question for OOB (out of band) messages. The same message is sent, be it on http or tcp or udp, so it's factorized here. Function will lock the info object when needed. There's a max length because we don't want the udp buffer to be saturated + too long lists do not really mean anything anyway.
Return value: newly allocated string.
info: the node to generate info about
Generates a standard response to the PING question for OOB (out of band) messages. The same message is sent, be it on http or tcp or udp, so it's factorized here. Function will lock the info object when needed.
Return value: newly allocated string.
command: the command to send (PING, INFO, LIST)
remote_url: the remote URL (used to seed password)
password: the password, can be NULL or ""
local_url: the public URL to send along with the message, can be NULL or ""
Generates a simple clear text OOB request, with a password if needed.
Return value: a newly allocated string
syntax_ok: will contain 1 if syntax is OK, 0 if not
command: the command (out param, needs *not* to be freed)
password_ok: will contain 1 if password is OK, 0 if not
remote_url: the URL detected, if provided (out param, does needs to be freed)
request: the request to analyse
local_url: the local url (used to seed password)
password: the password to check against
Analyses a simple OOB message of the form COMMAND <passwd> <url>.
Return value: 1 if OK, 0 if not. If 0, check the value of password_ok.
text: the text of the message to parse
Analyses a PONG message and gets the public_url from it, if it exists.
Return value: newly allocated string containing public_url if OK, NULL on error.
mode: 0 for check only, 1 for full test
Runs the
nod
module test suite.Return value: 1 if test is successfull, 0 on error.
ticket: the (private) ticket to use
from_id: the sender/creator
to_id: the receiver/target
msg: the message to sign
Produces a little signature, which is clearly vulnerable to brute-force attacks but makes it possible to be 100% sure if it's wrong, someone is trying to do something nasty (or there's a serious bug!).
Return value: the sig, always non-zero
ticket: the (private) ticket to use
from_id: the sender/creator
to_id: the receiver/target
msg: the message to sign
ticket_sig: the signature to check against
Checks a sig is OK.
Return value: 1 if they are the same, 0 if not.
key: will contain the key detected
value: will contain the value detected
line: the line to analyse
Analyses a trivial "KEY value" line and returns the key and the value in the passed pointers.
Return value: 1 if line OK (and in this case
key
andvalue
are set), 0 if not.
assoc: an assoc object which will contain the result
line: the line to analyse
Analyses a trivial "KEY value" line and sets the
assoc
parameter according to detected values. Note thatassoc
must be set to contain string, and free them automatically withlw6sys_free_callback
for instance.Return value: 1 if line OK (and in this case
assoc
is updated), 0 if not.
assoc: the string assoc to query
key: the key to find in the assoc
default_value: the default value to return
Queries a string assoc for a given value, and if not available, returns default value. Not that default value (nor the assoc value) is copied, so you must take care all remain valid until usage of returned value is over.
Return value: a string, must not be freed.
assoc: the string assoc to query
key: the key to find in the assoc
default_value: the default value to return
Queries a string assoc for a given value, and if not available, returns default value. Not that default value (nor the assoc value) is copied, so you must take care all remain valid until usage of returned value is over. This one will returned an int converted with
lw6sys_atoi
.Return value: a string, must not be freed.
word: will contain the parsed word
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message and gets the first word. This word is put in
buf
member with its length.next
is usefull if you want to parse the rest of the message, it points at the beginning of it.Return value: 1 on success, 0 on failure.
word: will contain the parsed word
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message and gets the first word. This word is put in
buf
member with its length.next
is usefull if you want to parse the rest of the message, it points at the beginning of it. This specialx
function will consider slash ("/") as valid separator. It can't be used all the time but for almost every field but URLs, it's fine. Internally, this one is used to parse integers, IDs, etc.Return value: 1 on success, 0 on failure.
word: will contain the parsed word
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message and gets the first word. This word is put in
buf
member with its length.next
is usefull if you want to parse the rest of the message, it points at the beginning of it. The word is expected to be base64 encoded and is decoded on-the-fly.Return value: 1 on success, 0 on failure.
parsed_value: will contain the parsed value
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message, gets the first word and interpret it as an int.
Return value: 1 on success, 0 on failure.
parsed_value: will contain the parsed value
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message, gets the first word and interpret it as an int. The value must be strictly greater than 0.
Return value: 1 on success, 0 on failure.
parsed_value: will contain the parsed value
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message, gets the first word and interpret it as an int. The value must be strictly greater than 0.
Return value: 1 on success, 0 on failure.
parsed_value: will contain the parsed value
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message, gets the first word and interpret it as an 16-bit id.
Return value: 1 on success, 0 on failure.
parsed_value: will contain the parsed value
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message, gets the first word and interpret it as an 32-bit id.
Return value: 1 on success, 0 on failure.
parsed_value: will contain the parsed value
next: if NOT NULL, will contain a (non freeable) pointer on remaining message
msg: the message to parse
Analyses a message, gets the first word and interpret it as an 64-bit id.
Return value: 1 on success, 0 on failure.
msg: message to encode
limit: if under this limit (length in bytes), do not encode, return as is
Z-encode a message, by "Z-encoding" we mean pass the string through 1) zlib then 2) base64 encoding, this way we get a string without any blank and/or special character, and of reasonnable length. There's an optional limit *not* to encode anything, just when we know there are no special characters to escape and string is small, it's useless to fire this big artillery.
Return value: newly allocated string, 0 terminated, NULL on error.
msg: message to decode
Z-decode a message, by "Z-encoding" we mean pass the string through 1) zlib then 2) base64 encoding, this way we get a string without any blank and/or special character, and of reasonnable length. This decode string does it the reverse way, un64-encode the string then uncompress it back to a readable string.
Return value: newly allocated string, 0 terminated, NULL on error.