]>
Commit | Line | Data |
---|---|---|
88840341 | 1 | /* |
88840341 RC |
2 | chronyd/chronyc - Programs for keeping computer clocks accurate. |
3 | ||
4 | ********************************************************************** | |
5 | * Copyright (C) Richard P. Curnow 1997-2002 | |
cb74f3e7 | 6 | * Copyright (C) Miroslav Lichvar 2014 |
88840341 RC |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of version 2 of the GNU General Public License as | |
10 | * published by the Free Software Foundation. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License along | |
18 | * with this program; if not, write to the Free Software Foundation, Inc., | |
8e23110a | 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
88840341 RC |
20 | * |
21 | ********************************************************************** | |
22 | ||
23 | ======================================================================= | |
24 | ||
25 | This is the header file for the NTP socket I/O bits. | |
26 | ||
27 | */ | |
28 | ||
29 | #ifndef GOT_NTP_IO_H | |
30 | #define GOT_NTP_IO_H | |
31 | ||
32 | #include "ntp.h" | |
33 | #include "addressing.h" | |
be3158c4 | 34 | #include "socket.h" |
88840341 RC |
35 | |
36 | /* Function to initialise the module. */ | |
27e20a56 | 37 | extern void NIO_Initialise(void); |
88840341 RC |
38 | |
39 | /* Function to finalise the module */ | |
40 | extern void NIO_Finalise(void); | |
41 | ||
9a657cd4 | 42 | /* Function to obtain a socket for sending client packets */ |
6d1dda0f | 43 | extern int NIO_OpenClientSocket(NTP_Remote_Address *remote_addr); |
9a657cd4 ML |
44 | |
45 | /* Function to obtain a socket for sending server/peer packets */ | |
6d1dda0f | 46 | extern int NIO_OpenServerSocket(NTP_Remote_Address *remote_addr); |
9a657cd4 | 47 | |
6d1dda0f | 48 | /* Function to close a socket returned by NIO_OpenClientSocket() */ |
cf12d72f ML |
49 | extern void NIO_CloseClientSocket(int sock_fd); |
50 | ||
5214d42c ML |
51 | /* Function to close a socket returned by NIO_OpenServerSocket() */ |
52 | extern void NIO_CloseServerSocket(int sock_fd); | |
53 | ||
91e74c70 ML |
54 | /* Function to check if socket is a server socket */ |
55 | extern int NIO_IsServerSocket(int sock_fd); | |
56 | ||
00498631 ML |
57 | /* Function to check if a server socket is currently open */ |
58 | extern int NIO_IsServerSocketOpen(void); | |
59 | ||
8b9021bf ML |
60 | /* Function to check if client packets can be sent to a server */ |
61 | extern int NIO_IsServerConnectable(NTP_Remote_Address *remote_addr); | |
62 | ||
be3158c4 ML |
63 | /* Function to unwrap an NTP message from non-native transport (e.g. PTP) */ |
64 | extern int NIO_UnwrapMessage(SCK_Message *message, int sock_fd); | |
65 | ||
88840341 | 66 | /* Function to transmit a packet */ |
8f6a1b53 ML |
67 | extern int NIO_SendPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr, |
68 | NTP_Local_Address *local_addr, int length, int process_tx); | |
88840341 | 69 | |
88840341 | 70 | #endif /* GOT_NTP_IO_H */ |