View lcov test coverage results on http://www.gnu.org/software/liquidwar6/coverage/src/lib/cnx/index.html.
local_url: the local public URL
remote_url: the remote public URL
remote_ip: the remote IP address
remote_port: the remote port
password: the password to use
local_id: the local ID
remote_id: the remote ID
dns_ok: 1 if no DNS mismatch, 0 if IP does not match public URL
network_reliability: drop 1 out of X packets
recv_callback_func: a callback to call when data is received
recv_callback_data: additionnal data to pass to the callback
Create a connection object. This object in itself does nothing, it's just to share common structures among modules, more precisely, between cli and srv code. It's the responsability off the caller/backend to handle the
backend_specific_data
field which is NULL after this call.Return value: newly allocated object.
connection: object to free
Frees a connection object. It's the responsibility of the caller/backend to handle the
backend_specific_data
field.Return value: none.
connection: the connection concerned
now: the current timestamp
Tells wether a new foo message must be issued.
Return value: 1 if true, 0 if false.
connection: the connection concerned
now: the current timestamp
next_foo_delay: the delay (msec) before next foo message is sent
Generates a new foo_bar_key, and schedules the next foo message send timestamp.
Return value: none.
connection: the connexion to lock
Acquires a "send" lock on the connexion, the idea is to avoid too threads sending data using the same socket at the same time. Note that each backend must call this when accessing the socket, there's no top-level lock for the sake of performance.
Return value: 1 on success, 0 if not.
connection: the connexion to lock
Releases a "send" lock on the connexion, the idea is to avoid too threads sending data using the same socket at the same time. Note that each backend must call this when accessing the socket, there's no top-level lock for the sake of performance.
Return value: none.
connection: the connexion concerned
Will filter and return true only in "rare" cases when packets must be artificially dropped for testing purpose.
Return value: 1 if message must be sent/received, 0 if not
seed: a seed to blur the password, can be NULL
password: the password, can be NULL
Calculates the checksum of a password, and returns it as a string, ready to be sent on the network. If password is empty or NULL, then an empty (but not NULL unless internal error) string will be returned. All LW6 protocols should send these checksums instead of real passwords, then on server side value can be checked against both real password and its checksum. The seed is here so that eavesdropper can't reuse the checksum to connect on random sessions. Seed can typically be the node 'public_url' value.
Return value: a dynamically allocated string
seed: a seed to blur the password, can be NULL
password_here: the local password, can be NULL
password_received: the password received from network, can be NULL
Tells wether a password received over the network is valid. The
password_here
argument (the local password) will be checksumed so thatpassword_received
is checked against both clear and checksumed values, so it can be in any form.Return value: 1 if OK, passwords are the same, 0 if not.
mode: 0 for check only, 1 for full test
Runs the
cnx
module test suite.Return value: 1 if test is successfull, 0 on error.
ticket_table: the ticket table to fill with zero
Fills the ticket table struct with 0s.
Return value: none.
ticket_table: the ticket table to init
hash_size: the hash size for both recv/send hashs
Initialize a ticket table, that is, set it up with two empty hashs. Recv hash is filled automatically as it's queried for tickets, send hash must be filled explicitely with info from the network.
Return value: none.
ticket_table: the ticket table to clear
Clears the object (frees memory).
Return value: none.
ticket_table: the ticket table to query
peer_id: the id of remote node
Gets the ticket used to communicate with peer, to check its incoming (recv) messages. If ticket does not exist yet, it's automatically generated so tunction will always return a non-zero value.
Return value: the ticket used to check incoming messages.
ticket_table: the ticket table to query
peer_id: the id of remote node
Acknowledges the ticket used to communicate with peer, to check its incoming (recv) messages has been received. This is to avoid sending it again when it has been received, as it's kept "forever" by peer, we never need to send it again.
Return value: none.
ticket_table: the ticket table to query
peer_id: the id of remote node
Acknowledges the ticket used to communicate with peer, to check its incoming (recv) messages has been received. This is to avoid sending it again when it has been received, as it's kept "forever" by peer, we never need to send it again.
Return value: the ticket used to check incoming messages.
ticket_table: the ticket table to query
peer_id: the id of remote node
Gets the ticket used to communicate with peer, to stamp the outgoing messages. If ticket does not exist yet, 0 is returned, indeed this value must be initialized with the value the peer gives us.
Return value: the ticket used to stamp outgoing messages.
ticket_table: the ticket table to query
peer_id: the id of remote node
send_ticket: the ticket to use to stamp outgoing messages
Sets the ticket used to communicate with peer, to stamp the outgoing (send) messages. This value should be received from the network. Note that once it's set, it's impossible to change it, it will remain the same for the whole duration of the node existence.
Return value: NULL