sntp_client.h File Reference
SNTP client (Simple Network Time Protocol) More...
Go to the source code of this file.
Data Structures | |
struct | SntpClientContext |
SNTP client context. More... | |
Enumerations | |
enum | NtpLeapIndicator |
Leap indicator. More... | |
enum | NtpVersion |
NTP version number. More... | |
enum | NtpMode |
Protocol mode. More... | |
Functions | |
error_t | sntpClientGetTimestamp (NetInterface *interface, const IpAddr *serverIpAddr, NtpTimestamp *timestamp) |
Retrieve current time from NTP server using SNTP protocol. | |
error_t | sntpSendRequest (SntpClientContext *context) |
Send NTP request using SNTP protocol. | |
error_t | sntpWaitForResponse (SntpClientContext *context, systime_t timeout) |
Wait for a valid response from the NTP server. | |
error_t | sntpParseResponse (SntpClientContext *context, const NtpHeader *message, size_t length) |
Parse NTP server response. | |
void | sntpDumpMessage (const NtpHeader *message, size_t length) |
Dump NTP message for debugging purpose. | |
void | sntpDumpTimestamp (const NtpTimestamp *timestamp) |
Dump NTP timestamp. |
Detailed Description
SNTP client (Simple Network Time Protocol)
License
Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version:
- 1.7.6
Definition in file sntp_client.h.
Enumeration Type Documentation
enum NtpLeapIndicator |
Leap indicator.
Definition at line 70 of file sntp_client.h.
enum NtpMode |
Protocol mode.
Definition at line 96 of file sntp_client.h.
enum NtpVersion |
NTP version number.
Definition at line 83 of file sntp_client.h.
Function Documentation
error_t sntpClientGetTimestamp | ( | NetInterface * | interface, |
const IpAddr * | serverIpAddr, | ||
NtpTimestamp * | timestamp | ||
) |
Retrieve current time from NTP server using SNTP protocol.
- Parameters:
-
[in] interface Underlying network interface (optional parameter) [in] serverIpAddr IP address of the NTP server [out] timestamp Current time
- Returns:
- Error code
Definition at line 55 of file sntp_client.c.
void sntpDumpMessage | ( | const NtpHeader * | message, |
size_t | length | ||
) |
Dump NTP message for debugging purpose.
- Parameters:
-
[in] message Pointer to the NTP message [in] length Length of the NTP message
Definition at line 280 of file sntp_client.c.
void sntpDumpTimestamp | ( | const NtpTimestamp * | timestamp ) |
Dump NTP timestamp.
- Parameters:
-
[in] timestamp Pointer to the NTP timestamp
Definition at line 345 of file sntp_client.c.
error_t sntpParseResponse | ( | SntpClientContext * | context, |
const NtpHeader * | message, | ||
size_t | length | ||
) |
Parse NTP server response.
- Parameters:
-
[in] context Pointer to the SNTP client context [in] message NTP response message to parse [in] length Length of the incoming NTP message
- Returns:
- Error code
Definition at line 238 of file sntp_client.c.
error_t sntpSendRequest | ( | SntpClientContext * | context ) |
Send NTP request using SNTP protocol.
- Parameters:
-
[in] context SNTP client context
- Returns:
- Error code
Definition at line 142 of file sntp_client.c.
error_t sntpWaitForResponse | ( | SntpClientContext * | context, |
systime_t | timeout | ||
) |
Wait for a valid response from the NTP server.
- Parameters:
-
[in] context Pointer to the SNTP client context [in] timeout Maximum time period to wait
- Returns:
- Error code
Definition at line 186 of file sntp_client.c.
Generated on Tue Jul 12 2022 17:10:22 by
