The NTP packet module provides functionality to manipulate the NTP header. More...
The NTP packet module provides functionality to manipulate the NTP header.
Files | |
file | ntp_packet.h |
NTP packet definitions. | |
Data Structures | |
struct | ntp_timestamp_t |
NTP timestamp. More... | |
struct | ntp_packet_t |
NTP packet. More... | |
Macros | |
#define | NTP_VERSION (4U) |
NTP version. | |
#define | NTP_PORT (123U) |
NTP port number. | |
#define | NTP_UNIX_OFFSET (2208988800) |
Offset in seconds of NTP timestamp (seconds from 1990-01-01 00:00:00 UTC) to UNIX timestamp (seconds from 1970-01-01 00:00:00 UTC). | |
Enumerations | |
enum | ntp_mode_t { NTP_MODE_RESERVED = 0 , NTP_MODE_SYM_ACTIVE , NTP_MODE_SYM_PASSIVE , NTP_MODE_CLIENT , NTP_MODE_SERVER , NTP_MODE_BROADCAST , NTP_MODE_PRIV } |
NTP modes. More... | |
Functions | |
static void | ntp_packet_set_li (ntp_packet_t *packet, uint8_t li) |
Set leap indicator in a NTP packet. | |
static void | ntp_packet_set_vn (ntp_packet_t *packet) |
Set version in a NTP packet. | |
static void | ntp_packet_set_mode (ntp_packet_t *packet, ntp_mode_t mode) |
Set mode in a NTP packet. | |
static uint8_t | ntp_packet_get_li (ntp_packet_t *packet) |
Get leap indicator from a NTP packet. | |
static uint8_t | ntp_packet_get_vn (ntp_packet_t *packet) |
Get version from a NTP packet. | |
static ntp_mode_t | ntp_packet_get_mode (ntp_packet_t *packet) |
Get mode from a NTP packet. | |
#define | NTP_PACKET_LI_POS (6U) |
Bit positions and masks for ntp_packet_t::li_vn_mode. | |
#define | NTP_PACKET_LI_MASK (0xc0) |
leap indicator mask | |
#define | NTP_PACKET_VN_POS (3U) |
version position | |
#define | NTP_PACKET_VN_MASK (0x38) |
version mask | |
#define | NTP_PACKET_MODE_MASK (0x07) |
mode mask | |
#define NTP_PACKET_LI_MASK (0xc0) |
leap indicator mask
Definition at line 40 of file ntp_packet.h.
#define NTP_PACKET_LI_POS (6U) |
Bit positions and masks for ntp_packet_t::li_vn_mode.
Leap indicator position
Definition at line 39 of file ntp_packet.h.
#define NTP_PACKET_MODE_MASK (0x07) |
mode mask
Definition at line 43 of file ntp_packet.h.
#define NTP_PACKET_VN_MASK (0x38) |
version mask
Definition at line 42 of file ntp_packet.h.
#define NTP_PACKET_VN_POS (3U) |
version position
Definition at line 41 of file ntp_packet.h.
#define NTP_PORT (123U) |
NTP port number.
Definition at line 47 of file ntp_packet.h.
#define NTP_UNIX_OFFSET (2208988800) |
Offset in seconds of NTP timestamp (seconds from 1990-01-01 00:00:00 UTC) to UNIX timestamp (seconds from 1970-01-01 00:00:00 UTC).
Definition at line 53 of file ntp_packet.h.
#define NTP_VERSION (4U) |
NTP version.
Definition at line 46 of file ntp_packet.h.
enum ntp_mode_t |
NTP modes.
Definition at line 58 of file ntp_packet.h.
|
inlinestatic |
Get leap indicator from a NTP packet.
[in] | packet | The NTP packet |
packet
Definition at line 139 of file ntp_packet.h.
|
inlinestatic |
Get mode from a NTP packet.
[in] | packet | The NTP packet |
packet
Definition at line 163 of file ntp_packet.h.
|
inlinestatic |
Get version from a NTP packet.
[in] | packet | The NTP packet |
packet
Definition at line 151 of file ntp_packet.h.
|
inlinestatic |
Set leap indicator in a NTP packet.
[in] | packet | The NTP packet |
[in] | li | Leap indicator |
Definition at line 103 of file ntp_packet.h.
|
inlinestatic |
Set mode in a NTP packet.
[in] | packet | The NTP packet |
[in] | mode | Mode |
Definition at line 126 of file ntp_packet.h.
|
inlinestatic |
Set version in a NTP packet.
[in] | packet | The NTP packet |
Definition at line 114 of file ntp_packet.h.