1
2 /* constants_dep.h */
3
4 #ifndef CONSTANTS_DEP_H
5 #define CONSTANTS_DEP_H
6
7 /**
8 *\file
9 * \brief Plateform-dependent constants definition
10 *
11 * This header defines all includes and constants which are plateform-dependent
12 *
13 * ptpdv2 is only implemented for linux, NetBSD and FreeBSD
14 */
15
16 /* platform dependent */
17
18 #if !defined(linux) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \
19 !defined(__APPLE__) && !defined(__OpenBSD__)
20 #error PTPD hasn't been ported to this OS - should be possible \
21 if it's POSIX compatible, if you succeed, report it to ptpd-devel@sourceforge.net
22 #endif
23
24 #ifdef linux
25 #include<netinet/in.h>
26 #include<net/if.h>
27 #include<net/if_arp.h>
28 #include <ifaddrs.h>
29 #define IFACE_NAME_LENGTH IF_NAMESIZE
30 #define NET_ADDRESS_LENGTH INET_ADDRSTRLEN
31
32 #define IFCONF_LENGTH 10
33
34 #define octet ether_addr_octet
35 #include<endian.h>
36 #if __BYTE_ORDER == __LITTLE_ENDIAN
37 #define PTPD_LSBF
38 #elif __BYTE_ORDER == __BIG_ENDIAN
39 #define PTPD_MSBF
57 #endif
58 #ifdef HAVE_NET_ETHERNET_H
59 # include <net/ethernet.h>
60 #endif
61 # include <ifaddrs.h>
62 # define IFACE_NAME_LENGTH IF_NAMESIZE
63 # define NET_ADDRESS_LENGTH INET_ADDRSTRLEN
64
65 # define IFCONF_LENGTH 10
66
67 # define adjtimex ntp_adjtime
68
69 # include <machine/endian.h>
70 # if BYTE_ORDER == LITTLE_ENDIAN
71 # define PTPD_LSBF
72 # elif BYTE_ORDER == BIG_ENDIAN
73 # define PTPD_MSBF
74 # endif
75 #endif
76
77 #define CLOCK_IDENTITY_LENGTH 8
78 #define ADJ_FREQ_MAX 500000
79
80 /* UDP/IPv4 dependent */
81 #ifndef INADDR_LOOPBACK
82 #define INADDR_LOOPBACK 0x7f000001UL
83 #endif
84
85 #define SUBDOMAIN_ADDRESS_LENGTH 4
86 #define PORT_ADDRESS_LENGTH 2
87 #define PTP_UUID_LENGTH 6
88 #define CLOCK_IDENTITY_LENGTH 8
89 #define FLAG_FIELD_LENGTH 2
90
91 #define PACKET_SIZE 300 //ptpdv1 value kept because of use of TLV...
92 #define PACKET_BEGIN_UDP (ETHER_HDR_LEN + sizeof(struct ip) + \
93 sizeof(struct udphdr))
94 #define PACKET_BEGIN_ETHER (ETHER_HDR_LEN)
95
96 #define PTP_EVENT_PORT 319
|
1
2 /* constants_dep.h */
3
4 #ifndef CONSTANTS_DEP_H
5 #define CONSTANTS_DEP_H
6
7 /**
8 *\file
9 * \brief Plateform-dependent constants definition
10 *
11 * This header defines all includes and constants which are plateform-dependent
12 *
13 * ptpdv2 is only implemented for linux, NetBSD and FreeBSD
14 */
15
16 /* platform dependent */
17
18 #if !defined(linux) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \
19 !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__sun)
20 #error PTPD hasn't been ported to this OS - should be possible \
21 if it's POSIX compatible, if you succeed, report it to ptpd-devel@sourceforge.net
22 #endif
23
24 #ifdef linux
25 #include<netinet/in.h>
26 #include<net/if.h>
27 #include<net/if_arp.h>
28 #include <ifaddrs.h>
29 #define IFACE_NAME_LENGTH IF_NAMESIZE
30 #define NET_ADDRESS_LENGTH INET_ADDRSTRLEN
31
32 #define IFCONF_LENGTH 10
33
34 #define octet ether_addr_octet
35 #include<endian.h>
36 #if __BYTE_ORDER == __LITTLE_ENDIAN
37 #define PTPD_LSBF
38 #elif __BYTE_ORDER == __BIG_ENDIAN
39 #define PTPD_MSBF
57 #endif
58 #ifdef HAVE_NET_ETHERNET_H
59 # include <net/ethernet.h>
60 #endif
61 # include <ifaddrs.h>
62 # define IFACE_NAME_LENGTH IF_NAMESIZE
63 # define NET_ADDRESS_LENGTH INET_ADDRSTRLEN
64
65 # define IFCONF_LENGTH 10
66
67 # define adjtimex ntp_adjtime
68
69 # include <machine/endian.h>
70 # if BYTE_ORDER == LITTLE_ENDIAN
71 # define PTPD_LSBF
72 # elif BYTE_ORDER == BIG_ENDIAN
73 # define PTPD_MSBF
74 # endif
75 #endif
76
77 #ifdef __sun
78 /* Solarish (Illumos & Oracle Solaris) definitions. */
79
80 #include <sys/types.h>
81 #include <sys/socket.h>
82 #include <sys/sockio.h>
83 #include <netinet/in.h>
84 #include <net/if.h>
85 #include <net/if_dl.h>
86 #include <net/if_types.h>
87 #include <sys/ethernet.h>
88 #include <sys/uio.h>
89 #include <ifaddrs.h>
90
91 #define ETHER_ADDR_LEN ETHERADDRL
92 #define IFACE_NAME_LENGTH IF_NAMESIZE
93 #define NET_ADDRESS_LENGTH INET_ADDRSTRLEN
94 #define ETHER_HDR_LEN sizeof (struct ether_header)
95
96 #define adjtimex ntp_adjtime
97
98 #include <sys/isa_defs.h>
99 #ifdef _LITTLE_ENDIAN
100 #define PTPD_LSBF
101 #elif defined(_BIG_ENDIAN)
102 #define PTPD_MSBF
103 #endif
104
105 #endif /* __sun */
106
107 #define CLOCK_IDENTITY_LENGTH 8
108 #define ADJ_FREQ_MAX 500000
109
110 /* UDP/IPv4 dependent */
111 #ifndef INADDR_LOOPBACK
112 #define INADDR_LOOPBACK 0x7f000001UL
113 #endif
114
115 #define SUBDOMAIN_ADDRESS_LENGTH 4
116 #define PORT_ADDRESS_LENGTH 2
117 #define PTP_UUID_LENGTH 6
118 #define CLOCK_IDENTITY_LENGTH 8
119 #define FLAG_FIELD_LENGTH 2
120
121 #define PACKET_SIZE 300 //ptpdv1 value kept because of use of TLV...
122 #define PACKET_BEGIN_UDP (ETHER_HDR_LEN + sizeof(struct ip) + \
123 sizeof(struct udphdr))
124 #define PACKET_BEGIN_ETHER (ETHER_HDR_LEN)
125
126 #define PTP_EVENT_PORT 319
|