1285612Sdelphij#ifndef NTP_IO_H
2285612Sdelphij#define NTP_IO_H
3285612Sdelphij
4285612Sdelphij#include "ntp_workimpl.h"
5285612Sdelphij
654359Sroberto/*
754359Sroberto * POSIX says use <fnct.h> to get O_* symbols and
854359Sroberto * SEEK_SET symbol form <unistd.h>.
954359Sroberto */
10285612Sdelphij#include <sys/types.h>
1154359Sroberto#ifdef HAVE_UNISTD_H
1254359Sroberto# include <unistd.h>
1354359Sroberto#endif
1454359Sroberto#include <stdio.h>
1554359Sroberto#ifdef HAVE_SYS_FILE_H
1654359Sroberto# include <sys/file.h>
1754359Sroberto#endif
1854359Sroberto#ifdef HAVE_FCNTL_H
1954359Sroberto# include <fcntl.h>
2054359Sroberto#endif
2154359Sroberto#if !defined(SEEK_SET) && defined(L_SET)
2254359Sroberto# define SEEK_SET L_SET
2354359Sroberto#endif
2454359Sroberto
2554359Sroberto#ifdef SYS_WINNT
2654359Sroberto# include <io.h>
2754359Sroberto# include "win32_io.h"
2854359Sroberto#endif
2954359Sroberto
30285612Sdelphij#include <isc/boolean.h>
31285612Sdelphij#include <isc/netaddr.h>
32285612Sdelphij
33285612Sdelphij#if defined(HAVE_NETINET_IN_H) && defined(HAVE_NETINET_IP_H)
34285612Sdelphij# include <netinet/in.h>
35285612Sdelphij# ifdef HAVE_NETINET_IN_SYSTM_H
36285612Sdelphij#  include <netinet/in_systm.h>
37285612Sdelphij# endif
38285612Sdelphij# include <netinet/ip.h>
39285612Sdelphij#endif
40285612Sdelphij
41285612Sdelphij#include "libntp.h"	/* This needs Something above for GETDTABLESIZE */
42285612Sdelphij
43294904Sdelphij#include "ntp_keyacc.h"
44294904Sdelphij
45132451Sroberto/*
46132451Sroberto * Define FNDELAY and FASYNC using O_NONBLOCK and O_ASYNC if we need
47132451Sroberto * to (and can).  This is here initially for QNX, but may help for
48132451Sroberto * others as well...
49132451Sroberto */
50132451Sroberto#ifndef FNDELAY
51132451Sroberto# ifdef O_NONBLOCK
52132451Sroberto#  define FNDELAY O_NONBLOCK
53132451Sroberto# endif
5454359Sroberto#endif
55132451Sroberto
56132451Sroberto#ifndef FASYNC
57132451Sroberto# ifdef O_ASYNC
58132451Sroberto#  define FASYNC O_ASYNC
59132451Sroberto# endif
60132451Sroberto#endif
61132451Sroberto
62285612Sdelphij
63285612Sdelphij/*
64285612Sdelphij * NIC rule match types
65285612Sdelphij */
66285612Sdelphijtypedef enum {
67285612Sdelphij	MATCH_ALL,
68285612Sdelphij	MATCH_IPV4,
69285612Sdelphij	MATCH_IPV6,
70285612Sdelphij	MATCH_WILDCARD,
71285612Sdelphij	MATCH_IFNAME,
72285612Sdelphij	MATCH_IFADDR
73285612Sdelphij} nic_rule_match;
74285612Sdelphij
75285612Sdelphij/*
76285612Sdelphij * NIC rule actions
77285612Sdelphij */
78285612Sdelphijtypedef enum {
79285612Sdelphij	ACTION_LISTEN,
80285612Sdelphij	ACTION_IGNORE,
81285612Sdelphij	ACTION_DROP
82285612Sdelphij} nic_rule_action;
83285612Sdelphij
84285612Sdelphij
85285612Sdelphijextern int	qos;
86285612SdelphijSOCKET		move_fd(SOCKET fd);
87285612Sdelphijisc_boolean_t	get_broadcastclient_flag(void);
88285612Sdelphijextern void	sau_from_netaddr(sockaddr_u *, const isc_netaddr_t *);
89285612Sdelphijextern void	add_nic_rule(nic_rule_match match_type,
90285612Sdelphij			     const char *if_name, int prefixlen,
91285612Sdelphij			     nic_rule_action action);
92285612Sdelphij#ifndef HAVE_IO_COMPLETION_PORT
93285612Sdelphijextern	void	maintain_activefds(int fd, int closing);
94285612Sdelphij#else
95285612Sdelphij#define		maintain_activefds(f, c)	do {} while (0)
96132451Sroberto#endif
97285612Sdelphij
98285612Sdelphij
99285612Sdelphij#endif	/* NTP_IO_H */
100