/usr/include/c_icap/lookup_table.h is in libicapapi-dev 1:0.4.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*
* Copyright (C) 2004-2009 Christos Tsantilas
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/
#ifndef __LOOKUP_TABLE_H
#define __LOOKUP_TABLE_H
#include "c-icap.h"
#include "mem.h"
#include "types_ops.h"
#include "array.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
\defgroup LOOKUPTABLE Lookup tables api
\ingroup API
\brief Macros, functions and structures used to implement and use lookup tables
*
* Lookup tables can considered as simple read only databases where the user can
* search a set of values using a key
*/
struct ci_lookup_table;
struct ci_lookup_table_type {
void *(*open)(struct ci_lookup_table *table);
void (*close)(struct ci_lookup_table *table);
void *(*search)(struct ci_lookup_table *table, void *key, void ***vals);
void (*release_result)(struct ci_lookup_table *table_data, void **val);
const void * (*get_row)(struct ci_lookup_table *table, const void *key, const char *columns[], void ***vals);
char *type;
};
/**
* \brief The lookup table struct
* \ingroup LOOKUPTABLE
*/
struct ci_lookup_table {
void *(*open)(struct ci_lookup_table *table);
void (*close)(struct ci_lookup_table *table);
void *(*search)(struct ci_lookup_table *table, void *key, void ***vals);
void (*release_result)(struct ci_lookup_table *table, void **val);
const void * (*get_row)(struct ci_lookup_table *table, const void *key, const char *columns[], void ***vals);
char *type;
char *path;
char *args;
int cols;
ci_str_vector_t *col_names;
const ci_type_ops_t *key_ops;
const ci_type_ops_t *val_ops;
ci_mem_allocator_t *allocator;
const struct ci_lookup_table_type *_lt_type;
void *data;
};
CI_DECLARE_FUNC(struct ci_lookup_table_type *) ci_lookup_table_type_register(struct ci_lookup_table_type *lt_type);
CI_DECLARE_FUNC(void) ci_lookup_table_type_unregister(struct ci_lookup_table_type *lt_type);
CI_DECLARE_FUNC(const struct ci_lookup_table_type *) ci_lookup_table_type_search(const char *type);
/**
* \brief Create a lookup table
* \ingroup LOOKUPTABLE
*
\param table The path of the lookup table (eg file:/etc/c-icap/users.txt or ldap://hostname/o=base?cn,uid?uid=chtsanti)
\return A pointer to a lookup table object
*/
CI_DECLARE_FUNC(struct ci_lookup_table *) ci_lookup_table_create(const char *table);
/**
* \brief Destroy a lookup table.
* \ingroup LOOKUPTABLE
*
\param lt Pointer to the lookup table will be destroyed.
*/
CI_DECLARE_FUNC(void) ci_lookup_table_destroy(struct ci_lookup_table *lt);
/**
* \brief Initializes the lookup table.
*
* \param table The lookup table object
*/
CI_DECLARE_FUNC(void *) ci_lookup_table_open(struct ci_lookup_table *table);
/**
* \brief Search for an object in the lookup table which matches a key.
*
* \param table The lookup table object
* \param key The key value to search for
* \param vals In this variable stored a 2d array which contains the return values
* \return NULL if none object matches, pointer to the object key value.
*/
CI_DECLARE_FUNC(const char *) ci_lookup_table_search(struct ci_lookup_table *table, const char *key, char ***vals);
/**
* \brief Releases the data values returned from the search method.
*
* \param table The lookup table object
* \param val The 2d array returned from the search method
*/
CI_DECLARE_FUNC(void) ci_lookup_table_release_result(struct ci_lookup_table *table, void **val);
/**
* \brief Search for an object in the lookup table which supports named columns.
*
* \param table The lookup table object
* \param key The key value to search for
* \param columns NULL terminated array with the names of the columns to retrieve.
* \param vals In this variable stored a 2d array which contains the requested row
* \return NULL if none object matches, pointer to the object key value.
*/
CI_DECLARE_FUNC(const char *) ci_lookup_table_get_row(struct ci_lookup_table *table, const char *key, const char *columns[], char ***vals);
#ifdef __cplusplus
}
#endif
#endif
|