home *** CD-ROM | disk | FTP | other *** search
/ Programming with VisualAge for Java / IBMVJAVA.ISO / icswin95 / httpdw32.z / ereport.h < prev    next >
C/C++ Source or Header  |  1997-04-07  |  3KB  |  127 lines

  1. /*
  2.  * Original Netscape notice:
  3.  *
  4.  * Copyright (c) 1994, 1995.  Netscape Communications Corporation.  All
  5.  * rights reserved.
  6.  *
  7.  * Use of this software is governed by the terms of the license agreement for
  8.  * the Netscape Communications or Netscape Comemrce Server between the
  9.  * parties.
  10.  *
  11.  *
  12.  * ereport.h: Records transactions, reports errors to administrators, etc.
  13.  *
  14.  * Rob McKewel
  15.  */
  16.  
  17.  
  18.  
  19.  
  20.  
  21. #ifndef NS_EREPORT_H
  22. #define NS_EREPORT_H
  23.  
  24. #include "base/session.h"   /* Session structure */
  25.  
  26. /* for passwd struct -- we don't care about this yet
  27. #ifdef XP_UNIX
  28. #include <pwd.h>
  29. #endif
  30. */
  31. /* ------------------------------ Constants ------------------------------- */
  32.  
  33. /*
  34.  * The maximum length of an error message. NOT RUN-TIME CHECKED
  35.  */
  36.  
  37. #define MAX_ERROR_LEN 8192
  38.  
  39. /* A warning is a minor mishap, such as a 404 being issued. */
  40. #define LOG_WARN 0
  41.  
  42. /*
  43.  * A misconfig is when there is a syntax error or permission violation in
  44.  * a config. file.
  45.  */
  46. #define LOG_MISCONFIG 1
  47.  
  48. /*
  49.  * Security warnings are issued when authentication fails, or a host is
  50.  * given a 403 return code.
  51.  */
  52. #define LOG_SECURITY 2
  53.  
  54. /*
  55.  * A failure is when a request could not be fulfilled due to an internal
  56.  * problem, such as a CGI script exiting prematurely, or a filesystem
  57.  * permissions problem.
  58.  */
  59. #define LOG_FAILURE 3
  60.  
  61. /*
  62.  * A catastrophe is a fatal server error such as running out of
  63.  * memory or processes, or a system call failing, or even a server crash.
  64.  * The server child cannot recover from a catastrophe.
  65.  */
  66. #define LOG_CATASTROPHE 4
  67.  
  68. /*
  69.  * Informational message, of no concern.
  70.  */
  71. #define LOG_INFORM 5
  72.  
  73. /*
  74.  * The time format to use in the error log
  75.  */
  76.  
  77. /*
  78. #define ERR_TIMEFMT "[%d/%b/%Y:%H:%M:%S]"
  79. */
  80.  
  81.  
  82. /* The fd you will get if you are reporting errors to SYSLOG */
  83.  
  84. #define ERRORS_TO_SYSLOG -1
  85.  
  86.  
  87.  
  88. /* ------------------------------ Prototypes ------------------------------ */
  89. /*
  90.  *  These are commented out for the time being.
  91.  *  I'm not sure right now how they'll be implemented. -- dsc
  92.  */
  93.  
  94.  
  95. /*
  96.  * ereport logs an error of the given degree and formats the arguments with
  97.  * the printf() style fmt. Returns whether the log was successful. Records
  98.  * the current date.
  99.  
  100.  
  101.  
  102. int ereport(int degree, char *fmt, ...);
  103.  */
  104. /*
  105.  * ereport_init initializes the error logging subsystem and opens the static
  106.  * file descriptors. It returns NULL upon success and an error string upon
  107.  * error. If a userpw is given, the logs will be chowned to that user.
  108.  *
  109.  * email is the address of a person to mail upon catastrophic error. It
  110.  * can be NULL if no e-mail is desired. ereport_init will not duplicate
  111.  * its own copy of this string; you must make sure it stays around and free
  112.  * it when you shut down the server.
  113.  
  114.  
  115. char *ereport_init(char *err_fn, char *email, struct passwd *pw);
  116.  */
  117. /*
  118.  * log_terminate closes the error and common log file descriptors.
  119.  
  120. void ereport_terminate(void);
  121.  */
  122. /* For restarts
  123. SYS_FILE ereport_getfd(void);
  124. */
  125.  
  126. #endif
  127.