File: mod_layout.h

package info (click to toggle)
libapache-mod-layout 5.1-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 136 kB
  • ctags: 161
  • sloc: ansic: 1,029; makefile: 117; sh: 35; perl: 15
file content (127 lines) | stat: -rw-r--r-- 3,344 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* 
 **  mod_layout.h -- Common defines.
 **  $Revision: 1.1.1.1 $
*/

#include "httpd.h"
#include "http_config.h"
#include "http_protocol.h"
#include "http_log.h"
#include "http_request.h"
#include "ap_config.h"
#include "apr_buckets.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include "apr_tables.h"
#include "apr_fnmatch.h"
#include "util_filter.h"
#include <string.h>
#include "version.h"
#include "directives.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>


#define BUFFER_LENGTH 1024

#define UNSET (-1)
#define OFF (0)
#define ON (1)
#define isOff(a) ((a == ON) ? 0 : 1 )
#define isOn(a) ((a == ON) ? 1 : 0 )

/* layout states */
#define LAYOUT (0)
#define HTTP (1)
#define HEADER (2)
#define ORIGIN (3)
#define FOOTER (4)

/* layout ? */
#define APPEND (1)
#define REPLACE (2)
#define PREPEND (3)

#ifndef __WATCHPOINT_H__
#define __WATCHPOINT_H__
/* Some personal debugging functions */
#ifdef HAVE_DEBUG
#define WATCHPOINT printf("\nWATCHPOINT %s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout);
#define WATCHPOINT_STRING(A) printf("\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__,A);fflush(stdout);
#define WATCHPOINT_STRING_LENGTH(A,B) printf("\nWATCHPOINT %s:%d (%s) %.*s\n", __FILE__, __LINE__,__func__,(int)B,A);fflush(stdout);
#define WATCHPOINT_NUMBER(A) printf("\nWATCHPOINT %s:%d (%s) %zu\n", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout);
#define WATCHPOINT_ERRNO(A) printf("\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));A= 0;fflush(stdout);
#define WATCHPOINT_ASSERT(A) assert((A));
#else
#define WATCHPOINT
#define WATCHPOINT_STRING(A)
#define WATCHPOINT_STRING_LENGTH(A,B)
#define WATCHPOINT_NUMBER(A)
#define WATCHPOINT_ERRNO(A)
#define WATCHPOINT_ASSERT(A)
#endif

#endif /* __WATCHPOINT_H__ */
#define LAYOUT_EXPORT(type)    type

#define LAYOUT_BEGINTAG "<body*>"
#define LAYOUT_ENDTAG "</body>"
#define LAYOUT_TIMEFORMAT "%A, %d-%b-%Y %H:%M:%S %Z"

typedef struct {
  int type;									/* If it is static, file, dynamic */
  int kind;									/* Header, Footer or random layout */
  int append;								/* Either APPEND, REPLACE, or PREPEND */
  const char *string;				/* Whatever the layout is */
  const char *comment;			/* The comment that is displayed if comments are on */
  const char *pattern;			/* The pattern we match against */
} layout_string;

typedef struct {
  size_t size;
  char *file;
} mmap_data;

typedef struct {
  int header;
  int footer;
  int length;
  int http;
  int origin;
  const char *type;
  const char *mime;
  ap_filter_t *f; 
  apr_bucket_brigade *b;
} layout_request;

typedef struct {
  apr_array_header_t *layouts;
  int header_enabled;
  int footer_enabled;
  int display_origin;
  apr_table_t *override;
  apr_table_t *override_uri;
  int comment;
  /* These next three variables change with each request */
  const char *time_format;
  apr_table_t *uris_ignore;
  apr_table_t *uris_ignore_header;
  apr_table_t *uris_ignore_footer;
  apr_table_t *tag_ignore;
  apr_table_t *tag_ignore_footer;
  apr_table_t *tag_ignore_header;
  int append_header;
  int append_footer;
  int notes;
  const char *begin_tag;
  const char *end_tag;
  const char *dir;
} layout_conf;

typedef struct layout_filter_struct {
  apr_bucket_brigade *b;
  const char *output;
} layout_filter_struct;

#include "proto.h"