m2mb API docs  37.00.004.1
m2mb API sets documentation
m2mb_ntp.h File Reference

m2m base api for ntp functionalities More...

Go to the source code of this file.

#define M2MB_NTP_DEF_PORT   123
 NTP defaults. More...
 
#define M2MB_NTP_DEF_TIMEOUT   10
 
enum  M2MB_NTP_EVENTS_E {
  M2MB_NTP_VALID_TIME = 0, M2MB_NTP_ERR_NOT_ENOUGH_RESOURCES = -1, M2MB_NTP_ERR_REG_TIMEOUT = -2, M2MB_NTP_ERR_CONN_ERR = -3,
  M2MB_NTP_ERR_CONN_TIMEOUT = -4, M2MB_NTP_ERR_HOST_RESOLVE = -5, M2MB_NTP_ERR_INVALID_PARAMETER = -6, M2MB_NTP_ERR_SOCK_OPEN = -7,
  M2MB_NTP_ERR_TX_TIMEOUT = -8, M2MB_NTP_ERR_TX_ERROR = -9, M2MB_NTP_ERR_RX_TIMEOUT = -11, M2MB_NTP_ERROR = -20,
  M2MB_NTP_ERR_SERVER_AUTH_FAIL = -30, M2MB_NTP_ERR_KEYS_FILE_MISSING = -31
}
 NTP Events. More...
 
enum  M2MB_NTP_AUTH_TYPE_E { m2mb_ntp_noAuth = 0, m2mb_ntp_symmetricKey = 1, m2mb_ntp_autokey = 2 }
 Authentication options. More...
 
enum  M2MB_NTP_CFG_E {
  M2MB_NTP_CFG_TIMEOUT = 0, M2MB_NTP_CFG_PORT = 1, M2MB_NTP_CFG_SERVER = 2, M2MB_NTP_CFG_AUTH_TYPE = 3,
  M2MB_NTP_CFG_AUTH_KEYID = 4, M2MB_NTP_CFG_AUTH_KEYSFILE = 5
}
 
typedef HANDLE M2MB_NTP_HANDLE
 
typedef void(* m2mb_ntp_callback) (M2MB_NTP_HANDLE handle, M2MB_NTP_EVENTS_E ntp_event, UINT16 resp_size, void *resp_struct, void *cb_args)
 This is the ntp user callback function prototype. More...
 
M2MB_RESULT_E m2mb_ntp_init (M2MB_NTP_HANDLE *pHandle, m2mb_ntp_callback callback, void *cb_args)
 This is the ntp initialization function. More...
 
M2MB_RESULT_E m2mb_ntp_setCid (M2MB_NTP_HANDLE handle, INT16 cid)
 Set the CID to be used with NTP. More...
 
M2MB_RESULT_E m2mb_ntp_setCfg (M2MB_NTP_HANDLE handle, M2MB_NTP_CFG_E param, void *value)
 Set the one of the NTP parameters. More...
 
M2MB_RESULT_E m2mb_ntp_queryServerTime (M2MB_NTP_HANDLE handle)
 This is the ntp query function. More...
 
M2MB_RESULT_E m2mb_ntp_getVersion (M2MB_NTP_HANDLE handle, CHAR *version, UINT16 maxlen)
 This is the ntp version get function. More...
 
M2MB_RESULT_E m2mb_ntp_deinit (M2MB_NTP_HANDLE handle)
 This is the ntp deinitialization function. More...
 

Detailed Description

m2m base api for ntp functionalities

m2m/m2m_generic/common/m2mb_inc/m2mb_ntp.h

SNTP (RFC2030) implementation, providing time synchronization functionality. RFC5905 (symmetric key authentication) is implemented.

@notes Dependencies: m2mb_types.h

Author
Fabio Pintus Davide Cubeddu (porting)
Date
09/04/2019