net/can/can.h: Add can_setsockopt and can_getsockopt prototypes.

This commit is contained in:
Ouss4 2020-06-15 18:57:13 +01:00 committed by patacongo
parent 5e6d9944d7
commit 155903fc54
3 changed files with 65 additions and 0 deletions

View File

@ -376,6 +376,69 @@ ssize_t psock_can_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg);
void can_readahead_signal(FAR struct can_conn_s *conn); void can_readahead_signal(FAR struct can_conn_s *conn);
#endif #endif
/****************************************************************************
* Name: can_setsockopt
*
* Description:
* can_setsockopt() sets the CAN-protocol option specified by the
* 'option' argument to the value pointed to by the 'value' argument for
* the socket specified by the 'psock' argument.
*
* See <netinet/can.h> for the a complete list of values of CAN protocol
* options.
*
* Input Parameters:
* psock Socket structure of socket to operate on
* option identifies the option to set
* value Points to the argument value
* value_len The length of the argument value
*
* Returned Value:
* Returns zero (OK) on success. On failure, it returns a negated errno
* value to indicate the nature of the error. See psock_setcockopt() for
* the list of possible error values.
*
****************************************************************************/
#ifdef CONFIG_NET_CANPROTO_OPTIONS
int can_setsockopt(FAR struct socket *psock, int option,
FAR const void *value, socklen_t value_len);
#endif
/****************************************************************************
* Name: can_getsockopt
*
* Description:
* can_getsockopt() retrieves the value for the option specified by the
* 'option' argument for the socket specified by the 'psock' argument. If
* the size of the option value is greater than 'value_len', the value
* stored in the object pointed to by the 'value' argument will be silently
* truncated. Otherwise, the length pointed to by the 'value_len' argument
* will be modified to indicate the actual length of the 'value'.
*
* See <sys/socket.h> a complete list of values for the socket-level
* 'option' argument. Protocol-specific options are are protocol specific
* header files (such as netpacket/can.h for the case of the CAN protocol).
*
* Input Parameters:
* psock Socket structure of the socket to query
* level Protocol level to set the option
* option identifies the option to get
* value Points to the argument value
* value_len The length of the argument value
*
* Returned Value:
* Returns zero (OK) on success. On failure, it returns a negated errno
* value to indicate the nature of the error. See psock_getsockopt() for
* the complete list of appropriate return error codes.
*
****************************************************************************/
#ifdef CONFIG_NET_CANPROTO_OPTIONS
int can_getsockopt(FAR struct socket *psock, int option,
FAR void *value, FAR socklen_t *value_len);
#endif
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -52,6 +52,7 @@
#include "tcp/tcp.h" #include "tcp/tcp.h"
#include "usrsock/usrsock.h" #include "usrsock/usrsock.h"
#include "utils/utils.h" #include "utils/utils.h"
#include "can/can.h"
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions

View File

@ -57,6 +57,7 @@
#include "udp/udp.h" #include "udp/udp.h"
#include "usrsock/usrsock.h" #include "usrsock/usrsock.h"
#include "utils/utils.h" #include "utils/utils.h"
#include "can/can.h"
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions