Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ntp.c File Reference


Detailed Description

Detection of a local NTP server.

Author:
Raphael Manfredi
Date:
2004

#include "common.h"
#include "ntp.h"
#include "settings.h"
#include "sockets.h"
#include "if/core/hosts.h"
#include "if/gnet_property.h"
#include "if/gnet_property_priv.h"
#include "lib/cq.h"
#include "lib/endian.h"
#include "lib/misc.h"
#include "lib/tm.h"
#include "lib/override.h"

Data Structures

struct  ntp_msg
 An NTP message, as described in RFC2030 (trailing auth-data ignored). More...

Defines

#define OFFSET_1900   2208988800U
 secs between 1900 and the Epoch
#define NTP_FP_SCALE   4294967296.0
 NTP fixed-point scaling base.
#define NTP_WAIT_MS   (5*1000)
 Wait at most 5 secs for reply.
#define NTP_VERSION   3
 Say we're version 3.
#define NTP_CLIENT   3
 Mode for unicast request.
#define NTP_SERVER   4
 Mode for server reply.
#define NTP_AUTHSIZE   20
 Size of NTP auth, when present.
#define NTP_MINSIZE   sizeof(struct ntp_msg)
#define NTP_MAXSIZE   (NTP_MINSIZE + NTP_AUTHSIZE)

Functions

void ntp_tm_serialize (guchar dest[8], tm_t *t)
 Fill 8-byte buffer with NTP's representation of a tm_t time.
void ntp_tm_deserialize (const guchar src[8], tm_t *dest)
 Construct a tm_t time from an NTP timestamp.
void ntp_no_reply (cqueue_t *unused_cq, gpointer unused_udata)
 Callout queue timeout when no reply is received within a reasonable timeframe.
gboolean ntp_send_probe (const host_addr_t addr)
gboolean ntp_send_probes (void)
void ntp_probe (void)
 Send an NTP probe to the local host using the loopback addresses 127.0.0.1 and ::1, waiting for a reply within the next NTP_WAIT_MS ms.
void ntp_got_reply (struct gnutella_socket *s)
 Got a reply from an NTP daemon.
void ntp_init (void)
 Initialize the NTP monitoring.
void ntp_close (void)
 Shutdown the NTP monitoring.

Variables

cevent_twait_ev
 Callout queue waiting event.


Define Documentation

#define NTP_AUTHSIZE   20
 

Size of NTP auth, when present.

#define NTP_CLIENT   3
 

Mode for unicast request.

#define NTP_FP_SCALE   4294967296.0
 

NTP fixed-point scaling base.

#define NTP_MAXSIZE   (NTP_MINSIZE + NTP_AUTHSIZE)
 

#define NTP_MINSIZE   sizeof(struct ntp_msg)
 

#define NTP_SERVER   4
 

Mode for server reply.

#define NTP_VERSION   3
 

Say we're version 3.

#define NTP_WAIT_MS   (5*1000)
 

Wait at most 5 secs for reply.

#define OFFSET_1900   2208988800U
 

secs between 1900 and the Epoch


Function Documentation

void ntp_close void   ) 
 

Shutdown the NTP monitoring.

void ntp_got_reply struct gnutella_socket s  ) 
 

Got a reply from an NTP daemon.

void ntp_init void   ) 
 

Initialize the NTP monitoring.

void ntp_no_reply cqueue_t unused_cq,
gpointer  unused_udata
[static]
 

Callout queue timeout when no reply is received within a reasonable timeframe.

void ntp_probe void   ) 
 

Send an NTP probe to the local host using the loopback addresses 127.0.0.1 and ::1, waiting for a reply within the next NTP_WAIT_MS ms.

gboolean ntp_send_probe const host_addr_t  addr  )  [static]
 

gboolean ntp_send_probes void   )  [static]
 

void ntp_tm_deserialize const guchar  src[8],
tm_t dest
[static]
 

Construct a tm_t time from an NTP timestamp.

void ntp_tm_serialize guchar  dest[8],
tm_t t
[static]
 

Fill 8-byte buffer with NTP's representation of a tm_t time.


Variable Documentation

cevent_t* wait_ev [static]
 

Callout queue waiting event.


Generated on Sat Jun 30 17:53:29 2007 for gtk-gnutella by  doxygen 1.3.9.1