Assume that none of the LNP commands are thread-safe.
typedef void (*lnp_addressing_handler_t) (const unsigned char *, unsigned char, unsigned char);
#include <lnp/lnp-logical.h>
len
byte block of memory starting at buf
is
written to the IR port. You typically will want to use lnp_addressing_write or
lnp_reliable_write instead of this, as this provides no addressing functionality.
A call to this function waits for the write to complete / fail.
LNP addressing layer commands
#include <lnp/lnp.h>
port
. Whenever
a message is received on the specified port, a call to handler
will
be made, with the message as a parameter.
Parameters: |
port
-
the port to set an addressing handler for
handler - a function pointer to the function that will handle incoming data on port port
|
length
bytes of a chunk of memory starting at data
to dest
, with an originating port of srcport
. A call to
this function will block until the entire message has been transmitted
or until failure.
Parameters: |
data
-
a pointer to the block of memory to be sent
length - the number of bytes to send dest - The address to broadcast to. This should be a full address, with both host address and destination port srcport - This is used to tell the recipient which port to send replies to. |
new_hostaddr
. Does not affect
existing port handlers. Does not affect reliable connections, but
any existing reliable conection should be re-initialized anyway.
LNP reliable layer commands
#include <lnp/lnp-reliable.h>
dest
. This needs to be
called by both sides of the connection before data can be sent. Both sides need
to be using the same port number.
real_length
byte chunk of data starting from
data
across the network. A call to this function will block until
either the message has been acknowledged or until a timeout occurs (currently
2.5 seconds)
data
with whatever has been received from the reliable connection.
If src
is non-null, then the originating address and port are stored
in src
. A call to this function will block until data is successfully
read.
Parameters: |
data
-
The buffer to write to
src - the place to store the source address. Make this NULL if you don't want it filled in |