pythonmod.c File Reference

Python module for unbound. More...

#include "config.h"
#include "sldns/sbuffer.h"
#include <Python.h>
#include "pythonmod/pythonmod.h"
#include "util/module.h"
#include "util/config_file.h"
#include "pythonmod_utils.h"
#include "pythonmod/interface.h"

Data Structures

struct  pythonmod_env
 Global state for the module. More...
 
struct  pythonmod_qstate
 Per query state for the iterator module. More...
 

Functions

static void clean_python_function_objects (PyObject *dict)
 
static void log_py_err (void)
 log python error
 
static void pythonmod_atexit (void)
 
int pythonmod_init (struct module_env *env, int id)
 python module init
 
void pythonmod_deinit (struct module_env *env, int id)
 python module deinit
 
void pythonmod_inform_super (struct module_qstate *qstate, int id, struct module_qstate *super)
 python module

 
void pythonmod_operate (struct module_qstate *qstate, enum module_ev event, int id, struct outbound_entry *ATTR_UNUSED(outbound))
 
void pythonmod_clear (struct module_qstate *qstate, int id)
 python module cleanup query state
 
size_t pythonmod_get_mem (struct module_env *env, int id)
 python module alloc size routine
 
struct module_func_blockpythonmod_get_funcblock (void)
 Get the module function block. More...
 

Variables

int py_mod_count = 0
 counter for python module instances incremented by pythonmod_init(...)
 
PyThreadState * mainthr
 Python main thread.
 
static struct module_func_block pythonmod_block
 The module function block. More...
 

Detailed Description

Python module for unbound.

Calls python script.

Function Documentation

◆ pythonmod_get_funcblock()

struct module_func_block* pythonmod_get_funcblock ( void  )

Get the module function block.

Returns
: function block with function pointers to module methods.

References pythonmod_block.

Referenced by module_funcs_avail().

Variable Documentation

◆ pythonmod_block

struct module_func_block pythonmod_block
static
Initial value:
= {
"python",
}
void pythonmod_clear(struct module_qstate *qstate, int id)
python module cleanup query state
Definition: pythonmod.c:746
size_t pythonmod_get_mem(struct module_env *env, int id)
python module alloc size routine
Definition: pythonmod.c:766
void pythonmod_inform_super(struct module_qstate *qstate, int id, struct module_qstate *super)
python module
Definition: pythonmod.c:663
int pythonmod_init(struct module_env *env, int id)
python module init
Definition: pythonmod.c:294
void pythonmod_deinit(struct module_env *env, int id)
python module deinit
Definition: pythonmod.c:619
void pythonmod_operate(struct module_qstate *qstate, enum module_ev event, int id, struct outbound_entry *outbound)
python module operate on a query

The module function block.

Referenced by pythonmod_get_funcblock().