View lcov test coverage results on http://www.gnu.org/software/liquidwar6/coverage/src/lib/srv/index.html.
backend: backend to use
Initializes a server backend. Must be performed before any other call.
Return value: 1 on success, 0 on failure
backend: unitialize a srv backend
Closes a srv, but does not free all ressources.
backend: server backend to use
tcp_accepter: TCP mode accepter
node_info: this node information
remote_id: remote host id (out param)
remote_url: remote host URL (out param, dynamically allocated)
Analyzes new TCP messages, typically handled within the accepter object. The result is a combination of bitwise flags, namely namely
LW6SRV_ANALYSE_DEAD
,LW6SRV_ANALYSE_UNDERSTANDABLE
, andLW6SRV_ANALYSE_OOB
which helps knowing what to do with message.Return value: bitwise flag.
backend: server backend to use
udp_buffer: UDP buffer
node_info: this node information
remote_id: remote host id (out param)
remote_url: remote host URL (out param, dynamically allocated)
Analyzes an UDP buffer, received on a socket. The result is a combination of bitwise flags, namely namely
LW6SRV_ANALYSE_DEAD
,LW6SRV_ANALYSE_UNDERSTANDABLE
, andLW6SRV_ANALYSE_OOB
which helps knowing what to do with message.Return value: bitwise flag.
backend: server backend to use
node_info: this node information
oob_data: OOB data received
Processes an OOB message sent from a client.
Return value: 1 if OK, 0 if not.
backend: server backend to use
local_url: local url to use (to send to peer)
remote_url: remote url to communicate with
remote_ip: remote ip to communicate with
remote_port: remote port to communicate with
password: password to use (the real password, not a hash)
local_id: the local 64-bit id
remote_id: the remove 64-bit id
dns_ok: 1 if no DNS mismatch, 0 if situation is unclear
network_reliability: the greater, the more reliable it is
recv_callback_func: callback fired when receiving data
recv_callback_data: additionnal data passed to callback
Opens a server connection. One might wonder, clients open connections, but servers? To some extent, this is the equivalent of
accept
in the socket API, it will actually create an object one can then use to communicate. Be carefull with the implementation of the callback, keep in mind it can be called any time in multithreaded mode, you need to set up locks when accessing shared objects, including, but not limited to, your own data buffers.Return value: new connection object.
connection: connection to use
tcp_accepter: TCP accepter holding data
When data is receivedm feeds the server object with data. Will typically fire the callback receive function if there are actually some data stuff.
Return value: 1 some data processed, else 0
connection: connection to use
When data is receivedm feeds the server object with data. Will typically fire the callback receive function if there are actually some data stuff.
Return value: 1 some data processed, else 0
backend: server backend to use
connection: connection to close
Closes a connection, will also free it.
Return value: none.
backend: server backend to use
connection: connection to use
physical_ticket_sig: physical ticket
logical_ticket_sig: logical ticket
logical_from_id: logical id of sender
logical_to_id: logical id of receiver
message: string with the message to send
Sends a message. The added value with a plain send is that it handles all the special ticket fields.
Return value: 1 on success, 0 if not
backend: server backend to use
connection: connection to use
Polling function, to be called on a regular basis.
Return value: none.
backend: backend to use
connection: connection to represent
Gives a human readable representation of the connection.
Return value: dynamically allocated string.
ip: ip address to listen on
port: port IP to bind to
Starts a server, binds the socket(s) and returns a listener object which can in turn be used to create connections.
Return value: new listener object.
listener: listener to stop
Stops a listener object, and frees it.
Return value: none.
remote_ip: remote IP address
remote_port: remote port
sock: the socket handler (either TCP or UDP)
first_line: the first line of data (can be NULL)
Create a new OOB structure, copying required objects. We need to make copies for this is for usage in a separate thread. The thread member is not set here since the right way to do things is first to set up data then to fire the thread.
Return value: new object
oob: the object to free
Frees an OOB structure.
Return value: none
Returns the list of the default srv backends.
Return value: comma separated string, must not be freed.
argc: argc, as passed to
main
argv: argv, as passed to
main
List available srv backends. The hash contains pairs with id and name for each backend. The id is the technical key you can use to load the backend, the name is something more readable you can display in an interface. The backend objects themselves are not instanciated by this (in fact, they are, but released on the fly) you need to load and initialize them afterwards.
Return value: hash containing id/name pairs.
argc: argc, as passed to
main
argv: argv, as passed to
main
name: string containing srv key, typically got from
lw6srv_get_backends
Creates a srv backend, this is just about loading the dynamic library if needed, and/or check srv engine is available, and connect to it. It does not perform initialization.
Return value: srv backend.
backend: backend to destroy
Destroys a srv backend.
Return value: none.
client_ip: the client ip, will be freed when accepter is freed, do not copy it
client_port: the client port
sock: the socket used
Creates a tcp_accepter object.
Return value: none
tcp_accepter: the object to free
Frees a tcp_accepter object.
Return value: none
mode: 0 for check only, 1 for full test
Runs the
srv
module test suite.Return value: 1 if test is successfull, 0 on error.
client_ip: the client ip, will be freed when object is freed, do not free it
client_port: the client port
line: the line received, will be freed when object is freed, do not free it
Creates an udp_buffer object.
Return value: none