Annotation of embedaddon/ntp/sntp/networking.h, revision 1.1
1.1 ! misho 1: #ifndef NETWORKING_H
! 2: #define NETWORKING_H
! 3:
! 4: #include <arpa/inet.h>
! 5: #include <netinet/in.h>
! 6:
! 7: #include <strings.h>
! 8: #include <errno.h>
! 9: #include <config.h>
! 10: #include <netdb.h>
! 11: #include <unistd.h>
! 12: #include <sys/types.h>
! 13: #include <sys/socket.h>
! 14:
! 15: #include <ntp_rfc2553.h>
! 16: #include <ntp_stdlib.h>
! 17: #include <ntp_machine.h>
! 18: #include <ntp_unixtime.h>
! 19: #include <ntp_fp.h>
! 20: #include <ntp.h>
! 21:
! 22: #include "crypto.h"
! 23: #include "log.h"
! 24: #include "sntp-opts.h"
! 25: #include "utilities.h"
! 26:
! 27: /*
! 28: * for 4.2.6 only define AUTOKEY if OPENSSL, so that backported 4.2.7
! 29: * references to AUTOKEY work -- in 4.2.7 AUTOKEY is independent of OPENSSL
! 30: */
! 31: #ifdef OPENSSL
! 32: #define AUTOKEY
! 33: #endif
! 34:
! 35: /* FIXME To be replaced by the constants in ntp.h */
! 36: #define SERVER_UNUSEABLE -1 /* Skip server */
! 37: #define PACKET_UNUSEABLE -2 /* Discard packet and try to get a useable packet again if not tried too often */
! 38: #define SERVER_AUTH_FAIL -3 /* Authentication failed, act upon settings */
! 39: #define KOD_DEMOBILIZE -4 /* KOD packet with code DENY or RSTR, stop all communication and save KOD information */
! 40: #define KOD_RATE -5 /* KOD packet with code RATE, reduce poll intervall */
! 41: #define BROADCAST_FAILED -6
! 42:
! 43:
! 44: /* From ntpdate.c */
! 45: int is_reachable (struct addrinfo *dst);
! 46:
! 47: int resolve_hosts (const char **hosts, int hostc, struct addrinfo ***res, int pref_family);
! 48:
! 49: void create_socket (SOCKET *rsock, sockaddr_u *dest);
! 50:
! 51: void sendpkt (SOCKET rsock, sockaddr_u *dest, struct pkt *pkt, int len);
! 52:
! 53: int recvdata (SOCKET rsock, sockaddr_u *sender, char *rdata, int rdata_len);
! 54:
! 55: int recvpkt (SOCKET rsock, struct pkt *rpkt, unsigned int rsize, struct pkt *spkt);
! 56:
! 57: int recv_bcst_data (SOCKET rsock, char *rdata, int rdata_len, sockaddr_u *sas, sockaddr_u *ras);
! 58:
! 59: int recv_bcst_pkt (SOCKET rsock, struct pkt *rpkt, unsigned int rsize, sockaddr_u *sas);
! 60:
! 61: int process_pkt (struct pkt *rpkt, sockaddr_u *sas, int pkt_len, int mode, struct pkt *spkt, char * func_name);
! 62:
! 63: /* Shortened peer structure. Not absolutely necessary yet */
! 64: struct speer {
! 65: struct speer *next;
! 66: sockaddr_u srcadr;
! 67: u_char version;
! 68: u_char hmode;
! 69: u_char hpoll;
! 70: u_char minpoll;
! 71: u_char maxpoll;
! 72: u_int flags;
! 73: u_char num_events;
! 74: u_char ttl;
! 75: u_char leap;
! 76: u_char pmode;
! 77: u_char stratum;
! 78: u_char ppoll;
! 79: u_char precision; /* should be s_char */
! 80: u_int32 refid;
! 81: l_fp reftime;
! 82: keyid_t keyid;
! 83:
! 84: #ifdef AUTOKEY
! 85: #define clear_to_zero opcode
! 86: u_int32 opcode; /* last request opcode */
! 87: associd_t assoc; /* peer association ID */
! 88: u_int32 crypto; /* peer status word */
! 89: EVP_PKEY *pkey; /* public key */
! 90: const EVP_MD *digest; /* message digest algorithm */
! 91: char *subject; /* certificate subject name */
! 92: char *issuer; /* certificate issuer name */
! 93: struct cert_info *xinfo; /* issuer certificate */
! 94: keyid_t pkeyid; /* previous key ID */
! 95: keyid_t hcookie; /* host cookie */
! 96: keyid_t pcookie; /* peer cookie */
! 97: const struct pkey_info *ident_pkey; /* identity key */
! 98: BIGNUM *iffval; /* identity challenge (IFF, GQ, MV) */
! 99: const BIGNUM *grpkey; /* identity challenge key (GQ) */
! 100: struct value cookval; /* receive cookie values */
! 101: struct value recval; /* receive autokey values */
! 102: struct exten *cmmd; /* extension pointer */
! 103: u_long refresh; /* next refresh epoch */
! 104:
! 105: /*
! 106: * Variables used by authenticated server
! 107: */
! 108: keyid_t *keylist; /* session key ID list */
! 109: int keynumber; /* current key number */
! 110: struct value encrypt; /* send encrypt values */
! 111: struct value sndval; /* send autokey values */
! 112: #else /* !AUTOKEY follows */
! 113: #define clear_to_zero status
! 114: #endif /* !AUTOKEY */
! 115:
! 116: l_fp rec; /* receive time stamp */
! 117: l_fp xmt; /* transmit time stamp */
! 118: l_fp dst; /* destination timestamp */
! 119: l_fp aorg; /* origin timestamp */
! 120: l_fp borg; /* alternate origin timestamp */
! 121: double offset; /* peer clock offset */
! 122: double delay; /* peer roundtrip delay */
! 123: };
! 124:
! 125:
! 126:
! 127:
! 128:
! 129: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>