1/*	$NetBSD: perl_back.h,v 1.3 2021/08/14 16:15:01 christos Exp $	*/
2
3/* $OpenLDAP$ */
4/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 *
6 * Copyright 1999-2021 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 <sys/cdefs.h>
29__RCSID("$NetBSD: perl_back.h,v 1.3 2021/08/14 16:15:01 christos Exp $");
30
31#include "portable.h"
32
33#include "slap.h"
34
35LDAP_BEGIN_DECL
36
37/*
38 * From Apache mod_perl: test for Perl version.
39 */
40
41#if defined(pTHX_) || (PERL_REVISION > 5 || (PERL_REVISION == 5 && PERL_VERSION >= 6))
42#define PERL_IS_5_6
43#endif
44
45#define EVAL_BUF_SIZE 500
46
47extern ldap_pvt_thread_mutex_t  perl_interpreter_mutex;
48
49#ifdef PERL_IS_5_6
50/* We should be using the PL_errgv, I think */
51/* All the old style variables are prefixed with PL_ now */
52# define errgv	PL_errgv
53# define na	PL_na
54#else
55# define call_method(m, f)	perl_call_method(m, f)
56# define eval_pv(m, f)	perl_eval_pv(m, f)
57# define ERRSV	GvSV(errgv)
58#endif
59
60#if defined( HAVE_WIN32_ASPERL ) || defined( USE_ITHREADS )
61/* pTHX is needed often now */
62# define PERL_INTERPRETER			my_perl
63# define PERL_BACK_XS_INIT_PARAMS		pTHX
64# define PERL_BACK_BOOT_DYNALOADER_PARAMS	pTHX, CV *cv
65#else
66# define PERL_INTERPRETER			perl_interpreter
67# define PERL_BACK_XS_INIT_PARAMS		void
68# define PERL_BACK_BOOT_DYNALOADER_PARAMS	CV *cv
69# define PERL_SET_CONTEXT(i)
70#endif
71
72extern PerlInterpreter *PERL_INTERPRETER;
73
74
75typedef struct perl_backend_instance {
76	char *pb_module_name;
77	BerVarray pb_module_path;
78	BerVarray pb_module_config;
79	SV	*pb_obj_ref;
80	int	pb_filter_search_results;
81} PerlBackend;
82
83LDAP_END_DECL
84
85#include "proto-perl.h"
86
87#endif /* PERL_BACK_H */
88