File: ep2.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 (308 lines) | stat: -rwxr-xr-x 12,773 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/*###################################################################################
#
#   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: ep2.h 1578075 2014-03-16 14:01:14Z richter $
#
###################################################################################*/


/* ---- from epcmd2.c ----- */


void embperlCmd_InputCheck (/*i/o*/ register req *     r,
			    /*in*/ tDomTree *	    pDomTree,
			    /*in*/ tNode	    xNode,
			    /*in*/ tRepeatLevel     nRepeatLevel,
			    /*in*/ const char *     pName,
			    /*in*/ int              nNameLen,
			    /*in*/ const char *     pVal,
			    /*in*/ int              nValLen,
                            /*in*/ int              bSetInSource) ;


void embperlCmd_Option (/*i/o*/ register req *     r,
			/*in*/ tDomTree *	    pDomTree,
			/*in*/ tNode	    xNode,
		        /*in*/ tRepeatLevel     nRepeatLevel,
			/*in*/ const char *     pName,
			/*in*/ int              nNameLen,
			/*in*/ const char *     pVal,
			/*in*/ int              nValLen,
                        /*in*/ int              bSetInSource) ;

int embperlCmd_Hidden	(/*i/o*/ register req *     r,
			 /*in*/ tDomTree *	    pDomTree,
			 /*in*/ tNode		    xNode,
			 /*in*/ tRepeatLevel     nRepeatLevel,
			 /*in*/ const char *	    sArg) ;
			

SV * Node_replaceChildWithUrlDATA (/*in*/ tReq *        r,
                                   /*in*/ tIndex  xDomTree, 
					  tIndex  xOldChild, 
				  /*in*/ tRepeatLevel     nRepeatLevel,
					  SV *    sText) ;
int embperlCmd_AddSessionIdToHidden(/*i/o*/ register req *     r,
			            /*in*/ tDomTree *	    pDomTree,
			            /*in*/ tNode		    xNode,
		                    /*in*/ tRepeatLevel	    nRepeatLevel) ;
int embperlCmd_AddSessionIdToLink  (/*i/o*/ register req *     r,
			            /*in*/ tDomTree *	    pDomTree,
			            /*in*/ tNode		    xNode,
		                    /*in*/ tRepeatLevel	    nRepeatLevel,
                                    /*in*/ char *            sAttrName) ;

    
			 
/* ---- from epparse.c ----- */

extern struct tTokenTable DefaultTokenTable ;

int BuildTokenTable (/*i/o*/ register req *	  r,
 		     /*in*/ int            nLevel,
                     /*in*/  const char *         sName,
                     /*in*/  HV *		  pTokenHash,
		     /*in*/  const char *         pDefEnd,
		     /*i/o*/ void * *		  ppCompilerInfo,
                     /*out*/ struct tTokenTable * pTokenTable) ;

int ParseFile (/*i/o*/ register req * r) ;

int embperl_Parse (/*i/o*/ register req * r,
                   /*in*/  char *   pSource,
                   /*in*/  size_t         nLen,
                   /*out*/ tIndex *       pxDomTree) ;

/* ---- from epcomp.c ----- */

struct tCacheItem ;

int embperl_CompileInitItem      (/*i/o*/ register req * r,
				  /*in*/  HV *           pHash,
				  /*in*/  int            nNodeName,
				  /*in*/  int            nNodeType,
				  /*in*/  int		 nTagSet,
				  /*in*/  void * *	 ppInfo) ;


int embperl_Compile                 (/*in*/  tReq *	  r,
				     /*in*/  tIndex       xDomTree,
				     /*out*/ tIndex *     pxResultDomTree,
                                     /*out*/ SV * *       pProg) ;

int embperl_Execute	            (/*in*/  tReq *	  r,
				     /*in*/  tIndex       xSrcDomTree,
                                     /*in*/  CV *         pCV,
				     /*in*/  tIndex  *    pResultDomTree) ;


int embperl_ExecuteSubStart         (/*in*/  tReq *	  r,
				     /*in*/  SV *         pDomTreeSV,
				     /*in*/  tIndex       xDomTree,
				     /*in*/  AV *         pSaveAV) ;

int embperl_ExecuteSubEnd           (/*in*/  tReq *	  r,
				     /*in*/  SV *         pDomTreeSV,
				     /*in*/  AV *         pSaveAV) ;



/* ---- from epcache.c ----- */

#define cache_malloc(r,s) malloc(s)
#define cache_free(r,m) free(m)


struct tProvider ;
struct tProviderClass ;
struct tCacheItem ;

typedef struct tCacheItem
    {
    const char *    sKey ;                  /**< key under which this cache item is accessable */
    
    bool            bExpired ;              /**< this item is expired */
    bool            bCache ;                /**< if true cache result of provider */
    int             nLastChecked ;          /**< request when this item was last checked */
    int             nLastUpdated ;          /**< request when this item was last updated */
    time_t          nLastModified ;         /**< time when item was last modified */
    time_t          nExpiresInTime ;        /**< time in sec when item expires, 0 = does not expire */ 
    const char *    sExpiresFilename ;      /**< Item expires when mtime of filename is different to nLastModified */
    time_t          nFileModified ;         /**< time when file was last modified */
    struct stat     FileStat ;              /**< Item expires when mtime of filename is different to nLastModified */
    CV *            pExpiresCV ;            /**< Perl code to call. If returns true item expires */
    int             (*fExpires) (struct tCacheItem * pItem) ; /**< C code to call. If returns true item expires */

    void *          pData ;                 /**< Item C data */
    SV *            pSVData ;               /**< Item Perl data */
    tIndex          xData ;                 /**< Item Index data */

    struct tCacheItem * *  pDependsOn ;            /**< CacheItem on which this one depends */
    struct tCacheItem * *  pNeededFor ;            /**< CacheItems that need this item */

    struct tProvider *  pProvider ;         /**< Provider for this cacheItem */
    
    } tCacheItem ;


typedef struct tProviderClass
    {
    const char *    sOutputType ;                                                   /**< MIME type of output format (maybe override by object) */
    int (*fNew)(req * r, tCacheItem * pOutputCache, struct tProviderClass * pProviderClass, HV * pProviderParam, SV * pParam, IV nParamIndex)  ;  /**< called to initialize the provider */
    int (*fAppendKey)(req * r, struct tProviderClass * pProviderClass, HV * pProviderParam, SV * pParam, IV nParamIndex, SV * pKey)  ;  /**< append the key for the cache of the provider and it's dependencies */
    int (*fUpdateParam)(req * r, struct tProvider * pProvider, HV * pProviderParam)  ;        /**< update the parameter of the provider */
    int (*fGetContentSV)(req * r, struct tProvider * pProvider, SV ** pData, bool bUseCache) ;      /**< Get the content from that provider */
    int (*fGetContentPtr)(req * r, struct tProvider * pProvider, void ** pData, bool bUseCache) ;   /**< Get the content from that provider */
    int (*fGetContentIndex)(req * r, struct tProvider * pProvider, tIndex * pData, bool bUseCache) ;/**< Get the content from that provider */
    int (*fFreeContent) (req * r, struct tCacheItem * pItem) ;      /**< Called to free memory of associated data */
    int (*fExpires) (req * r, struct tProvider * pProvider) ;       /**< Called to check if provider content is expired */
    } tProviderClass ;


/*! General provider for input */

typedef struct tProvider
    {
    const char *    sOutputType ;       /**< MIME type of output format */
    tCacheItem *    pCache ;            /**< CacheItem for this provider instance */
    tProviderClass *    pProviderClass ;    /**< Provider class */
    } tProvider ;


int Cache_Init (/*in*/ tApp * a) ;

int Cache_AddProviderClass (/*in*/ const char *     sName,
                            /*in*/ tProviderClass * pClass) ;

int Cache_CleanupRequest (req * r) ;

int Cache_New (/*in*/ req *             r,
               /*in*/ SV *              pParam,
               /*in*/ IV                nParamNdx,
               /*in*/ bool              bTopLevel,
               /*in*/ tCacheItem * *    pItem) ;

int Cache_AppendKey               (/*in*/ req *              r,
                                   /*in*/ HV *               pProviderParam,
                                   /*in*/ const char *       sSubProvider, 
                                   /*in*/ SV *               pParam,
                                   /*in*/ IV                 nParamIndex,
                                   /*i/o*/ SV *              pKey) ;

tCacheItem * Cache_GetByKey    (/*in*/ req *       r,
                                /*in*/ const char * sKey) ;

int Cache_AddDependency (/*in*/ req *       r,
                         /*in*/ tCacheItem *    pItem,
                         /*in*/ tCacheItem *    pDependsOn) ;

tCacheItem * Cache_GetDependency (/*in*/ req *           r,
                                  /*in*/ tCacheItem *    pItem,
                                  /*in*/ int             n) ;

int Cache_IsExpired     (/*in*/ req *           r,
                         /*in*/ tCacheItem *    pItem,
                         /*in*/ int             nLastUpdated) ;

int Cache_SetNotExpired (/*in*/ req *       r,
                         /*in*/ tCacheItem *    pItem) ;

int Cache_GetContentSV      (/*in*/ req *             r,
                             /*in*/ tCacheItem        *pItem,
                             /*in*/ SV * *            pData, 
                             /*in*/ bool              bUseCache) ;

int Cache_GetContentPtr     (/*in*/ req *             r,
                             /*in*/ tCacheItem        *pItem,
                             /*in*/ void * *          pData,
                             /*in*/ bool              bUseCache) ;

int Cache_GetContentIndex   (/*in*/ req *             r,
                             /*in*/ tCacheItem        *pItem,
                             /*in*/ tIndex *          pData,
                             /*in*/ bool              bUseCache) ;

int Cache_GetContentSvIndex   (/*in*/ req *             r,
                             /*in*/ tCacheItem        *pItem,
                             /*in*/ SV * *            pSVData,
                             /*in*/ tIndex *          pData,
                             /*in*/ bool              bUseCache) ;

int Cache_ReleaseContent        (/*in*/ req *             r,
                                 /*in*/ tCacheItem        *pItem) ;

int Cache_FreeContent           (/*in*/ req *             r,
                                 /*in*/ tCacheItem        *pItem) ;


/* ---- from epprovider.c ----- */


int Provider_Init (/*in*/ tApp * a) ;

int Provider_New            (/*in*/ req *              r,
                             /*in*/ size_t             nSize,
                             /*in*/ tCacheItem *       pItem,
                             /*in*/ tProviderClass *   pProviderClass,
                             /*in*/ HV *               pParam) ;

int Provider_NewDependOne   (/*in*/ req *              r,
                             /*in*/ size_t             nSize,
                             /*in*/ const char *       sSourceName,
                             /*in*/ tCacheItem *       pItem,
                             /*in*/ tProviderClass *   pProviderClass,
                             /*in*/ HV *               pProviderParam,
                             /*in*/ SV *               pParam,
                             /*in*/ IV                 nParamIndex) ;

int Provider_AddDependOne   (/*in*/ req *              r,
                             /*in*/ tProvider *        pProvider,
                             /*in*/ const char *       sSourceName,
                             /*in*/ tCacheItem *       pItem,
                             /*in*/ tProviderClass *   pProviderClass,
                             /*in*/ HV *               pProviderParam,
                             /*in*/ SV *               pParam,
                             /*in*/ IV                 nParamIndex) ;

#ifdef APACHE2
int ApFilter_Init (/*in*/ tApp * a) ;
#endif

/* --- from epinit.c --- */


int    embperl_SetupThread  (/*in*/ pTHX_
                             /*out*/tThreadData * *  ppThread) ;

tThreadData * embperl_GetThread  (/*in*/ pTHX) ;

#define CurrReq       (embperl_GetThread (aTHX) -> pCurrReq)
#define CurrComponent (&(embperl_GetThread (aTHX) -> pCurrReq -> Component))
#define CurrApp (embperl_GetThread (aTHX) -> pCurrReq -> pApp)



#ifdef XALAN
    int embperl_Xalan_Init (void) ;
#endif
#ifdef LIBXSLT
    int embperl_LibXSLT_Init (void) ;
#endif