The two methods, config_create_interface and config_read, never modify the
strings passed in. This patch adds the const keyword to ensure these
functions stay that way.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
This patch adds configuration file support for a table of unicast
masters. Each table lives in its own section and has a unique,
positive numerical ID. Entries in the table are a pair of transport
type and protocol address.
Each port may specify a table id to be used for unicast negotiation.
Tables may not be shared between ports, but nothing prevents table
entries from appearing in more than table.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Up until now, one step operation was controlled by a combination of
options, namely time_stamping=hardware with twoStepFlag=0. The
introduction of peer to peer one step makes the situation a bit more
complicated.
This patch adds support for setting the one step options directly by
using the "time_stamping" option. The "twoStepFlag" is adjusted
automatically if needed. The legacy behavior for Sync message one
step is preserved.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Because our interfaces include UNIX domain sockets, we are using
UNIX_PATH_MAX of 108 bytes for our interface names. Even though
IF_NAMESIZE is much smaller (16 bytes), there is nothing that
guarantees this. This patch adds a compile time sanity check that
tests whether the interface name will fit.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch provides a way to use the entire table of configuration options
as "long" command line switches.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
There is no need to have a function to get this information as
we can easily obtain it when the interface is first created.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Now that all of the legacy, open coded configuration fields are gone,
we can follow a normal create/destroy pattern for the configuration.
This patch add the new method and converts the programs to use it.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Global default values will be static strings, but values from the
configuration file will be dynamic, so the code remembers whether or it
should free the string when cleaning up.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch adds functions that will set and lock a certain value. The
intended use of these methods is to give command line options priority
over the configuration file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch introduces generic code for adding and parsing new options.
The public 'get' methods return option values directly. Although the
API is easy to use, it does not provide error checking in case the
option does not exist or if there is a type mismatch.
Therefore the code performs a BIST to ensure that the options are
properly populated. In addition, the code terminates the program in
case of missing options or type mismatches. This heavy handed
approach is meant to catch errors during development and should never
trigger during normal usage.
As a first element, we include an option for specifying the UDP TTL.
Users are required to call 'config_init', and so this patch add that into
all three programs, ptp4l, phc2sys and pmc.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Add new time stamp processing modes to return raw delay and offset based
on the raw delay instead of the long-term filtered delay, and to return
also a weight of the sample. The weight is set to the ratio between the
two delays. This gives smaller weight to samples where the sync and/or
delay messages were delayed significantly in the network and possibly
include a large error.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
This patch adds a configuration option that allows running a boundary clock
using "just a bunch of devices". Normally each port is probed to make sure
they all share the same PTP hardware clock, but this option will allow a
heterogeneous collection of devices, should the user really want it.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jiri Benc <jbenc@redhat.com>