File nut/pro/sntp.c


Included Files


Preprocessor definitions

#define NUT_THREAD_SNTPSTACK 256

#define NTP_PORT 123

#define SNTP_PORT NTP_PORT


Typedef sntpframe

typedef struct _sntpframe sntpframe
See: Type struct _sntpframe

Type struct _sntpframe

struct _sntpframe
struct _sntpframe  
   {  
      u_char mode;  
      u_char stratum;  
      u_char poll;  
      u_char precision;  
      u_long root_delay;  
      u_long root_dispersion;  
      u_long reference_identifier;  
      u_long reference_ts_sec;  
      u_long reference_ts_frac;  
      u_long originate_ts_sec;  
      u_long originate_ts_frac;  
      u_long receive_ts_sec;  
      u_long receive_ts_frac;  
      u_long transmit_ts_sec;  
      u_long transmit_ts_frac;  
   }  

Type struct SNTP_resync_args

struct SNTP_resync_args
struct SNTP_resync_args  
   {  
      u_long server_addr;  
      u_long interval;  
   }  

Global Function NutSNTPGetTime()

int NutSNTPGetTime ( u_long* server_adr, time_t* t )
Prototyped in: nut/include/pro/sntp.h
Calls: NutHeapAllocClear() nut/os/heap.c
  NutHeapFree() nut/os/heap.c
  NutUdpCreateSocket(), NutUdpDestroySocket(), NutUdpReceiveFrom(), NutUdpSendTo(), NutUdpSetSockOpt(), __byte_swap4()
Called by: SNTP_resync() nut/pro/sntp.c

Global Function NutSNTPStartThread()

int NutSNTPStartThread ( u_long server_addr, u_long interval )
Prototyped in: nut/include/pro/sntp.h
Calls: NutHeapAlloc() nut/os/heap.c
  NutHeapFree() nut/os/heap.c
  NutThreadCreate()
References Functions: SNTP_resync() nut/pro/sntp.c

Global Function SNTP_resync()

void SNTP_resync ( void* arg )
Prototyped in: nut/pro/sntp.c
Calls: NutHeapFree() nut/os/heap.c
  NutSNTPGetTime() nut/pro/sntp.c
  NutSleep() nut/os/timer.c
  NutThreadSetPriority() nut/os/thread.c
  stime()
Used in: NutSNTPStartThread() nut/pro/sntp.c