summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex <git@mohr.io>2021-03-16 00:55:15 +0100
committerGitHub <noreply@github.com>2021-03-16 08:55:15 +0900
commitaa0d2e2181e0ca8b42c839b7fc23e8f5bc15f58a (patch)
treeb2f98145c260c29dc9f050bc5a745cb659b46d14
parentfff5caa73977e8a6f2537a5a459fb13af5397385 (diff)
downloadDLT-daemon-aa0d2e2181e0ca8b42c839b7fc23e8f5bc15f58a.tar.gz
dlt-receive: Add option to configure port of dlt receive (#293)
Signed-off-by: Alexander Mohr <git@mohr.io>
-rw-r--r--doc/dlt-receive.1.md5
-rw-r--r--src/console/dlt-receive.c12
2 files changed, 15 insertions, 2 deletions
diff --git a/doc/dlt-receive.1.md b/doc/dlt-receive.1.md
index 38cd2be..9d3f75e 100644
--- a/doc/dlt-receive.1.md
+++ b/doc/dlt-receive.1.md
@@ -6,7 +6,7 @@
# SYNOPSIS
-**dlt-receive** \[**-h**\] \[**-a**\] \[**-x**\] \[**-m**\] \[**-s**\] \[**-o** filename\] \[**-c** limit\] \[**-v**\] \[**-y**\] \[**-b** baudrate\] \[**-e** ecuid\] \[**-f** filterfile\] hostname/serial_device_name
+**dlt-receive** \[**-h**\] \[**-a**\] \[**-x**\] \[**-m**\] \[**-s**\] \[**-o** filename\] \[**-c** limit\] \[**-v**\] \[**-y**\] \[**-b** baudrate\] \[**-e** ecuid\] \[**-f** filterfile\] \[**-p** port\] hostname/serial_device_name
# DESCRIPTION
@@ -62,6 +62,9 @@ Receive DLT messages from DLT daemon and print or store the messages.
: Enable filtering of messages.
+-p
+
+: Port for UDP and TCP communication (Default: 3490).
# EXAMPLES
Print received message headers received from a dlt-daemon running on localhost::
diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c
index 0421937..085648f 100644
--- a/src/console/dlt-receive.c
+++ b/src/console/dlt-receive.c
@@ -129,6 +129,7 @@ typedef struct {
int part_num; /* number of current output file if limit was exceeded */
DltFile file;
DltFilter filter;
+ int port;
} DltReceiveData;
/**
@@ -160,6 +161,8 @@ void usage()
printf(" When limit is reached, a new file is opened. Use K,M,G as\n");
printf(" suffix to specify kilo-, mega-, giga-bytes respectively\n");
printf(" -f filename Enable filtering of messages\n");
+ printf(" -p port Use the given port instead the default port\n");
+ printf(" Cannot be used with serial devices\n");
}
@@ -331,6 +334,7 @@ int main(int argc, char *argv[])
dltdata.ohandle = -1;
dltdata.totalbytes = 0;
dltdata.part_num = -1;
+ dltdata.port = 3490;
/* Config signal handler */
struct sigaction act;
@@ -344,7 +348,7 @@ int main(int argc, char *argv[])
/* Fetch command line arguments */
opterr = 0;
- while ((c = getopt (argc, argv, "vashyuxmf:o:e:b:c:")) != -1)
+ while ((c = getopt (argc, argv, "vashyuxmf:o:e:b:c:p:")) != -1)
switch (c) {
case 'v':
{
@@ -420,6 +424,11 @@ int main(int argc, char *argv[])
dltdata.bvalue = atoi(optarg);
break;
}
+ case 'p':
+ {
+ dltdata.port = atoi(optarg);
+ break;
+ }
case 'c':
{
@@ -469,6 +478,7 @@ int main(int argc, char *argv[])
}
if (dltclient.mode == DLT_CLIENT_MODE_TCP || dltclient.mode == DLT_CLIENT_MODE_UDP_MULTICAST) {
+ dltclient.port = dltdata.port;
for (index = optind; index < argc; index++)
if (dlt_client_set_server_ip(&dltclient, argv[index]) == -1) {
fprintf(stderr, "set server ip didn't succeed\n");