diff options
author | João Sousa <48479050+joaodasousa@users.noreply.github.com> | 2020-08-31 00:56:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-31 08:56:03 +0900 |
commit | 33fbad18c814e13bd7ba2053525d8959fee437d1 (patch) | |
tree | 87d30704e5e78c603aace4cb2c0dacdf3554eba6 /include | |
parent | 9af27899553dcfe9cd5ffede7f37be57d1a577a6 (diff) | |
download | DLT-daemon-33fbad18c814e13bd7ba2053525d8959fee437d1.tar.gz |
Implement DLTClient for UDP multicast (#240)
* Add UDP multicast support on client side
UDP multicast support is already present on server side. This
patch add seemless support for UDP multicast on client side
in dlt-receive.
Signed-off-by: Joao Sousa <joao.sa.sousa@ctw.bmwgroup.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/dlt/dlt_client.h | 22 | ||||
-rw-r--r-- | include/dlt/dlt_common.h | 11 |
2 files changed, 27 insertions, 6 deletions
diff --git a/include/dlt/dlt_client.h b/include/dlt/dlt_client.h index 1fac86a..f649b83 100644 --- a/include/dlt/dlt_client.h +++ b/include/dlt/dlt_client.h @@ -81,14 +81,16 @@ typedef enum DLT_CLIENT_MODE_UNDEFINED = -1, DLT_CLIENT_MODE_TCP, DLT_CLIENT_MODE_SERIAL, - DLT_CLIENT_MODE_UNIX + DLT_CLIENT_MODE_UNIX, + DLT_CLIENT_MODE_UDP_MULTICAST } DltClientMode; typedef struct { DltReceiver receiver; /**< receiver pointer to dlt receiver structure */ int sock; /**< sock Connection handle/socket */ - char *servIP; /**< servIP IP adress/Hostname of TCP/IP interface */ + char *servIP; /**< servIP IP adress/Hostname of interface */ + char *hostip; /**< hostip IP address of UDP host receiver interface */ int port; /**< Port for TCP connections (optional) */ char *serialDevice; /**< serialDevice Devicename of serial device */ char *socketPath; /**< socketPath Unix socket path */ @@ -270,6 +272,14 @@ DltReturnValue dlt_client_send_reset_to_factory_default(DltClient *client); DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate); /** + * Set mode within dlt client structure + * @param client pointer to dlt client structure + * @param mode DltClientMode + * @return Value from DltReturnValue enum + */ +DltReturnValue dlt_client_set_mode(DltClient *client, DltClientMode mode); + +/** * Set server ip * @param client pointer to dlt client structure * @param ipaddr pointer to command line argument @@ -278,6 +288,14 @@ DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate); int dlt_client_set_server_ip(DltClient *client, char *ipaddr); /** + * Set server UDP host receiver interface address + * @param client pointer to dlt client structure + * @param hostip pointer to multicast group address + * @return negative value if there was an error + */ +int dlt_client_set_host_if_address(DltClient *client, char *hostip); + +/** * Set serial device * @param client pointer to dlt client structure * @param serial_device pointer to command line argument diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h index 9f4096b..166395e 100644 --- a/include/dlt/dlt_common.h +++ b/include/dlt/dlt_common.h @@ -77,6 +77,7 @@ # include <stdio.h> # ifdef __linux__ # include <linux/limits.h> +# include <sys/socket.h> # else # include <limits.h> # endif @@ -402,6 +403,7 @@ enum { typedef enum { DLT_RECEIVE_SOCKET, + DLT_RECEIVE_UDP_SOCKET, DLT_RECEIVE_FD } DltReceiverType; @@ -767,11 +769,12 @@ typedef struct int32_t lastBytesRcvd; /**< bytes received in last receive call */ int32_t bytesRcvd; /**< received bytes */ int32_t totalBytesRcvd; /**< total number of received bytes */ - char *buffer; /**< pointer to receiver buffer */ - char *buf; /**< pointer to position within receiver buffer */ - char *backup_buf; /** pointer to the buffer with partial messages if any **/ - int fd; /**< connection handle */ + char *buffer; /**< pointer to receiver buffer */ + char *buf; /**< pointer to position within receiver buffer */ + char *backup_buf; /** pointer to the buffer with partial messages if any **/ + int fd; /**< connection handle */ int32_t buffersize; /**< size of receiver buffer */ + struct sockaddr_in addr; /**< socket address information */ } DltReceiver; typedef struct |