iPXE
|
Network Time Protocol. More...
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <ipxe/malloc.h>
#include <ipxe/refcnt.h>
#include <ipxe/iobuf.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/retry.h>
#include <ipxe/timer.h>
#include <ipxe/time.h>
#include <ipxe/tcpip.h>
#include <ipxe/dhcp.h>
#include <ipxe/settings.h>
#include <ipxe/ntp.h>
Go to the source code of this file.
Data Structures | |
struct | ntp_client |
An NTP client. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | ntp_close (struct ntp_client *ntp, int rc) |
Close NTP client. More... | |
static int | ntp_request (struct ntp_client *ntp) |
Send NTP request. More... | |
static int | ntp_deliver (struct ntp_client *ntp, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Handle NTP response. More... | |
static void | ntp_window_changed (struct ntp_client *ntp) |
Handle data transfer window change. More... | |
static void | ntp_expired (struct retry_timer *timer, int fail) |
Handle NTP timer expiry. More... | |
int | start_ntp (struct interface *job, const char *hostname) |
Start NTP client. More... | |
const struct setting ntp_setting | __setting (SETTING_IP4_EXTRA, ntp) |
IPv4 NTP server setting. More... | |
Variables | |
static struct interface_operation | ntp_xfer_op [] |
Data transfer interface operations. More... | |
static struct interface_descriptor | ntp_xfer_desc |
Data transfer interface descriptor. More... | |
static struct interface_operation | ntp_job_op [] |
Job control interface operations. More... | |
static struct interface_descriptor | ntp_job_desc |
Job control interface descriptor. More... | |
Network Time Protocol.
Definition in file ntp.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Close NTP client.
ntp | NTP client |
rc | Reason for close |
Definition at line 67 of file ntp.c.
References intf_shutdown(), ntp(), rc, and stop_timer().
Referenced by ntp_deliver(), ntp_expired(), and start_ntp().
|
static |
Send NTP request.
ntp | NTP client |
rc | Return status code |
Definition at line 83 of file ntp.c.
References DBGC, hdr, htonl, memset(), ntp(), NTP_EPOCH, NTP_FL_LI_UNKNOWN, NTP_FL_MODE_CLIENT, NTP_FL_VN_1, NTP_FRACTION_MAGIC, NULL, rc, strerror(), and xfer_deliver_raw().
Referenced by ntp_expired().
|
static |
Handle NTP response.
ntp | NTP client |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 114 of file ntp.c.
References close, io_buffer::data, DBGC, DBGC_HDA, EPROTO, free_iob(), hdr, htonl, htons, iob_len(), meta(), ntohl, ntp(), ntp_close(), NTP_FL_MODE_MASK, NTP_FL_MODE_SERVER, NTP_FRACTION_MAGIC, NTP_PORT, rc, and sockaddr_tcpip::st_port.
|
static |
Handle data transfer window change.
ntp | NTP client |
Definition at line 182 of file ntp.c.
References ntp(), and start_timer_nodelay().
|
static |
Handle NTP timer expiry.
timer | Retransmission timer |
fail | Failure indicator |
Definition at line 215 of file ntp.c.
References container_of, ETIMEDOUT, ntp(), ntp_close(), ntp_request(), and start_timer().
Referenced by start_ntp().
int start_ntp | ( | struct interface * | job, |
const char * | hostname | ||
) |
Start NTP client.
job | Job control interface |
hostname | NTP server |
rc | Return status code |
Definition at line 237 of file ntp.c.
References DBGC, ENOMEM, htons, intf_init(), intf_plug_plug(), memset(), ntp(), ntp_close(), ntp_expired(), ntp_job_desc, NTP_MAX_TIMEOUT, NTP_MIN_TIMEOUT, NTP_PORT, ntp_xfer_desc, NULL, rc, ref_init, ref_put, sa, SOCK_DGRAM, st, strerror(), xfer_open_named_socket(), and zalloc().
Referenced by ntp().
const struct setting ntp_setting __setting | ( | SETTING_IP4_EXTRA | , |
ntp | |||
) |
IPv4 NTP server setting.
|
static |
Data transfer interface operations.
|
static |
Data transfer interface descriptor.
Definition at line 197 of file ntp.c.
Referenced by start_ntp().
|
static |
Job control interface operations.
|
static |
Job control interface descriptor.
Definition at line 206 of file ntp.c.
Referenced by start_ntp().