Debian Codegraph @

include/libadmin/libadmin.h

raw
1 /** BEGIN COPYRIGHT BLOCK
2 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
3 * Copyright (C) 2005 Red Hat, Inc.
4 * All rights reserved.
5 *
6 * License: GPL (version 3 or any later version).
7 * See LICENSE for details.
8 * END COPYRIGHT BLOCK **/
9
10 #ifdef HAVE_CONFIG_H
11 #include <config.h>
12 #endif
13
14 /*
15 * libadmin.h - All functions contained in libadmin.a
16 *
17 * All blame goes to Mike McCool
18 */
19
20 #ifndef libadmin_h
21 #define libadmin_h
22
23 #include <stdio.h>
24 #include <limits.h>
25 #include "base/systems.h"
26 #include "base/systhr.h"
27 #include "base/util.h"
28 #include <unistd.h>
29 #include "prinit.h"
30 #include "prthread.h"
31 #include "prlong.h"
32
33 #define NSPR_INIT(Program) (PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 8))
34
35 NSPR_BEGIN_EXTERN_C
36
37 /* error types */
38 #define FILE_ERROR 0
39 #define MEMORY_ERROR 1
40 #define SYSTEM_ERROR 2
41 #define INCORRECT_USAGE 3
42 #define ELEM_MISSING 4
43 #define REGISTRY_DATABASE_ERROR 5
44 #define NETWORK_ERROR 6
45 #define GENERAL_FAILURE 7
46 #define WARNING 8
47
48 /* The upper bound on error types */
49 #define MAX_ERROR 9
50
51 /* The default error type (in case something goes wrong */
52 #define DEFAULT_ERROR 3
53
54 #define INFO_IDX_NAME "infowin"
55 #define INFO_TOPIC_NAME "infotopic"
56 #define HELP_WIN_OPTIONS "'resizable=1,width=500,height=500'"
57
58 /* Initialize libadmin. Should be called by EVERY CGI. */
59 /* util.c */
60 NSAPI_PUBLIC int ADM_Init(void);
61
62 /* Since everyone seems to be doing this independently, at least centralize
63 the code. Useful for onClicks and automatic help */
64 NSAPI_PUBLIC char *helpJavaScript(void);
65 NSAPI_PUBLIC char *helpJavaScriptForTopic(char *topic);
66
67 /* Report an error. Takes 3 args: 1. Category of error
68 * 2. Some more specific category info (opt)
69 * 3. A short explanation of the error.
70 *
71 * report_warning: same thing except doesn't exit when done whining
72 */
73 /* error.c */
74 NSAPI_PUBLIC void output_alert(int type, char *info, char *details, int wait);
75 NSAPI_PUBLIC void report_error(int type, char *info, char *details);
76 NSAPI_PUBLIC void report_warning(int type, char *info, char *details);
77
78 /* Word wrap a string to fit into a JavaScript alert box. */
79 /* str is the string, width is the width to wrap to, linefeed is the string
80 * to use as a linefeed. */
81 /* util.c */
82 #define WORD_WRAP_WIDTH 80
83 NSAPI_PUBLIC char *alert_word_wrap(char *str, int width, char *linefeed);
84
85 /* Get the admin/userdb directory. */
86 /* util.c */
87 NSAPI_PUBLIC char *get_userdb_dir(void);
88
89 NSAPI_PUBLIC char *cookieValue(char *, char *);
90
91 NSPR_END_EXTERN_C
92
93 #endif /* libadmin_h */