Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.11.1.2
openapi_ntp.h
Go to the documentation of this file.
1 
9 /*********************************************************************
10 *
11 * Copyright 2021-2023 Broadcom.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 **********************************************************************
26 *
27 * @filename openapi_ntp.h
28 *
29 * @purpose NTP Configuration and Status
30 *
31 * @component OpEN
32 *
33 * @create 23/09/2021
34 *
35 * @end
36 *
37 **********************************************************************/
38 #ifndef OPENAPI_NTP_H_INCLUDED
39 #define OPENAPI_NTP_H_INCLUDED
40 
41 #include "openapi_common.h"
42 #include "openapi_routing.h"
43 
44 #define OPEN_NTP_BUFFER_SIZE 256
45 #define OPEN_SECS_PER_MIN 60
46 #define OPEN_NTP_DATE_STRING_SIZE 21
47 #define OPEN_NTP_MIN_KEY_LENGTH 1
48 #define OPEN_NTP_MAX_KEY_LENGTH 129
49 #define OPEN_NTP_MIN_KEY_NUM 1
50 #define OPEN_NTP_MAX_KEY_NUM 65535
51 #define OPEN_VRF_MAX_NAME 15
52 #define OPEN_NTP_MAX_SERVERS 8
53 
55 typedef enum
56 {
61 
62 
64 typedef enum
65 {
71 
73 typedef enum
74 {
80 
82 typedef enum
83 {
93 
94 typedef enum
95 {
105 
106 /* NTP Message Authentication Algorithms supported. */
107 typedef enum
108 {
109  OPEN_NTP_MSG_AUTH_ALG_NONE = 0,
110  OPEN_NTP_MSG_AUTH_ALG_MD5,
111  OPEN_NTP_MSG_AUTH_ALG_SHA1,
112  OPEN_NTP_MSG_AUTH_ALG_SHA256
113 } OPEN_NTP_MSG_AUTH_ALG_t;
114 
115 /*****************************************************************/
131  uint32_t offset);
132 
133 /*****************************************************************/
157  open_buffdesc *ipAddr);
158 
159 /*****************************************************************/
176  uint32_t *maxNtpServers);
177 
178 /*****************************************************************/
200  open_buffdesc *ipAddr);
201 
202 /*****************************************************************/
217  uint32_t *ntpServerAddrLen);
218 
219 /*****************************************************************/
237  open_buffdesc *ntpServer);
238 
239 /*****************************************************************/
259  open_buffdesc *ntpServer,
260  open_buffdesc *nextNtpServer);
261 
262 /*****************************************************************/
279  open_buffdesc *ntpServer,
280  OPEN_NTP_ADDRESS_TYPE_t *ntpServerAddrType);
281 
282 /*****************************************************************/
302  OPEN_NTP_MODE_t mode);
303 
304 /*****************************************************************/
319  OPEN_NTP_MODE_t *ntpMode);
320 
321 /*****************************************************************/
336  OPEN_NTP_SUPPORTED_MODE_t *ntpSupportedMode);
337 
338 
339 /*****************************************************************/
356 
357 /*****************************************************************/
377  open_buffdesc *ntpServer);
378 
379 /*****************************************************************/
395  uint32_t *stratum);
396 
397 /*****************************************************************/
413  open_buffdesc *reference);
414 
415 /*****************************************************************/
429  uint32_t *refStrLen);
430 
431 /*****************************************************************/
446  OPEN_NTP_SERVER_MODE_t *serverMode);
447 
448 /*****************************************************************/
463  uint32_t *currEntries);
464 
465 /*****************************************************************/
483  OPEN_BOOL_t mode);
484 
485 /*****************************************************************/
502  OPEN_BOOL_t *mode);
503 
504 /*****************************************************************/
520  uint32_t delay);
521 
522 /*****************************************************************/
538  uint32_t *delay);
539 
540 /******************************************************************/
556  uint32_t intIfNum);
557 
558 /******************************************************************/
574  uint32_t *intIfNum);
575 
576 /******************************************************************/
592  open_buffdesc *vrfName);
593 
594 /******************************************************************/
610  open_buffdesc *vrfName);
611 
612 /*****************************************************************/
631  open_buffdesc *ntpServer, uint32_t keyIndex);
632 
633 /*****************************************************************/
651  open_buffdesc *ntpServer, uint32_t *keyIndex);
652 
653 /*****************************************************************/
671  open_buffdesc *ntpServer, uint16_t interval);
672 
673 /*****************************************************************/
691  open_buffdesc *ntpServer, uint16_t *interval);
692 
693 /*****************************************************************/
711  open_buffdesc *ntpServer, uint16_t interval);
712 
713 /*****************************************************************/
731  open_buffdesc *ntpServer, uint16_t *interval);
732 
733 /*****************************************************************/
751  open_buffdesc *ntpServer, OPEN_BOOL_t prefer);
752 
753 /*****************************************************************/
771  open_buffdesc *ntpServer, OPEN_BOOL_t *prefer);
772 
773 /*****************************************************************/
791  open_buffdesc *ntpServer, OPEN_BOOL_t burst);
792 
793 /*****************************************************************/
811  open_buffdesc *ntpServer, OPEN_BOOL_t *burst);
812 
813 /*****************************************************************/
831  open_buffdesc *ntpServer, OPEN_BOOL_t iburst);
832 
833 /*****************************************************************/
851  open_buffdesc *ntpServer, OPEN_BOOL_t *iburst);
852 
853 /*****************************************************************/
871  open_buffdesc *ntpServer, uint16_t version);
872 
873 /*****************************************************************/
891  open_buffdesc *ntpServer, uint16_t *version);
892 
893 /*****************************************************************/
918  uint32_t keyNumber, open_buffdesc *keyValue,
919  OPEN_BOOL_t isEncrypted, OPEN_NTP_MSG_AUTH_ALG_t msgAuthAlg);
920 
921 /*****************************************************************/
940  uint32_t keyNumber);
941 
942 /*****************************************************************/
963  uint32_t keyNumber,
964  open_buffdesc *keyValue,
965  OPEN_BOOL_t isEncrypted);
966 
967 /*****************************************************************/
987  uint32_t keyNumber,
988  open_buffdesc *keyValue);
989 
990 /*****************************************************************/
1011  uint32_t keyNumber,
1012  OPEN_NTP_MSG_AUTH_ALG_t msgAlg);
1013 
1014 /*****************************************************************/
1034  uint32_t keyNumber,
1035  OPEN_NTP_MSG_AUTH_ALG_t *msgAlg);
1036 
1037 /*****************************************************************/
1057  uint32_t keyNumber,
1058  OPEN_BOOL_t trustedStatus);
1059 
1060 /*****************************************************************/
1080  uint32_t keyNumber,
1081  OPEN_BOOL_t *trustedStatus);
1082 
1083 /*****************************************************************/
1099  uint32_t *keyNumber);
1100 
1101 /*****************************************************************/
1118  uint32_t *keyNum,
1119  uint32_t *nextKeyNum);
1120 
1121 /*****************************************************************/
1136  open_buffdesc *assocList);
1137 
1138 #endif
1139 
open_error_t openapiNtpBroadcastDelaySet(openapiClientHandle_t *client_handle, uint32_t delay)
Set the Broadcast delay for the NTP application.
open_error_t openapiActiveNtpServerIpAddressGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer)
Get the active NTP server from which last packet is received.
open_error_t openapiNtpServerTableBurstGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, OPEN_BOOL_t *burst)
Get the NTP burst status of the server table entry.
open_error_t openapiNtpAuthenticationModeGet(openapiClientHandle_t *client_handle, OPEN_BOOL_t *mode)
Get the current authentication mode for this application.
open_error_t openapiNtpAuthTableKeyTrustedSet(openapiClientHandle_t *client_handle, uint32_t keyNumber, OPEN_BOOL_t trustedStatus)
Set a key as trusted or untrusted specified by the authenticate table entry index.
open_error_t openapiNtpServerTableMinPollSet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, uint16_t interval)
Set the server minimum poll interval in seconds as a power of two.
open_error_t openapiActiveNtpServerModeGet(openapiClientHandle_t *client_handle, OPEN_NTP_SERVER_MODE_t *serverMode)
Get the mode of the NTP server from which last packet is received.
open_error_t openapiActiveNtpServerStratumGet(openapiClientHandle_t *client_handle, uint32_t *stratum)
Get the stratum of the NTP server from which last packet is received.
open_error_t openapiNtpBroadcastDelayGet(openapiClientHandle_t *client_handle, uint32_t *delay)
Get the Broadcast delay for the NTP application.
open_error_t openapiNtpServerTableVersionSet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, uint16_t version)
Set the NTP version of the server table entry.
open_error_t openapiNtpServerReferenceStringLengthGet(openapiClientHandle_t *client_handle, uint32_t *refStrLen)
Get the maximum length of the NTP reference ID string.
open_error_t openapiNtpAuthTableEntryFirstGet(openapiClientHandle_t *client_handle, uint32_t *keyNumber)
Get the first NTP auth table entry.
open_error_t openapiNtpServerAdd(openapiClientHandle_t *client_handle, open_buffdesc *ipAddr)
Add an NTP server.
open_error_t openapiNtpVrfNameSet(openapiClientHandle_t *client_handle, open_buffdesc *vrfName)
Set the VRF name of the NTP server.
Address type IPv4.
Definition: openapi_ntp.h:76
open_error_t
OPEN uses these enumerators to indicate the error codes.
open_error_t openapiNtpServerCurrentEntriesGet(openapiClientHandle_t *client_handle, uint32_t *currEntries)
Get number of NTP servers configured.
open_error_t openapiNtpServerTableMaxPollGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, uint16_t *interval)
Get the server maximum poll interval in seconds as a power of two.
NTP client mode disabled.
Definition: openapi_ntp.h:57
open_error_t openapiNtpServerNextGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, open_buffdesc *nextNtpServer)
Get the next NTP server.
open_error_t openapiNtpServerMaxAddrLenGet(openapiClientHandle_t *client_handle, uint32_t *ntpServerAddrLen)
Get the maximum length of NTP server address.
open_error_t openapiActiveNtpServerAddressTypeGet(openapiClientHandle_t *client_handle, OPEN_NTP_ADDRESS_TYPE_t *type)
Get the active NTP server address type from which last packet is received.
open_error_t openapiActiveNtpServerReferenceIdGet(openapiClientHandle_t *client_handle, open_buffdesc *reference)
Get the NTP server reference identifier from which last packet is received.
open_error_t openapiNtpAuthTableEntryGetNext(openapiClientHandle_t *client_handle, uint32_t *keyNum, uint32_t *nextKeyNum)
Get the next NTP auth table entry.
open_error_t openapiNtpServerTableMinPollGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, uint16_t *interval)
Get the server minimum poll interval in seconds as a power of two.
open_error_t openapiNtpTimeSet(openapiClientHandle_t *client_handle, uint32_t offset)
Update the local clock with the correction.
open_error_t openapiNtpAuthTableKeyMsgAuthAlgGet(openapiClientHandle_t *client_handle, uint32_t keyNumber, OPEN_NTP_MSG_AUTH_ALG_t *msgAlg)
Get the message authentication algorithm for the specified authentication key table entry index...
open_error_t openapiNtpServerTableVersionGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, uint16_t *version)
Get the NTP version of the server table entry.
open_error_t openapiNtpAuthTableKeyDelete(openapiClientHandle_t *client_handle, uint32_t keyNumber)
Delete an authentication table entry specified by key number.
open_error_t openapiNtpServerTableIBurstGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, OPEN_BOOL_t *iburst)
Get the NTP iburst status of the server table entry.
Server Kiss Of Death.
Definition: openapi_ntp.h:102
open_error_t openapiNtpServerTableBurstSet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, OPEN_BOOL_t burst)
Set the NTP burst status of the server table entry.
OPEN_NTP_MODE_t
OpEN uses this enumeration to define NTP client modes.
Definition: openapi_ntp.h:55
open_error_t openapiNtpServerAddressTypeGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, OPEN_NTP_ADDRESS_TYPE_t *ntpServerAddrType)
Get the NTP server address type.
NTP client broadcast mode.
Definition: openapi_ntp.h:59
open_error_t openapiNtpServerTableMaxPollSet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, uint16_t interval)
Set the server maximum poll interval in seconds as a power of two.
open_error_t openapiNtpAuthenticationModeSet(openapiClientHandle_t *client_handle, OPEN_BOOL_t mode)
Set the current authentication mode for this application.
open_error_t openapiNtpServerTablePreferGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, OPEN_BOOL_t *prefer)
Get the NTP prefer status of the server table entry.
OPEN_NTP_SERVER_MODE_t
OpEN uses this enumeration to define NTP server modes.
Definition: openapi_ntp.h:82
open_error_t openapiNtpAuthTableKeyAdd(openapiClientHandle_t *client_handle, uint32_t keyNumber, open_buffdesc *keyValue, OPEN_BOOL_t isEncrypted, OPEN_NTP_MSG_AUTH_ALG_t msgAuthAlg)
Add a new authentication table entry specified by key number.
OPEN_BOOL_t
OPEN uses these enumerators to indicate true or false for a given config or status parameter...
Kiss of Death as Rate Exceeded.
Definition: openapi_ntp.h:103
NTP client unicast mode.
Definition: openapi_ntp.h:58
open_error_t openapiNtpServerTableAuthKeySet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, uint32_t keyIndex)
Set the authentication key for the specified NTP server table entry.
open_error_t openapiNtpModeSet(openapiClientHandle_t *client_handle, OPEN_NTP_MODE_t mode)
Set the NTP mode.
NTP client unicast mode.
Definition: openapi_ntp.h:67
open_error_t openapiNtpServersMaxSupportedGet(openapiClientHandle_t *client_handle, uint32_t *maxNtpServers)
Get the maximum number of NTP servers supported.
open_error_t openapiNtpServerTableAuthKeyGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, uint32_t *keyIndex)
Get the authentication key for an NTP server table entry.
Address type IPv6.
Definition: openapi_ntp.h:77
Symmetric Passive Mode.
Definition: openapi_ntp.h:86
open_error_t openapiNtpNotifyPeerList(openapiClientHandle_t *client_handle, open_buffdesc *assocList)
Notify NTP application to update the peer list.
OPEN_NTP_ADDRESS_TYPE_t
OpEN uses this enumeration to define NTP address types.
Definition: openapi_ntp.h:73
open_error_t openapiNtpAuthTableKeyValueSet(openapiClientHandle_t *client_handle, uint32_t keyNumber, open_buffdesc *keyValue, OPEN_BOOL_t isEncrypted)
Set the key value of the authenticate table entry.
open_error_t openapiNtpVrfNameGet(openapiClientHandle_t *client_handle, open_buffdesc *vrfName)
Get the VRF name of the NTP server.
open_error_t openapiNtpServerTableIBurstSet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, OPEN_BOOL_t iburst)
Set the NTP iburst status of the server table entry.
open_error_t openapiNtpModeGet(openapiClientHandle_t *client_handle, OPEN_NTP_MODE_t *ntpMode)
Get the NTP mode.
OPEN_NTP_SUPPORTED_MODE_t
OpEN uses this enumeration to define NTP supported client modes.
Definition: openapi_ntp.h:64
open_error_t openapiNtpSupportedModeGet(openapiClientHandle_t *client_handle, OPEN_NTP_SUPPORTED_MODE_t *ntpSupportedMode)
Get the NTP supported mode.
open_error_t openapiNtpAuthTableKeyMsgAuthAlgSet(openapiClientHandle_t *client_handle, uint32_t keyNumber, OPEN_NTP_MSG_AUTH_ALG_t msgAlg)
Set the message authentication algorithm for the specified authentication key table entry index...
open_error_t openapiNtpAuthTableKeyValueGet(openapiClientHandle_t *client_handle, uint32_t keyNumber, open_buffdesc *keyValue)
Get the key number of the authenticate table entry.
Address type unknown.
Definition: openapi_ntp.h:75
NTP client unicast and broadcast modes.
Definition: openapi_ntp.h:69
open_error_t openapiNtpSourceInterfaceSet(openapiClientHandle_t *client_handle, uint32_t intIfNum)
Set the Source Interface of the NTP application.
NTP client broadcast mode.
Definition: openapi_ntp.h:68
NTP client mode disabled.
Definition: openapi_ntp.h:66
OPEN_NTP_PACKET_STATUS_t
Definition: openapi_ntp.h:94
Address type DNS.
Definition: openapi_ntp.h:78
open_error_t openapiNtpServerTablePreferSet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer, OPEN_BOOL_t prefer)
Set the NTP prefer status of the server table entry.
open_error_t openapiNtpServerFirstGet(openapiClientHandle_t *client_handle, open_buffdesc *ntpServer)
Get the first NTP server.
open_error_t openapiNtpSourceInterfaceGet(openapiClientHandle_t *client_handle, uint32_t *intIfNum)
Get the Source Interface of the NTP application.
open_error_t openapiNtpServerDelete(openapiClientHandle_t *client_handle, open_buffdesc *ipAddr)
Delete an NTP server.
open_error_t openapiNtpAuthTableKeyTrustedGet(openapiClientHandle_t *client_handle, uint32_t keyNumber, OPEN_BOOL_t *trustedStatus)
Get a key as trusted or untrusted specified by the authenticate table entry index.