gPTP Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ieee1588.hpp File Reference
#include <string>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <platform.hpp>
#include <ptptypes.hpp>
#include <debugout.hpp>
Include dependency graph for ieee1588.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  event_descriptor_t
 
class  InterfaceLabel
 
class  ClockIdentity
 
class  Timestamp
 
class  HWTimestamper
 

Macros

#define MAX_PORTS   32
 
#define PTP_CLOCK_IDENTITY_LENGTH   8
 
#define INVALID_TIMESTAMP_VERSION   0xFF
 
#define MAX_NANOSECONDS   1000000000
 
#define MAX_TIMESTAMP_STRLEN   28
 
#define INVALID_TIMESTAMP   (Timestamp( 0xC0000000, 0, 0 ))
 
#define PDELAY_PENDING_TIMESTAMP   (Timestamp( 0xC0000001, 0, 0 ))
 
#define TIMESTAMP_TO_NS(ts)
 
#define NS_PER_SECOND   1000000000
 
#define LS_SEC_MAX   0xFFFFFFFFull
 
#define HWTIMESTAMPER_EXTENDED_MESSAGE_SIZE   4096
 

Enumerations

enum  Event {
  NULL_EVENT = 0, POWERUP = 5, INITIALIZE, STATE_CHANGE_EVENT,
  SYNC_INTERVAL_TIMEOUT_EXPIRES, PDELAY_INTERVAL_TIMEOUT_EXPIRES, SYNC_RECEIPT_TIMEOUT_EXPIRES, QUALIFICATION_TIMEOUT_EXPIRES,
  ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES, ANNOUNCE_INTERVAL_TIMEOUT_EXPIRES, FAULT_DETECTED, PDELAY_DEFERRED_PROCESSING,
  PDELAY_RESP_RECEIPT_TIMEOUT_EXPIRES
}
 

Functions

PTPMessageCommonbuildPTPMessage (char *buf, int size, LinkLayerAddress *remote, IEEE1588Port *port)
 Builds a PTP message. More...
 

Macro Definition Documentation

#define HWTIMESTAMPER_EXTENDED_MESSAGE_SIZE   4096

Maximum size of HWTimestamper extended message

#define INVALID_TIMESTAMP   (Timestamp( 0xC0000000, 0, 0 ))

Defines an invalid timestamp using a Timestamp instance and a fixed value

#define INVALID_TIMESTAMP_VERSION   0xFF

Value defining invalid timestamp version

#define LS_SEC_MAX   0xFFFFFFFFull

Maximum value of seconds LSB field

#define MAX_NANOSECONDS   1000000000

Maximum value of nanoseconds (1 second)

#define MAX_PORTS   32

Maximum number of IEEE1588Port instances

#define MAX_TIMESTAMP_STRLEN   28

Maximum size of timestamp strlen

#define NS_PER_SECOND   1000000000

Amount of nanoseconds in a second

#define PDELAY_PENDING_TIMESTAMP   (Timestamp( 0xC0000001, 0, 0 ))

PDelay is pending timestamp

#define PTP_CLOCK_IDENTITY_LENGTH   8

Size of a clock identifier stored in the ClockIndentity class, described at IEEE 802.1AS Clause 8.5.2.4

#define TIMESTAMP_TO_NS (   ts)
Value:
(((static_cast<long long int>((ts).seconds_ms) \
<< sizeof((ts).seconds_ls)*8) + \
(ts).seconds_ls)*1000000000LL + (ts).nanoseconds)

Converts timestamp value into nanoseconds value

Enumeration Type Documentation

enum Event

IEEE 1588 event enumeration type Defined at: IEEE 1588-2008 Clause 9.2.6

Enumerator
NULL_EVENT 

Null Event. Used to initialize events.

POWERUP 

Power Up. Initialize state machines.

INITIALIZE 

Same as POWERUP.

STATE_CHANGE_EVENT 

Signalizes that something has changed. Recalculates best master.

SYNC_INTERVAL_TIMEOUT_EXPIRES 

Sync interval expired. Its time to send a sync message.

PDELAY_INTERVAL_TIMEOUT_EXPIRES 

PDELAY interval expired. Its time to send pdelay_req message.

SYNC_RECEIPT_TIMEOUT_EXPIRES 

Sync receipt timeout. Restart timers and take actions based on port's state.

QUALIFICATION_TIMEOUT_EXPIRES 

Qualification timeout. Event not currently used.

ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES 

Announce receipt timeout. Same as SYNC_RECEIPT_TIMEOUT_EXPIRES.

ANNOUNCE_INTERVAL_TIMEOUT_EXPIRES 

Announce interval timout. Its time to send an announce message if asCapable is true.

FAULT_DETECTED 

A fault was detected.

PDELAY_DEFERRED_PROCESSING 

Defers pdelay processing.

PDELAY_RESP_RECEIPT_TIMEOUT_EXPIRES 

Pdelay response message timeout.

Function Documentation

PTPMessageCommon* buildPTPMessage ( char *  buf,
int  size,
LinkLayerAddress remote,
IEEE1588Port port 
)

Builds a PTP message.

Parameters
buf[in] message buffer to send
sizemessage length
remoteDestination link layer address
port[in] IEEE1588 port
Returns
PTP message instance of PTPMessageCommon