tabular_output: move public headers
[openafs.git] / src / util / afsutil.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
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
8  */
9
10 #ifndef _AFSUTIL_H_
11 #define _AFSUTIL_H_
12
13 #include <time.h>
14 /* Include afs installation dir retrieval routines */
15 #include <afs/dirpath.h>
16
17 /* These macros are return values from extractAddr. They do not represent
18  * any valid IP address and so can indicate a failure.
19  */
20 #define AFS_IPINVALID           0xffffffff      /* invalid IP address */
21 #define AFS_IPINVALIDIGNORE     0xfffffffe      /* no input given to extractAddr */
22
23 /* logging defines
24  */
25 #ifndef AFS_NT40_ENV
26 #include <sys/types.h>
27 #include <sys/socket.h>
28 #include <netinet/in.h>
29 #include <arpa/inet.h> /* for inet_ntoa() */
30 #endif
31
32 #include <stdio.h>
33 #include <stdarg.h>
34 #include <string.h>
35
36 extern int LogLevel;
37 extern int mrafsStyleLogs;
38 #ifndef AFS_NT40_ENV
39 extern int serverLogSyslog;
40 extern int serverLogSyslogFacility;
41 extern char *serverLogSyslogTag;
42 #endif
43 extern void vFSLog(const char *format, va_list args)
44         AFS_ATTRIBUTE_FORMAT(__printf__, 1, 0);
45
46 extern void SetLogThreadNumProgram(int (*func) (void) );
47
48 extern void FSLog(const char *format, ...)
49         AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
50
51 #define ViceLog(level, str)  do { if ((level) <= LogLevel) (FSLog str); } while (0)
52 #define vViceLog(level, str) do { if ((level) <= LogLevel) (vFSLog str); } while (0)
53 #define ViceLogThenPanic(level, str) \
54     do { ViceLog(level, str); osi_Panic str; } while(0);
55
56 extern int OpenLog(const char *filename);
57 extern int ReOpenLog(const char *fileName);
58 extern void SetupLogSignals(void);
59
60 #ifdef AFS_NT40_ENV
61 #ifndef _MFC_VER
62 #include <winsock2.h>
63 #endif /* _MFC_VER */
64
65 /* Initialize the windows sockets before calling networking routines. */
66      extern int afs_winsockInit(void);
67      extern void afs_winsockCleanup(void);
68
69 /* Unbuffer output when Un*x would do line buffering. */
70 #define setlinebuf(S) setvbuf(S, NULL, _IONBF, 0)
71
72 #endif /* AFS_NT40_ENV */
73
74 #ifndef HAVE_POSIX_REGEX
75 extern char *re_comp(const char *sp);
76 extern int re_exec(const char *p1);
77 #endif
78
79      typedef char b32_string_t[8];
80 /* b64_string_t is 8 bytes, in stds.h */
81      typedef char lb64_string_t[12];
82
83 #include <afs/ktime.h>
84 #include "afsutil_prototypes.h"
85
86 #endif /* _AFSUTIL_H_ */