2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
14 /* Include afs installation dir retrieval routines */
15 #include <afs/dirpath.h>
17 /* These macros are return values from extractAddr. They do not represent
18 * any valid IP address and so can indicate a failure.
20 #define AFS_IPINVALID 0xffffffff /* invalid IP address */
21 #define AFS_IPINVALIDIGNORE 0xfffffffe /* no input given to extractAddr */
29 extern int serverLogSyslog;
30 extern int serverLogSyslogFacility;
32 extern void FSLog(const char *format, ...);
33 #define ViceLog(level, str) if ((level) <= LogLevel) (FSLog str)
35 extern int OpenLog(const char *filename);
36 extern int ReOpenLog(const char *fileName);
37 extern void SetupLogSignals(void);
40 /* special version of ctime that clobbers a *different static variable, so
41 * that ViceLog can call ctime and not cause buffer confusion.
43 extern char *vctime(const time_t *atime);
45 /* Need a thead safe ctime for pthread builds. Use std ctime for LWP */
46 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
48 #define afs_ctime(C, B, L) ctime_r(C, B, L)
50 /* Cast is for platforms which do not prototype ctime_r */
51 #define afs_ctime(C, B, L) (char*)ctime_r(C, B)
52 #endif /* AFS_SUN5_ENV */
53 #else /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
54 #define afs_ctime(C, B, S) \
55 ((void)strncpy(B, ctime(C), (S-1)), (B)[S-1] = '\0', (B))
56 #endif /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
59 /* Convert a 4 byte integer to a text string. */
60 extern char* afs_inet_ntoa(afs_uint32 addr);
61 extern char* afs_inet_ntoa_r(afs_uint32 addr, char *buf);
63 /* copy strings, converting case along the way. */
64 extern char *lcstring(char *d, char *s, int n);
65 extern char *ucstring(char *d, char *s, int n);
66 extern char *strcompose(char *buf, size_t len, ...);
68 /* abort the current process. */
70 #define afs_abort() afs_NTAbort()
72 #define afs_abort() abort()
81 /* Initialize the windows sockets before calling networking routines. */
82 extern int afs_winsockInit(void);
85 int tz_minuteswest; /* of Greenwich */
86 int tz_dsttime; /* type of dst correction to apply */
88 #define gettimeofday afs_gettimeofday
89 int afs_gettimeofday(struct timeval *tv, struct timezone *tz);
91 /* Unbuffer output when Un*x would do line buffering. */
92 #define setlinebuf(S) setvbuf(S, NULL, _IONBF, 0)
94 /* regular expression parser for NT */
95 extern char *re_comp(char *sp);
96 extern int rc_exec(char *p);
98 /* Abort on error, possibly trapping to debugger or dumping a trace. */
99 void afs_NTAbort(void);
102 /* get temp dir path */
103 char *gettmpdir(void);
105 /* Base 32 conversions used for NT since directory names are
108 typedef char b32_string_t[8];
109 char *int_to_base32(b32_string_t s, int a);
110 int base32_to_int(char *s);
112 #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
113 /* base 64 converters for namei interface. Flip bits to differences are
116 typedef char lb64_string_t[12];
118 #define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (afs_int64)(A))
119 char *int64_to_flipbase64(b64_string_t s, afs_int64 a);
120 afs_int64 flipbase64_to_int64(char *s);
122 #define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (u_int64_t)(A))
123 char *int64_to_flipbase64(b64_string_t s, u_int64_t a);
124 int64_t flipbase64_to_int64(char *s);
129 #include "afs/ktime.h"
131 #include "afsutil_prototypes.h"
133 #endif /* _AFSUTIL_H_ */