constants.h 2.43 KB
Newer Older
1 2
#ifndef __PTP_CONSTANTS_H__
#define __PTP_CONSTANTS_H__
3

4 5 6
/* general purpose constants */
#define PP_NSEC_PER_SEC 1000000000

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/* implementation specific constants */
#define PP_DEFAULT_INBOUND_LATENCY		0	/* in nsec */
#define PP_DEFAULT_OUTBOUND_LATENCY		0	/* in nsec */
#define PP_DEFAULT_NO_RESET_CLOCK		0
#define PP_DEFAULT_DOMAIN_NUMBER		0
#define PP_DEFAULT_DELAY_MECHANISM		P2P
#define PP_DEFAULT_AP				10
#define PP_DEFAULT_AI				1000
#define PP_DEFAULT_DELAY_S			6
#define PP_DEFAULT_ANNOUNCE_INTERVAL		1	/* 0 in 802.1AS */
#define PP_DEFAULT_UTC_OFFSET			0
#define PP_DEFAULT_UTC_VALID			0
#define PP_DEFAULT_PDELAYREQ_INTERVAL		1	/* -4 in 802.1AS */
#define PP_DEFAULT_DELAYREQ_INTERVAL		3
#define PP_DEFAULT_SYNC_INTERVAL		0	/* -7 in 802.1AS */
#define PP_DEFAULT_SYNC_RECEIPT_TIMEOUT		3
#define PP_DEFAULT_ANNOUNCE_RECEIPT_TIMEOUT	6	/* 3 by default */
#define PP_DEFAULT_QUALIFICATION_TIMEOUT	2
#define PP_DEFAULT_FOREIGN_MASTER_TIME_WINDOW	4
#define PP_DEFAULT_FOREIGN_MASTER_THRESHOLD	2
#define PP_DEFAULT_CLOCK_CLASS			248
#define PP_DEFAULT_CLOCK_ACCURACY		0xFE
#define PP_DEFAULT_PRIORITY1			248
#define PP_DEFAULT_PRIORITY2			248
#define PP_DEFAULT_CLOCK_VARIANCE		-4000 /* To be determined in
						       * 802.1AS. We use the
						       * same value as in ptpdv1
						       */
#define PP_DEFAULT_MAX_FOREIGN_RECORDS		5
#define PP_DEFAULT_PARENTS_STATS		0

38 39 40 41 42 43 44
/* We use an array of timers, with these indexes */
#define PP_TIMER_PDELAYREQ	0
#define PP_TIMER_DELAYREQ	1
#define PP_TIMER_SYNC		2
#define PP_TIMER_ANN_RECEIPT	3
#define PP_TIMER_ANN_INTERVAL	4
#define PP_TIMER_ARRAY_SIZE	5
45

46 47 48
#define PP_TWO_STEP_FLAG		2
#define PP_VERSION_PTP			2

49 50 51 52 53 54 55 56
#define PP_HEADER_LENGTH		34
#define PP_ANNOUNCE_LENGTH		64
#define PP_SYNC_LENGTH			44
#define PP_FOLLOW_UP_LENGTH		44
#define PP_PDELAY_REQ_LENGTH		54
#define PP_DELAY_REQ_LENGTH		44
#define PP_DELAY_RESP_LENGTH		54
#define PP_PDELAY_RESP_LENGTH		54
57
#define PP_PDELAY_RESP_FOLLOW_UP_LENGTH 54
58 59
#define PP_MANAGEMENT_LENGTH		48

60 61
#define PP_DEFAULT_NEXT_DELAY_MS	1000

62 63 64 65 66 67 68 69
/* UDP/IPv4 dependent */
#define PP_SUBDOMAIN_ADDRESS_LENGTH	4
#define PP_PORT_ADDRESS_LENGTH		2
#define PP_UUID_LENGTH			6
#define PP_CLOCK_IDENTITY_LENGTH	8
#define PP_FLAG_FIELD_LENGTH		2
#define PP_PACKET_SIZE			300
#define PP_EVENT_PORT			319
70
#define PP_GENERAL_PORT			320
71 72 73 74 75
#define PP_DEFAULT_DOMAIN_ADDRESS	"224.0.1.129"
#define PP_PEER_DOMAIN_ADDRESS		"224.0.0.107"
#define PP_MM_STARTING_BOUNDARY_HOPS	0x7fff


76

77
#endif /* __PTP_CONSTANTS_H__ */