config clock description

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
master
Geoff Salmon 2013-02-03 17:01:52 -05:00 committed by Richard Cochran
parent 09c2d1a652
commit 1e77af6d21
3 changed files with 62 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include "config.h"
#include "ether.h"
#include "print.h"
#include "util.h"
enum config_section {
GLOBAL_SECTION,
@ -157,6 +158,17 @@ static enum parser_result parse_port_setting(const char *option,
return PARSED_OK;
}
static int count_char(const char *str, char c)
{
int num = 0;
char s;
while ((s = *(str++))) {
if (s == c)
num++;
}
return num;
}
static enum parser_result parse_global_setting(const char *option,
const char *value,
struct config *cfg)
@ -166,6 +178,7 @@ static enum parser_result parse_global_setting(const char *option,
UInteger16 u16;
UInteger8 u8;
unsigned char mac[MAC_LEN];
unsigned char oui[OUI_LEN];
struct defaultDS *dds = &cfg->dds.dds;
struct port_defaults *pod = &cfg->pod;
@ -342,6 +355,29 @@ static enum parser_result parse_global_setting(const char *option,
else
return BAD_VALUE;
} else if (!strcmp(option, "productDescription")) {
if (count_char(value, ';') != 2)
return BAD_VALUE;
if (static_ptp_text_set(&cfg->dds.clock_desc.productDescription, value) != 0)
return BAD_VALUE;
} else if (!strcmp(option, "revisionData")) {
if (count_char(value, ';') != 2)
return BAD_VALUE;
if (static_ptp_text_set(&cfg->dds.clock_desc.revisionData, value) != 0)
return BAD_VALUE;
} else if (!strcmp(option, "userDescription")) {
if (static_ptp_text_set(&cfg->dds.clock_desc.userDescription, value) != 0)
return BAD_VALUE;
} else if (!strcmp(option, "manufacturerIdentity")) {
if (OUI_LEN != sscanf(value, "%hhx:%hhx:%hhx",
&oui[0], &oui[1], &oui[2]))
return BAD_VALUE;
for (i = 0; i < OUI_LEN; i++)
cfg->dds.clock_desc.manufacturerIdentity[i] = oui[i];
} else
return NOT_PARSED;

View File

@ -52,3 +52,9 @@ udp6_scope 0x0E
network_transport UDPv4
delay_mechanism E2E
time_stamping hardware
#
# Clock description
#
productDescription ;;
revisionData ;;
manufacturerIdentity 00:00:00

20
ptp4l.8
View File

@ -310,6 +310,26 @@ The default is 1 (enabled).
.B time_stamping
The time stamping method. The allowed values are hardware, software and legacy.
The default is hardware.
.TP
.B productDescription
The product description string. Allowed values must be of the form
manufacturerName;modelNumber;instanceIdentifier and contain at most 64
utf8 symbols. The default is ";;".
.TP
.B revisionData
The revision description string which contains the revisions for node
hardware (HW), firmware (FW), and software (SW). Allowed values are of
the form HW;FW;SW and contain at most 32 utf8 symbols. The default is
an ";;".
.TP
.B userDescription
The user description string. Allowed values are of the form
name;location and contain at most 128 utf8 symbols. The default is an
empty string.
.TP
.B manufacturerIdentity
The manufacturer id which should be an OUI owned by the manufacturer.
The default is 00:00:00.
.SH SEE ALSO
.BR pmc (8),