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