1
0
mirror of https://frontier.innolan.net/rainlance/amiga-ntimed.git synced 2025-11-19 17:10:09 +00:00

Optimized includes

This commit is contained in:
llsth
2015-03-19 14:41:38 +01:00
parent ac7c9449da
commit 42ffc2e7a4
8 changed files with 130 additions and 184 deletions

View File

@ -27,10 +27,18 @@
#ifndef NTIMED_COMPILER_H
#define NTIMED_COMPILER_H
/*
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <math.h>
#include <sys/socket.h>
/*
* See also:
* http://codewiz.org/projects/amiga/Headers/CompilerSpecific.h
*
*
*/
#ifdef __VBCC__
@ -92,7 +100,7 @@ struct sockaddr_storage {
sa_family_t ss_family; // address family
// all this is padding, implementation specific, ignore it:
char __ss_pad1[128 - sizeof(sa_family_t)];
char __ss_pad1[128 - sizeof(sa_family_t)];
};
#endif

46
configure vendored
View File

@ -50,6 +50,7 @@ SRCS='
main_amiga_client.c
main_amiga_poll.c
main_amiga_sim.c
main_amiga_test.c
combine_delta.c
mem.c
net_getaddrinfo.c
@ -137,6 +138,28 @@ SRCS3='
todo.c
udp.c
'
SRCS4='
main_amiga_test.c
combine_delta.c
mem.c
net_getaddrinfo.c
net_poll.c
ntp_filter.c
ntp_packet.c
ntp_peer.c
ntp_peerset.c
ntp_tools.c
ocx_stdio.c
param.c
pll_std.c
suckaddr.c
time_amiga.c
time_stuff.c
todo.c
udp.c
'
#################################################
if make -v 2>&1 | grep GNU > /dev/null 2>&1 ; then
@ -151,16 +174,16 @@ if $VALID ; then
(
echo '# Portable Makefile generated by configure'
echo ''
echo 'all: ntimed ntimed-poll ntimed-sim'
echo 'all: ntimed ntimed-poll ntimed-sim ntimed-test'
echo ''
if [ -n "$1" ] && [ $1 = "AMIGA" ] ; then
echo 'CC = gcc'
echo "CFLAGS += -O2 -DAOS3 -Wall -Werror"
echo "CFLAGS += -O2 -DAOS3 -DWITHTEST -Wall -Werror"
elif [ -n "$1" ] && [ $1 = "AROS" ] ; then
echo 'CC = gcc'
echo "CFLAGS += -O2 -DAROS -Wall -Werror"
echo "CFLAGS += -O2 -DAROS -DWITHTEST -Wall -Werror"
else
echo "CFLAGS += -O2 -Wall -Werror"
echo "CFLAGS += -O2 -Wall -DWITHTEST -Werror"
fi
echo ''
@ -200,18 +223,24 @@ if $VALID ; then
do
BIN1="${BIN1} `basename $f .c`.o"
done
BIN2=""
for f in ${SRCS2}
do
BIN2="${BIN2} `basename $f .c`.o"
done
BIN3=""
for f in ${SRCS3}
do
BIN3="${BIN3} `basename $f .c`.o"
done
BIN4=""
for f in ${SRCS4}
do
BIN4="${BIN4} `basename $f .c`.o"
done
#################################################
echo
@ -224,8 +253,11 @@ if $VALID ; then
echo "ntimed-sim: ${BIN3}"
echo " \${CC} \${CFLAGS} -o ntimed-sim ${BIN3} -lm"
echo
echo "ntimed-test: ${BIN4}"
echo " \${CC} \${CFLAGS} -o ntimed-test ${BIN4} -lm"
echo
echo "clean:"
echo " rm -f ${l} ntimed ntimed-poll ntimed-sim"
echo " rm -f ${l} ntimed ntimed-poll ntimed-sim ntimed-test"
echo
echo "depend:"
echo " @echo Dependencies already done"

View File

@ -25,67 +25,22 @@
*
*/
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <math.h>
#include <sys/socket.h>
#include <resources/battclock.h>
#include <clib/battclock_protos.h>
#include <clib/utility_protos.h>
#ifdef Debug
#undef Debug
#endif
#ifdef AROS
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <proto/socket.h>
#include <sys/socket.h>
#include <bsdsocket/socketbasetags.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef Debug
#undef Debug
#endif
#endif
#include "tz.h"
#include "ntimed.h"
#include "ntimed_platform.h"
#include "mem.h"
#include "ntimed.h"
#include "tz.h"
#include "ntp.h"
#include "udp.h"
#define ARGSFORMAT "P=PARAM/K,T=TRACEFILE/K,Z=TIMEZONE/K,SERVERS/M,SYNC/S,SAVE/S,QUIET/S"
const char *vers = "\0$VER: ntimed-client 1.0a";
#define PARAM_CLIENT PARAM_INSTANCE
#define PARAM_TABLE_NAME client_param_table
#include "param_instance.h"
#undef PARAM_TABLE_NAME
#undef PARAM_CLIENT
#define ARGSFORMAT "P=PARAM/K,T=TRACEFILE/K,Z=TIMEZONE/K,SERVERS/M,SYNC/S,SAVE/S,QUIET/S"
const char *vers = "\0$VER: ntimed 1.0a";
void Time_Amiga(struct todolist *);
void Time_Amiga_Passive(void);
extern int validtime;
BOOL savetime;

View File

@ -25,56 +25,15 @@
*
*/
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <math.h>
#include <sys/socket.h>
#ifdef Debug
#undef Debug
#endif
#ifdef AROS
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <proto/socket.h>
#include <sys/socket.h>
#include <bsdsocket/socketbasetags.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef Debug
#undef Debug
#endif
#endif
#include "tz.h"
#include "ntimed.h"
#include "ntimed_platform.h"
#include "mem.h"
#include "ntimed.h"
#include "tz.h"
#include "ntp.h"
#include "udp.h"
#define ARGSFORMAT "D=DURATION/N,M=MONITOR/K,T=TRACEFILE/K,Z=TIMEZONE/K,SERVERS/M,QUIET/S"
const char *vers = "\0$VER: ntimed-poll 1.0a";
void Time_Amiga(struct todolist *);
void Time_Amiga_Passive(void);
BOOL started_from_wb;

View File

@ -25,52 +25,14 @@
*
*/
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <math.h>
#include <sys/socket.h>
#ifdef Debug
#undef Debug
#endif
#ifdef AROS
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <proto/socket.h>
#include <sys/socket.h>
#include <bsdsocket/socketbasetags.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef Debug
#undef Debug
#endif
#endif
#include "tz.h"
#include "ntimed.h"
#include "ntimed_platform.h"
#include "mem.h"
#include "ntimed.h"
#include "ntp.h"
#include "udp.h"
#define ARGSFORMAT "P=PARAM/K,B=BUMP/K,T=TRACEFILE/K,SIMFILE/A,QUIET/S"
const char *vers = "\0$VER: ntimed-sim 1.0a";
#define PARAM_CLIENT PARAM_INSTANCE
#define PARAM_TABLE_NAME client_param_table
#include "param_instance.h"
@ -107,9 +69,6 @@ struct Library *SocketBase = NULL;
struct RDArgs *rdargs = NULL;
struct todolist *tdl = NULL;
#define ARGSFORMAT "P=PARAM/K,B=BUMP/K,T=TRACEFILE/K,SIMFILE/A,QUIET/S"
const char *vers = "\0$VER: ntimed-sim 1.0a";
struct ntimedargs {
char *params;
char *bump;

View File

@ -33,6 +33,37 @@
#endif
#endif
#include "mem.h"
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <resources/battclock.h>
#include <clib/battclock_protos.h>
#include <clib/utility_protos.h>
#ifdef AROS
#ifdef Debug
#undef Debug
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <proto/socket.h>
#include <sys/socket.h>
#include <bsdsocket/socketbasetags.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef Debug
#undef Debug
#endif
#endif
#ifdef AOS3
#define ARGPTR STRPTR
#define ARGS_FORMAT ARGSFORMAT

70
ntp.h
View File

@ -56,28 +56,28 @@ enum ntp_state {
/* ntp_packet.c -- [De]Serialisation **********************************/
struct ntp_packet {
unsigned magic;
unsigned magic;
#define NTP_PACKET_MAGIC 0x78b7f0be
enum ntp_leap ntp_leap;
uint8_t ntp_version;
enum ntp_mode ntp_mode;
uint8_t ntp_stratum;
uint8_t ntp_poll;
int8_t ntp_precision;
struct timestamp ntp_delay;
struct timestamp ntp_dispersion;
uint8_t ntp_refid[4];
struct timestamp ntp_reference;
struct timestamp ntp_origin;
struct timestamp ntp_receive;
struct timestamp ntp_transmit;
enum ntp_leap ntp_leap;
uint8_t ntp_version;
enum ntp_mode ntp_mode;
uint8_t ntp_stratum;
uint8_t ntp_poll;
int8_t ntp_precision;
struct timestamp ntp_delay;
struct timestamp ntp_dispersion;
uint8_t ntp_refid[4];
struct timestamp ntp_reference;
struct timestamp ntp_origin;
struct timestamp ntp_receive;
struct timestamp ntp_transmit;
struct timestamp ts_rx;
struct timestamp ts_rx;
};
struct ntp_packet *NTP_Packet_Unpack(struct ntp_packet *dst, void *ptr,
ssize_t len);
ssize_t len);
size_t NTP_Packet_Pack(void *ptr, ssize_t len, struct ntp_packet *);
/* ntp_tools.c -- Handy tools *****************************************/
@ -97,45 +97,45 @@ void NF_Init(void);
struct ntp_peer {
unsigned magic;
unsigned magic;
#define NTP_PEER_MAGIC 0xbf0740a0
char *hostname;
char *ip;
struct sockaddr *sa;
unsigned sa_len;
struct ntp_packet *tx_pkt;
struct ntp_packet *rx_pkt;
char *hostname;
char *ip;
struct sockaddr *sa;
unsigned sa_len;
struct ntp_packet *tx_pkt;
struct ntp_packet *rx_pkt;
ntp_filter_f *filter_func;
void *filter_priv;
ntp_filter_f *filter_func;
void *filter_priv;
struct combiner *combiner;
struct combiner *combiner;
// For ntp_peerset.c
TAILQ_ENTRY(ntp_peer) list;
struct ntp_group *group;
enum ntp_state state;
const struct ntp_peer *other;
// For ntp_peerset.c
TAILQ_ENTRY(ntp_peer) list;
struct ntp_group *group;
enum ntp_state state;
const struct ntp_peer *other;
};
struct ntp_peer *NTP_Peer_New(const char *name, const void *, unsigned);
struct ntp_peer *NTP_Peer_NewLookup(struct ocx *ocx, const char *name);
void NTP_Peer_Destroy(struct ntp_peer *np);
int NTP_Peer_Poll(struct ocx *, const struct udp_socket *,
const struct ntp_peer *, double tmo);
const struct ntp_peer *, double tmo);
/* ntp_peerset.c -- Peer set management ****************************/
struct ntp_peerset *NTP_PeerSet_New(struct ocx *);
void NTP_PeerSet_AddSim(struct ocx *, struct ntp_peerset *,
const char *hostname, const char *ip);
const char *hostname, const char *ip);
int NTP_PeerSet_Add(struct ocx *, struct ntp_peerset *, const char *hostname);
void NTP_PeerSet_Poll(struct ocx *, struct ntp_peerset *, struct udp_socket *,
struct todolist *);
struct todolist *);
struct ntp_peer *NTP_PeerSet_Iter0(const struct ntp_peerset *);
struct ntp_peer *NTP_PeerSet_IterN(const struct ntp_peerset *,
const struct ntp_peer *);
const struct ntp_peer *);
#define NTP_PeerSet_Foreach(var, nps) \
for(var = NTP_PeerSet_Iter0(nps); \

View File

@ -216,6 +216,8 @@ tb_adjust_f *TB_Adjust = tb_Adjust;
* Timebase test functions.
*/
#ifdef WITHTEST
static int
ts_onetest(struct ocx *ocx, const struct timestamp *ts, double off)
{
@ -264,4 +266,4 @@ TS_RunTest(struct ocx *ocx)
AZ(nf);
}
#endif