Make enum transport_type match the networkProtocol enumeration

This means no conversion is necessary between the transport_type and
the networkProtocol field of the PortAddress struct. Not currently an
issue, but will be needed for implementing the CLOCK_DESCRIPTION
management TLV.
transport: adds interface for getting type, and physical/protocol address

Needed for CLOCK_DESCRIPTION management TLV.
raw: implement getting physical and protocol addrs
add sk_interface_addr for getting an interface's IP
udp: implement getting physical and protocol addrs
udp6: implement getting physical and protocol addrs
Fix initial drift calculation in PI servo.

Convert the calculated drift to ppb and also clamp it.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Modify servo_sample() to accept integer values.

Current date stored in nanoseconds doesn't fit in 64-bit double format.
Keep the offset and the time stamp in integer nanoseconds.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Modify PI servo to set frequency when jumping.

Similarly to the servo in phc2sys, when clock is stepped, set
immediately also its frequency. This significantly improves the initial
convergence with large frequency offsets.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Remove unnecessary states in PI servo.

Step the clock as soon as the second sample is collected.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
phc2sys: use servo code from ptp4l.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
phc2sys: move phc loop to its own function.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
phc2sys: don't zero clock frequency on start.

Instead of always starting at zero frequency offset, read the currently
stored value on start and pass it to the servo. As the read may silently
fail and return zero, set the clock frequency back to the read value to
make sure it's always equal to the actual frequency of the clock.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
phc2sys: remove unnecessary clock step with non-PPS loops.

With non-PPS loops let the servo make the inital correction. Move the
code to the PPS loop and change it to use the sample filtering to reduce
the error in the initial correction.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>