Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ntp / include / ntpsim.h
blobbfb13b5b2dac5b2b4062b7da355a76c227fdd669
1 /* $NetBSD$ */
3 /*
4 * ntpsim.h - Prototypes for ntpsim
5 */
7 #ifndef __ntpsim_h
8 #define __ntpsim_h
10 #include <stdio.h>
11 #include <math.h>
12 #include <sys/socket.h>
13 #include <arpa/inet.h>
14 #include "ntp_syslog.h"
15 #include "ntp_fp.h"
16 #include "ntp.h"
17 #include "ntp_select.h"
18 #include "ntp_malloc.h"
19 #include "ntp_refclock.h"
20 #include "recvbuff.h"
21 #include "ntp_io.h"
22 #include "ntp_stdlib.h"
24 #define PI 3.1415926535
27 * ntpsim declarations
29 typedef enum {
30 BEEP, CLOCK, TIMER, PACKET
31 } funcTkn;
33 typedef struct {
34 double time;
35 union {
36 struct pkt evnt_pkt;
37 struct recvbuf evnt_buf;
38 } buffer;
39 #define ntp_pkt buffer.evnt_pkt
40 #define rcv_buf buffer.evnt_buf
41 funcTkn function;
42 } Event;
44 typedef struct List {
45 Event event;
46 struct List *next;
47 } *Queue;
49 typedef struct nde {
50 double time; /* simulation time */
51 double sim_time; /* end simulation time */
52 double ntp_time; /* client disciplined time */
53 double adj; /* remaining time correction */
54 double slew; /* correction slew rate */
56 double clk_time; /* server time */
57 double ferr; /* frequency errort */
58 double fnse; /* random walk noise */
59 double ndly; /* network delay */
60 double snse; /* phase noise */
61 double pdly; /* processing delay */
62 double bdly; /* beep interval */
64 double last_time; /* last clock read time */
65 Queue events; /* Node Event Queue */
66 struct recvbuf *rbuflist; /* Node Receive Buffer */
67 } Node;
70 * Function prototypes
72 int ntpsim P((int argc, char *argv[]));
73 Event event P((double, funcTkn));
74 Queue queue P((Event, Queue ));
75 Node node P((void));
76 void push P((Event, Queue *));
77 Event pop P((Queue *));
78 void ndbeep P((Node *, Event));
79 void ndeclk P((Node *, Event));
80 void ntptmr P((Node *, Event));
81 void netpkt P((Node *, Event));
82 int srvr_rply P((Node *, struct sockaddr_storage *,
83 struct interface *, struct pkt *));
84 double gauss P((double, double));
85 double poisson P((double, double));
86 int node_clock P((Node *, double));
87 void abortsim P((char *));
90 * The global Node
92 Node ntp_node;
94 #endif