The following functions are provided by the Prosody SNTP Client API:
| API call | W | Description |
|---|---|---|
| sm_sntp_config() | Configure the SNTP client to send IPv4 requests | |
| sm_sntp_config_ipv6() | Configure the SNTP client to send IPv6 requests | |
| sm_sntp_create() | Create an SNTP Client | |
| sm_sntp_destroy() | Destroy an SNTP Client | |
| sm_sntp_get_event() | Get an event for the SNTP client | |
| sm_sntp_status() | Fetch status info on a SNTP client |
This document is also available as separate pages for each function.
int sm_sntp_config(struct sm_sntp_config_parms *configp)
typedef struct sm_sntp_config_parms {
tSMSNTPId sntp; /* in */
SOCKADDR_IN server; /* in */
int TOS; /* in */
tSM_UT32 no_reply_delay; /* in */
tSM_UT32 had_reply_delay; /* in */
} SM_SNTP_CONFIG_PARMS;
This function configures the NTP server used by the SNTP client. If the reply to a NTP request is not received within no_reply_delay then the next request is sent. Otherwise the next NTP request is sent had_reply_delay after the previous request.
0 if call completed successfully, otherwise a standard error such as:
int sm_sntp_config_ipv6(struct sm_sntp_config_ipv6_parms *configp)
typedef struct sm_sntp_config_ipv6_parms {
tSMSNTPId sntp; /* in */
SOCKADDR_IN6 server; /* in */
tSM_UT32 no_reply_delay; /* in */
tSM_UT32 had_reply_delay; /* in */
} SM_SNTP_CONFIG_IPV6_PARMS;
This function configures the NTP server used by the SNTP client. If the reply to a NTP request is not received within no_reply_delay then the next request is sent. Otherwise the next NTP request is sent had_reply_delay after the previous request.
0 if call completed successfully, otherwise a standard error such as:
int sm_sntp_create(struct sm_sntp_create_parms *createp)
typedef struct sm_sntp_create_parms {
tSMSNTPId sntp; /* out */
tSMModuleId module; /* in */
enum kSMSNTPType {
kSMSNTPTypeIPv4,
kSMSNTPTypeIPv6,
} type; /* in */
struct in_addr address; /* in */
struct in6_addr ipv6_address; /* in */
} SM_SNTP_CREATE_PARMS;
Creates an SNTP Client.
0 if call completed successfully, otherwise a standard error such as:
int sm_sntp_destroy(tSMSNTPId sntp)
Destroys an SNTP Client.
0 if call completed successfully, otherwise a standard error such as:
int sm_sntp_get_event(struct sm_sntp_event_parms *eventp)
typedef struct sm_sntp_event_parms {
tSMSNTPId sntp; /* in */
tSMEventId event; /* out */
} SM_SNTP_EVENT_PARMS;
the event will be signalled when a status change occurs on the SNTP client.
0 if call completed successfully, otherwise a standard error such as:
int sm_sntp_status(struct sm_sntp_status_parms *statusp)
typedef struct sm_sntp_status_parms {
tSMSNTPId sntp; /* in */
enum kSMSNTPStatus {
kSMSNTPStatusRunning,
kSMSNTPStatusStopped,
kSMSNTPStatusSync,
} status; /* out */
union {
struct {
int has_sync; /* out */
} sync; /* out */
} u; /* out */
} SM_SNTP_STATUS_PARMS;
returns the status of the SNTP client.
0 if call completed successfully, otherwise a standard error such as:
These functions constitute the Prosody SNTP Client API.