/server/Apache/include/http_log.h

https://bitbucket.org/steve_delbar/iepsm-projet-de-d-veloppement-internet-2013 · C Header · 120 lines · 74 code · 19 blank · 27 comment · 2 complexity · 3c4a90ae3b0bc59debb861cdb9fd213c MD5 · raw file

  1. /* Copyright 1999-2004 The Apache Software Foundation
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #ifndef APACHE_HTTP_LOG_H
  16. #define APACHE_HTTP_LOG_H
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #ifdef HAVE_SYSLOG
  21. #include <syslog.h>
  22. #define APLOG_EMERG LOG_EMERG /* system is unusable */
  23. #define APLOG_ALERT LOG_ALERT /* action must be taken immediately */
  24. #define APLOG_CRIT LOG_CRIT /* critical conditions */
  25. #define APLOG_ERR LOG_ERR /* error conditions */
  26. #define APLOG_WARNING LOG_WARNING /* warning conditions */
  27. #define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */
  28. #define APLOG_INFO LOG_INFO /* informational */
  29. #define APLOG_DEBUG LOG_DEBUG /* debug-level messages */
  30. #define APLOG_LEVELMASK LOG_PRIMASK /* mask off the level value */
  31. #else
  32. #define APLOG_EMERG 0 /* system is unusable */
  33. #define APLOG_ALERT 1 /* action must be taken immediately */
  34. #define APLOG_CRIT 2 /* critical conditions */
  35. #define APLOG_ERR 3 /* error conditions */
  36. #define APLOG_WARNING 4 /* warning conditions */
  37. #define APLOG_NOTICE 5 /* normal but significant condition */
  38. #define APLOG_INFO 6 /* informational */
  39. #define APLOG_DEBUG 7 /* debug-level messages */
  40. #define APLOG_LEVELMASK 7 /* mask off the level value */
  41. #endif
  42. #define APLOG_NOERRNO (APLOG_LEVELMASK + 1)
  43. #ifdef WIN32
  44. /* Set to indicate that error msg should come from Win32's GetLastError(),
  45. * not errno. */
  46. #define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2)
  47. #endif
  48. #ifndef DEFAULT_LOGLEVEL
  49. #define DEFAULT_LOGLEVEL APLOG_WARNING
  50. #endif
  51. #define APLOG_MARK __FILE__,__LINE__
  52. API_EXPORT(void) ap_open_logs (server_rec *, pool *p);
  53. /* The two primary logging functions, ap_log_error and ap_log_rerror,
  54. * use a printf style format string to build the log message. It is
  55. * VERY IMPORTANT that you not include any raw data from the network,
  56. * such as the request-URI or request header fields, within the format
  57. * string. Doing so makes the server vulnerable to a denial-of-service
  58. * attack and other messy behavior. Instead, use a simple format string
  59. * like "%s", followed by the string containing the untrusted data.
  60. */
  61. API_EXPORT_NONSTD(void) ap_log_error(const char *file, int line, int level,
  62. const server_rec *s, const char *fmt, ...)
  63. __attribute__((format(printf,5,6)));
  64. API_EXPORT_NONSTD(void) ap_log_rerror(const char *file, int line, int level,
  65. const request_rec *s, const char *fmt, ...)
  66. __attribute__((format(printf,5,6)));
  67. API_EXPORT(void) ap_error_log2stderr (server_rec *);
  68. API_EXPORT(void) ap_log_pid (pool *p, char *fname);
  69. /* These are for legacy code, new code should use ap_log_error,
  70. * or ap_log_rerror.
  71. */
  72. API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s);
  73. API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
  74. const char *msg, server_rec *s);
  75. API_EXPORT_NONSTD(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
  76. __attribute__((format(printf,2,3)));
  77. API_EXPORT(void) ap_log_reason(const char *reason, const char *fname,
  78. request_rec *r);
  79. typedef struct piped_log {
  80. pool *p;
  81. #if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF)
  82. char *program;
  83. int pid;
  84. int fds[2];
  85. #else
  86. FILE *write_f;
  87. #endif
  88. } piped_log;
  89. API_EXPORT(piped_log *) ap_open_piped_log (pool *p, const char *program);
  90. API_EXPORT(void) ap_close_piped_log (piped_log *);
  91. #if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF)
  92. #define ap_piped_log_read_fd(pl) ((pl)->fds[0])
  93. #define ap_piped_log_write_fd(pl) ((pl)->fds[1])
  94. #else
  95. #define ap_piped_log_read_fd(pl) (-1)
  96. #define ap_piped_log_write_fd(pl) (fileno((pl)->write_f))
  97. #endif
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #endif /* !APACHE_HTTP_LOG_H */