2 * FILE: $Header: /home/egg/src/RCS/genlib.h,v 1.3 1999/02/28 20:05:35 ghn Exp $
3 * PURPOSE: Define general library interface
9 * Revision 1.3 1999/02/28 20:05:35 ghn
10 * Version 5.1: Changed dquad2sockaddr interface to support ip/mm mask,
11 * created hl2dquad to translate host-long to dotted quad, and modified
12 * sockaddr2dquad to use this.
14 * Revision 1.2 1998/12/31 22:11:05 ghn
15 * Rev 5 code: includes multi-reg support, HTML, etc.
17 * Revision 1.1 1998/07/21 11:38:04 ghn
20 * Copyright 1998 - Greg Nelson
27 #include <netinet/in.h>
33 /* This is actually 366 * 24 * 60 * 60, as opposed the actual length
34 of the mean solar year which is about 365.2524 days. */
35 #define SEC_PER_YEAR 31622400L
38 /* Get time in GMT reference frame. If ztv is NULL, simply returns
39 seconds. Otherwise, returns complete timeval in ztv as well. */
40 extern uint32 getzulutime(struct timeval *ztv);
42 /* Get difference in msec between two tvs. */
43 extern int32 deltams(struct timeval *tv1, struct timeval *tv2);
45 /* Look up an EGG id. */
46 extern uint16 GetID(void);
48 /* Create a proper checksummed and packetized byte stream from the raw
49 data in memory. Return result is malloc'ed, so should be freed by
51 extern char *Packetize(EggCarton *src);
53 extern int32 Unpacketize(EggCarton *dst, char *src);
55 /* Compute CRC16 checksum given block and length (from crc16.c) */
56 extern uint16 BlockCRC16(byte *block, uint32 len);
58 extern void Parse(char *input, int *argc, char *argv[]);
59 extern char *mallocpy(char *input);
60 extern void dquad2sockaddr(struct sockaddr_in *sinp, int16 *mask, char *dquad);
61 extern char *sockaddr2dquad(struct sockaddr_in *sinp); /* Static buffer! */
62 extern char *hl2dquad(uint32 addr); /* Static buffer! */
65 /* Access to system or emulated usleep(). */
68 extern void sf_usleep(unsigned t);
69 #define Usleep sf_usleep
75 #endif /* _GENLIB_H */