]> git.sur5r.net Git - openldap/blob - servers/slapd/back-perl/perl_back.h
Happy New Year!
[openldap] / servers / slapd / back-perl / perl_back.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1999-2016 The OpenLDAP Foundation.
5  * Portions Copyright 1999 John C. Quillan.
6  * Portions Copyright 2002 myinternet Limited.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted only as authorized by the OpenLDAP
11  * Public License.
12  *
13  * A copy of this license is available in file LICENSE in the
14  * top-level directory of the distribution or, alternatively, at
15  * <http://www.OpenLDAP.org/license.html>.
16  */
17
18 #ifndef PERL_BACK_H
19 #define PERL_BACK_H 1
20
21 #include <EXTERN.h>
22 #include <perl.h>
23 #undef _        /* #defined by both Perl and ac/localize.h */
24 #include "asperl_undefs.h"
25
26 #include "portable.h"
27
28 #include "slap.h"
29
30 LDAP_BEGIN_DECL
31
32 /*
33  * From Apache mod_perl: test for Perl version.
34  */
35
36 #if defined(pTHX_) || (PERL_REVISION > 5 || (PERL_REVISION == 5 && PERL_VERSION >= 6))
37 #define PERL_IS_5_6
38 #endif
39
40 #define EVAL_BUF_SIZE 500
41
42 extern ldap_pvt_thread_mutex_t  perl_interpreter_mutex;
43
44 #ifdef PERL_IS_5_6
45 /* We should be using the PL_errgv, I think */
46 /* All the old style variables are prefixed with PL_ now */
47 # define errgv  PL_errgv
48 # define na     PL_na
49 #else
50 # define call_method(m, f)      perl_call_method(m, f)
51 # define eval_pv(m, f)  perl_eval_pv(m, f)
52 # define ERRSV  GvSV(errgv)
53 #endif
54
55 #if defined( HAVE_WIN32_ASPERL ) || defined( USE_ITHREADS )
56 /* pTHX is needed often now */
57 # define PERL_INTERPRETER                       my_perl
58 # define PERL_BACK_XS_INIT_PARAMS               pTHX
59 # define PERL_BACK_BOOT_DYNALOADER_PARAMS       pTHX, CV *cv
60 #else
61 # define PERL_INTERPRETER                       perl_interpreter
62 # define PERL_BACK_XS_INIT_PARAMS               void
63 # define PERL_BACK_BOOT_DYNALOADER_PARAMS       CV *cv
64 # define PERL_SET_CONTEXT(i)
65 #endif
66
67 extern PerlInterpreter *PERL_INTERPRETER;
68
69
70 typedef struct perl_backend_instance {
71         char *pb_module_name;
72         BerVarray pb_module_path;
73         BerVarray pb_module_config;
74         SV      *pb_obj_ref;
75         int     pb_filter_search_results;
76 } PerlBackend;
77
78 LDAP_END_DECL
79
80 #include "proto-perl.h"
81
82 #endif /* PERL_BACK_H */