#include <anjay/core.h>
#include <avsystem/commons/avs_defs.h>
Go to the source code of this file.
◆ anjay_nidd_driver_can_recv_t
Checks if it is currently possible to receive any data from the driver.
- Parameters
-
driver | Device driver context to operate on. |
- Returns
- 1 if something can be read, 0 if nothing can be read, negative value in case of error. Driver errno MUST be set to a non-zero value if the function fails.
◆ anjay_nidd_driver_connect_t
Sets up the NIDD connection on the underlying device.
- Parameters
-
driver | Device driver context to operate on. |
- Returns
- 0 on success, negative value in case of an error. Driver errno MUST be set to a non-zero value if the function fails.
◆ anjay_nidd_driver_disconnect_t
Unsets the NIDD connection on the underlying device.
- Parameters
-
driver | Device driver context to operate on. |
- Returns
- 0 on success, negative value in case of an error. Driver errno MUST be set to a non-zero value if the function fails.
◆ anjay_nidd_driver_error_t
Obtains error code of the last operation if it failed.
NOTE: AVS_ENODEV
is reserved for signalling a loss-of-carrier condition that shall NOT be treated as fatal. For this one special error code, errors while handling incoming requests will NOT trigger connection closure (and subsequent retry and/or rebootstrap attempts) as all other errors will.
- Parameters
-
driver | Device driver context to operate on. |
- Returns
- last errno code.
◆ anjay_nidd_driver_free_t
Cleanups the device driver, freeing all used resources.
- Parameters
-
driver | Device driver context to operate on. |
◆ anjay_nidd_driver_incoming_mtu_t
Obtains the MTU of incoming NIDD packets.
NOTE: You may specify only one of the outgoing_mtu
and incoming_mtu
callbacks and leave the other as NULL
. In that case that one MTU value will be used for both directions.
- Parameters
-
driver | Device driver context to operate on. |
out_mtu | Pointer where the MTU shall be stored. |
- Returns
- 0 on success, negative value in case of an error.
◆ anjay_nidd_driver_outgoing_mtu_t
Obtains the MTU of outgoing NIDD packets.
NOTE: You may specify only one of the outgoing_mtu
and incoming_mtu
callbacks and leave the other as NULL
. In that case that one MTU value will be used for both directions.
- Parameters
-
driver | Device driver context to operate on. |
out_mtu | Pointer where the MTU shall be stored. |
- Returns
- 0 on success, negative value in case of an error.
◆ anjay_nidd_driver_recv_t
typedef int anjay_nidd_driver_recv_t(anjay_nidd_driver_t *driver, size_t *out_bytes_received, void *out_message, size_t size, avs_time_monotonic_t deadline) |
Attempts to receive entire message over NIDD to out_message
.
NOTE: If the device has no message to return within the timeout
, it MUST not block, return negative value and set driver errno to AVS_ETIMEDOUT.
NOTE: If the out_message
is too small to hold an entire message, the function MUST fail with driver errno set to AVS_EMSGSIZE.
- Parameters
-
driver | Device driver context to operate on. |
out_bytes_received | Pointer to a variable that, on successful exit, MUST be set to the number of bytes successfully read into out_message . |
out_message | Message buffer to write to. |
size | Maximum message size in bytes. |
deadline | Deadline of the operation. |
- Returns
- 0 on success, negative value in case of error. Driver errno MUST be set to a non-zero value if the function fails.
◆ anjay_nidd_driver_send_t
typedef int anjay_nidd_driver_send_t(anjay_nidd_driver_t *driver, const void *message, size_t size) |
Sends entire message over NIDD, stored in buffer
.
- Parameters
-
driver | Device driver context to operate on. |
message | Message to send. |
size | Message size in bytes. |
- Returns
- 0 if all bytes were successfully written, negative value otherwise. Driver errno MUST be set to a non-zero value if the function fails.
◆ anjay_nidd_driver_system_descriptor_t
typedef int anjay_nidd_driver_system_descriptor_t(anjay_nidd_driver_t *driver, const void **out) |
Returns a pointer to bare system handle to the device communication channel if possible (e.g. to invoke select
or poll
). The returned handle shall be interpreted in the same way as the value returned from avs_net_socket_get_system()
.
- Parameters
-
driver | Device driver context to operate on. |
out | Pointer to a variable in which to save the pointer to the system handle. May be NULL if the driver cannot provide any handle. |
- Returns
- 0 on success, or a negative value in case of error. Driver errno MUST be set to a non-zero value if the function fails.
◆ anjay_nidd_driver_cleanup()
Cleanups driver context by freeing all resources associated with it, using user provided implementation of anjay_nidd_driver_free_t .
Sets *driver to NULL afterwards.
- Parameters
-
driver | Pointer to a driver context to operate on. |