pmc: add a command line option to select the server's UDS address.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2013-09-29 20:58:17 +02:00
parent 9fe2ffd2ef
commit 4f6f1e1cba
2 changed files with 18 additions and 2 deletions

8
pmc.8
View File

@ -1,4 +1,4 @@
.TH PMC 8 "July 2013" "linuxptp"
.TH PMC 8 "October 2013" "linuxptp"
.SH NAME
pmc \- PTP management client
@ -19,6 +19,8 @@ pmc \- PTP management client
] [
.BI \-i " interface"
] [
.BI \-s " uds-address"
] [
.BI \-t " transport-specific-field"
] [
.B \-v
@ -69,6 +71,10 @@ Specify the domain number in sent messages. The default is 0.
Specify the network interface. The default is /var/run/pmc for the Unix Domain
Socket transport and eth0 for the other transports.
.TP
.BI \-s " uds-address"
Specifies the address of the server's UNIX domain socket.
The default is /var/run/ptp4l.
.TP
.BI \-t " transport-specific-field"
Specify the transport specific field in sent messages as a hexadecimal number.
The default is 0x0.

12
pmc.c
View File

@ -31,6 +31,7 @@
#include "pmc_common.h"
#include "print.h"
#include "tlv.h"
#include "uds.h"
#include "util.h"
#include "version.h"
@ -676,6 +677,7 @@ static void usage(char *progname)
" -h prints this message and exits\n"
" -i [dev] interface device to use, default 'eth0'\n"
" for network and '/var/run/pmc' for UDS.\n"
" -s [path] server address for UDS, default '/var/run/ptp4l'.\n"
" -t [hex] transport specific field, default 0x0\n"
" -v prints the software version and exits\n"
" -z send zero length TLV values with the GET actions\n"
@ -697,7 +699,7 @@ int main(int argc, char *argv[])
/* Process the command line arguments. */
progname = strrchr(argv[0], '/');
progname = progname ? 1+progname : argv[0];
while (EOF != (c = getopt(argc, argv, "246u""b:d:hi:t:vz"))) {
while (EOF != (c = getopt(argc, argv, "246u""b:d:hi:s:t:vz"))) {
switch (c) {
case '2':
transport_type = TRANS_IEEE_802_3;
@ -720,6 +722,14 @@ int main(int argc, char *argv[])
case 'i':
iface_name = optarg;
break;
case 's':
if (strlen(optarg) > MAX_IFNAME_SIZE) {
fprintf(stderr, "path %s too long, max is %d\n",
optarg, MAX_IFNAME_SIZE);
return -1;
}
strncpy(uds_path, optarg, MAX_IFNAME_SIZE);
break;
case 't':
if (1 == sscanf(optarg, "%x", &c))
transport_specific = c << 4;