unsupported
     �Ê¿È      File not found.
  $   ˆl–Ðz¾”êe¶¥6 ]¸&n *bÑ¿Ç„^yŸÆÀÉ .k    /*
 * ProFTPD - FTP server daemon
 * Copyright (c) 2004-2023 The ProFTPD Project team
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
 *
 * As a special exemption, The ProFTPD Project team and other respective
 * copyright holders give permission to link this program with OpenSSL, and
 * distribute the resulting executable, without including the source code for
 * OpenSSL in the source distribution.
 */

/* Table management */

#ifndef PR_TABLE_H
#define PR_TABLE_H

#include "os.h"
#include "pool.h"

typedef struct tab_key {
  struct tab_key *next;
  const void *key_data;
  size_t key_datasz;
  unsigned int hash;
  unsigned nents;

} pr_table_key_t;

typedef struct tab_entry {
  struct tab_entry *next, *prev;
  unsigned int idx;
  pr_table_key_t *key;
  const void *value_data;
  size_t value_datasz;

} pr_table_entry_t;

typedef struct table_rec pr_table_t;

/* Add an entry in the table under the given key.  The char * pointer
 * is stored directly, NOT a copy of the memory to which it points.
 * If value_datasz is 0, value_data is assumed to be a NUL-terminated string
 * and strlen() is called on it.
 */
int pr_table_add(pr_table_t *tab, const char *key_data, const void *value_data,
  size_t value_datasz);

/* Add an entry in the table under the given key, making a duplicate of
 * the given value from the table's pool.  If value_datasz is 0, value_data
 * is assumed to be a NUL-terminated string and strlen() is called on it.
 */
int pr_table_add_dup(pr_table_t *tab, const char *key_data,
  const void *value_data, size_t value_datasz);

/* Allocates a new table from the given pool.  flags can be used to
 * determine the table behavior, e.g. will it allow multiple entries under
 * the same key (PR_TABLE_FL_MULTI_VALUE).
 */
pr_table_t *pr_table_alloc(pool *p, int flags);
#define PR_TABLE_FL_MULTI_VALUE		0x0001
#define PR_TABLE_FL_USE_CACHE		0x0002

/* Returns the number of entries stored in the table.
 */
int pr_table_count(pr_table_t *tab);

/* Similar to Perl's map() function, this function executes the given
 * callback on every entry in the table, passing in the key/value stored and a
 * pointer to user-provided data.  DO NOT ALTER the table inside the callback
 * function by adding or removing entries; it will alter the iterator state,
 * possibly causing entries to be skipped.
 *
 * This function is useful for when completely freeing an entire table and
 * everything in it: do() a free() function on the items, then free the table.
 *
 * The flags argument alters how the calling is done: a callback can return -1
 * to halt the iteration, unless PR_TABLE_DO_FL_ALL is used.
 */
int pr_table_do(pr_table_t *tab, int cb(const void *key_data,
  size_t key_datasz, const void *value_data, size_t value_datasz,
  void *user_data), void *user_data, int flags);
#define PR_TABLE_DO_FL_ALL			0x0010

/* Remove all entries from the table, emptying it.
 */
int pr_table_empty(pr_table_t *tab);

/* Returns a count of the number of entries stored under that key.  This
 * means that these tables allow multiple entries under the same key; it is
 * up to higher-level APIs to impose restrictions such as avoiding duplicates.
 */
int pr_table_exists(pr_table_t *tab, const char *key_data);

/* Free the given empty table.  If the table is not empty, -1 will be
 * returned, and errno s