Helper functions for SNTP client. More...
Go to the source code of this file.
| Functions | |
| error_t | sntpClientOpenConnection (SntpClientContext *context) | 
| Open UDP connection.  More... | |
| void | sntpClientCloseConnection (SntpClientContext *context) | 
| Close UDP connection.  More... | |
| error_t | sntpClientSendRequest (SntpClientContext *context) | 
| Send request to the NTP server.  More... | |
| error_t | sntpClientReceiveResponse (SntpClientContext *context) | 
| Wait for NTP server's response.  More... | |
| error_t | sntpClientCheckResponse (SntpClientContext *context, const IpAddr *ipAddr, uint16_t port, const uint8_t *message, size_t length) | 
| Check whether the NTP response is valid.  More... | |
| error_t | sntpClientParseResponse (SntpClientContext *context, NtpTimestamp *timestamp) | 
| Parse NTP server's response.  More... | |
| error_t | sntpClientCheckTimeout (SntpClientContext *context) | 
| Determine whether a timeout error has occurred.  More... | |
Detailed Description
Helper functions for SNTP client.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 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
- 2.5.4
Definition in file sntp_client_misc.h.
Function Documentation
◆ sntpClientCheckResponse()
| error_t sntpClientCheckResponse | ( | SntpClientContext * | context, | 
| const IpAddr * | ipAddr, | ||
| uint16_t | port, | ||
| const uint8_t * | message, | ||
| size_t | length | ||
| ) | 
Check whether the NTP response is valid.
- Parameters
- 
  [in] context Pointer to the SNTP client context [in] ipAddr Remote IP address [in] port Remote port number [in] message Pointer to the NTP message [in] length Length of the NTP message, in bytes 
- Returns
- Error code
Definition at line 253 of file sntp_client_misc.c.
◆ sntpClientCheckTimeout()
| error_t sntpClientCheckTimeout | ( | SntpClientContext * | context | ) | 
Determine whether a timeout error has occurred.
- Parameters
- 
  [in] context Pointer to the SNTP client context 
- Returns
- Error code
Definition at line 351 of file sntp_client_misc.c.
◆ sntpClientCloseConnection()
| void sntpClientCloseConnection | ( | SntpClientContext * | context | ) | 
Close UDP connection.
- Parameters
- 
  [in] context Pointer to the SNTP client context 
Definition at line 89 of file sntp_client_misc.c.
◆ sntpClientOpenConnection()
| error_t sntpClientOpenConnection | ( | SntpClientContext * | context | ) | 
Open UDP connection.
- Parameters
- 
  [in] context Pointer to the SNTP client context 
- Returns
- Error code
Definition at line 51 of file sntp_client_misc.c.
◆ sntpClientParseResponse()
| error_t sntpClientParseResponse | ( | SntpClientContext * | context, | 
| NtpTimestamp * | timestamp | ||
| ) | 
Parse NTP server's response.
- Parameters
- 
  [in] context Pointer to the SNTP client context [out] timestamp Pointer to the NTP timestamp 
- Returns
- Error code
Definition at line 309 of file sntp_client_misc.c.
◆ sntpClientReceiveResponse()
| error_t sntpClientReceiveResponse | ( | SntpClientContext * | context | ) | 
Wait for NTP server's response.
- Parameters
- 
  [in] context Pointer to the SNTP client context 
- Returns
- Error code
Definition at line 166 of file sntp_client_misc.c.
◆ sntpClientSendRequest()
| error_t sntpClientSendRequest | ( | SntpClientContext * | context | ) | 
Send request to the NTP server.
- Parameters
- 
  [in] context Pointer to the SNTP client context 
- Returns
- Error code
Definition at line 107 of file sntp_client_misc.c.
