File: eppriv.h

package info (click to toggle)
libembperl-perl 2.5.0-10%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,128 kB
  • sloc: ansic: 21,384; perl: 14,496; javascript: 4,280; cpp: 467; xml: 49; makefile: 33; sh: 24
file content (266 lines) | stat: -rw-r--r-- 10,797 bytes parent folder | download | duplicates (6)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/*###################################################################################
#
#   Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh  www.ecos.de
#   Embperl - Copyright (c) 2008-2014 Gerald Richter
#
#   You may distribute under the terms of either the GNU General Public
#   License or the Artistic License, as specified in the Perl README file.
#   For use with Apache httpd and mod_perl, see also Apache copyright.
#
#   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
#   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
#   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#   $Id: eppriv.h 1578075 2014-03-16 14:01:14Z richter $
#
###################################################################################*/


#define EMBPERL_PACKAGE         Embperl
#define EMBPERL_PACKAGE_STR     "Embperl"


#ifdef PERL_IMPLICIT_CONTEXT
#define epTHX pTHX = r -> pPerlTHX
#define epaTHX pTHX = a -> pPerlTHX
#define eptTHX pTHX = pThread -> pPerlTHX
#define epTHX_ epTHX ;
#define epaTHX_ epaTHX ;
#define eptTHX_ eptTHX ;
#else
#define epTHX 
#define epaTHX
#define eptTHX
#define epTHX_ 
#define epaTHX_
#define eptTHX_
#endif


void boot_Embperl__Thread (pTHX_ CV * cv) ;
void boot_Embperl__App (pTHX_ CV * cv) ;
void boot_Embperl__App__Config (pTHX_ CV * cv) ;
void boot_Embperl__Req (pTHX_ CV * cv) ;
void boot_Embperl__Req__Config (pTHX_ CV * cv) ;
void boot_Embperl__Req__Param (pTHX_ CV * cv) ;
void boot_Embperl__Component (pTHX_ CV * cv) ;
void boot_Embperl__Component__Config (pTHX_ CV * cv) ;
void boot_Embperl__Component__Param (pTHX_ CV * cv) ;
void boot_Embperl__Component__Output (pTHX_ CV * cv) ;
void boot_Embperl__Syntax (pTHX_ CV * cv) ;


struct tCacheItem ;

extern SV ep_sv_undef ; 


/*-----------------------------------------------------------------*/
/*								   */
/*  cache Options						   */
/*								   */
/*-----------------------------------------------------------------*/

typedef enum tCacheOptions
    {
    ckoptCarryOver = 1,   /* use result from CacheKeyCV of preivious step if any */
    ckoptPathInfo  = 2,   /* include the PathInfo into CacheKey */
    ckoptQueryInfo = 4,	  /* include the QueryInfo into CacheKey */
    ckoptDontCachePost = 8,	  /* don't cache POST requests */
    ckoptDefault    = 15	  /* default is all options set */
    } tCacheOptions ;


/*-----------------------------------------------------------------*/
/*								   */
/*  RequestPhases						   */
/*								   */
/*-----------------------------------------------------------------*/

typedef enum 
    {
    phInit,
    phParse,
    phCompile,
    phRunAfterCompile,
    phPerlCompile,
    phRun,
    phTerm
    } tPhase ;
    
/*-----------------------------------------------------------------*/
/*								   */
/*  Parser data structures 	            			   */
/*								   */
/*-----------------------------------------------------------------*/


struct tToken
    {
    const char *	    sText ;	/* string of token (MUST be first item!) */
    const char *	    sName ;	/* name of token (only for description) */
    int			    nTextLen ;	/* len of string */
    const char *	    sEndText ;	/* string which ends the block */
    const char *	    sNodeName;	/* name of the node to create */
    int			    nNodeName ;	/* index in string table of node name */
    tNodeType		    nNodeType ;	/* type of the node that should be created */
    tNodeType		    nCDataType ;/* type for sub nodes that contains text */
    tNodeType		    nForceType ;/* force this type for sub nodes */
    int			    bUnescape ;	/* translate input?  */
    int			    bAddFlags ;	/* add flags to node  */
    int			    bRemoveSpaces ;	/* 1 remove spaces before tag, 2 remove after */
    unsigned char *	    pContains ;	/* chars that could be contained in the string */
    int			    bInsideMustExist ;	/* if inside definition doesn't exists, ignore whole tag */
    int			    bMatchAll ;	/* match any start text */
    int			    bDontEat ;	/* don't eat the characters when parsing this token (look ahead) */
    int			    bExitInside ;/* when this tag is found exit the inside table */
    int			    bAddFirstChild;/* already add an empty CDATA node child */
    struct tTokenTable *    pFollowedBy;/* table of tokens that can follow this one */
    struct tTokenTable *    pInside ;	/* table of tokens that can apear inside this one */
    struct tToken      *    pStartTag ;	/* token that contains definition for the start of the current token */
    struct tToken      *    pEndTag ;	/* token that contains definition for the end of the current token */
    const char *	    sParseTimePerlCode ; /* perl code that is executed when this token is parsed, %% is replaced by the value of the current attribute */
    } ;        



/* --- threads & mutex --- */

#if !defined (USE_THREADS) && !defined(USE_ITHREADS) && !defined(perl_mutex)
/* dummy definition */
#define perl_mutex int
#define ep_acquire_mutex(mutex) 
#define ep_release_mutex(mutex) 
#define ep_create_mutex(mutex) 
#define ep_destroy_mutex(mutex)

#else

#define ep_acquire_mutex(mutex) MUTEX_LOCK(&mutex)
#define ep_release_mutex(mutex) MUTEX_UNLOCK(&mutex)
#define ep_create_mutex(mutex) MUTEX_INIT(&mutex)
#define ep_destroy_mutex(mutex) MUTEX_DESTROY(&mutex)
#endif

/* --- memory management --- */



tMemPool * ep_init_alloc(void);	
void ep_cleanup_alloc(void);

tMemPool * ep_make_sub_pool(tMemPool *);
void   ep_destroy_pool(tMemPool *);
void * ep_palloc(struct tMemPool *, int nbytes);
void * ep_pcalloc(struct tMemPool *, int nbytes);
char * ep_pstrdup(struct tMemPool *, const char *s);
char * ep_pstrndup(struct tMemPool *, const char *s, int n);
char * ep_pstrcat(struct tMemPool *,...) ;
char * ep_psprintf(struct tMemPool *, const char *fmt, ...) ;
char * ep_pvsprintf(struct tMemPool *, const char *fmt, va_list);


/* --- configuration --- */


void embperl_ApacheAddModule (void) ;
int embperl_GetApacheConfig (/*in*/ tThreadData * pThread,
                            /*in*/  request_rec * r,
                            /*in*/  server_rec * s,
                            /*out*/ tApacheDirConfig * * ppConfig) ;
char * embperl_GetApacheAppName (/*in*/ tApacheDirConfig * pDirCfg) ;
int embperl_GetApacheAppConfig (/*in*/ tThreadData * pThread,
                                /*in*/ tMemPool    * pPool,
                                /*in*/ tApacheDirConfig * pDirCfg,
                                /*out*/ tAppConfig * pConfig);
int embperl_GetApacheReqConfig (/*in*/ tApp *        pApp,
                                /*in*/ tMemPool    * pPool,
                                /*in*/ tApacheDirConfig * pDirCfg,
                                /*out*/ tReqConfig * pReqConfig) ;
int embperl_GetApacheComponentConfig (/*in*/ tReq * pReq,
                                /*in*/ tMemPool    * pPool,
                                /*in*/ tApacheDirConfig * pDirCfg,
                                /*out*/ tComponentConfig * pConfig) ;
int embperl_GetApacheReqParam  (/*in*/  tApp        * pApp,
                                /*in*/ tMemPool    * pPool,
                                /*in*/  request_rec * r,
                                /*out*/ tReqParam * pParam) ;




char * embperl_GetCGIAppName (/*in*/ tThreadData * pThread) ;
int embperl_GetCGIAppConfig    (/*in*/ tThreadData * pThread,
                                /*in*/ tMemPool    * pPool,
                                /*out*/ tAppConfig * pConfig,
                                /*in*/  bool         bUseEnv,
                                /*in*/  bool         bUseRedirectEnv,
                                /*in*/  bool         bSetDefault) ;
int embperl_GetCGIReqConfig    (/*in*/ tApp    *    pApp,
                                /*in*/ tMemPool    * pPool,
                                /*out*/ tReqConfig * pConfig,
                                /*in*/  bool         bUseEnv,
                                /*in*/  bool         bUseRedirectEnv,
                                /*in*/  bool         bSetDefault) ;
int embperl_GetCGIComponentConfig    (/*in*/ tReq    *    pReq,
                                    /*in*/ tMemPool    * pPool,
                                    /*out*/ tComponentConfig * pConfig,
                                /*in*/  bool         bUseEnv,
                                /*in*/  bool         bUseRedirectEnv,
                                /*in*/  bool         bSetDefault) ;
int embperl_GetCGIReqParam     (/*in*/ tApp        * pApp,
                                /*in*/ tMemPool    * pPool,
                                /*out*/ tReqParam  * pParam) ;


typedef struct tOptionEntry
    {
    const char *    sOption ;
    int             nValue ;
    } tOptionEntry ;

extern tOptionEntry OptionsDEBUG[] ;
extern tOptionEntry OptionsOPTIONS[] ;
extern tOptionEntry OptionsESCMODE[] ;
extern tOptionEntry OptionsINPUT_ESCMODE[] ;
extern tOptionEntry OptionsOUTPUT_MODE[] ;
extern tOptionEntry OptionsOUTPUT_ESC_CHARSET[] ;
extern tOptionEntry OptionsSESSION_MODE[] ;



int embperl_OptionListSearch (/*in*/ tOptionEntry * pList,
                              /*in*/ bool          bMult,
                              /*in*/ const char *  sCmd,
                              /*in*/ const char *  sOptions,
                              /*in*/ int *         pnValue) ;

const char * embperl_CalcExpires(const char *sTime, char * sResult, int bHTTP) ;



/* --- init --- */

#if 0
void embperl_DefaultAppConfig (/*in*/ tAppConfig  *pCfg) ;
void embperl_DefaultReqConfig (/*in*/ tReqConfig  *pCfg) ;
void embperl_DefaultComponentConfig (/*in*/ tComponentConfig  *pCfg) ;
#endif

void Embperl__App_new_init(pTHX_ tApp * pApp, SV * pPerlParam, int overwrite) ;
void Embperl__App__Config_new_init(pTHX_ tAppConfig * pAppConfig, SV * pPerlParam, int overwrite) ;
void Embperl__Req_new_init (pTHX_ tReq * r, SV * pPerlParam, int overwrite) ;
void Embperl__Req__Config_new_init (pTHX_ tReqConfig * r, SV * pPerlParam, int overwrite) ;
void Embperl__Req__Param_new_init (pTHX_ tReqParam * r, SV * pPerlParam, int overwrite) ;
void Embperl__Component_new_init (pTHX_ tComponent * c, SV * pPerlParam, int overwrite) ;
void Embperl__Component__Config_new_init (pTHX_ tComponentConfig * c, SV * pPerlParam, int overwrite) ;
void Embperl__Component__Param_new_init (pTHX_ tComponentParam * c, SV * pPerlParam, int overwrite) ;

void Embperl__Req__Config_destroy(pTHX_ tReqConfig * p) ;
void Embperl__Req__Param_destroy(pTHX_ tReqParam * p) ;
void Embperl__Req_destroy(pTHX_ tReq * p) ;
void Embperl__Component__Config_destroy(pTHX_ tComponentConfig * p) ;
void Embperl__Component__Param_destroy(pTHX_ tComponentParam * p) ;
void Embperl__Component_destroy(pTHX_ tComponent *p) ;

int    embperl_EndPass1  (void) ;