blob: 1ac444a198e0c976235ab76051a3591435c43c8c [file] [log] [blame]
Willy Tarreauc2186022009-10-26 19:48:54 +01001/*
Willy Tarreau3a932442010-05-09 19:29:23 +02002 * Elastic Binary Trees - exported functions for Indirect Multi-Byte data nodes.
Willy Tarreauf3bfede2011-07-25 11:38:17 +02003 * Version 6.0.6
4 * (C) 2002-2011 - Willy Tarreau <w@1wt.eu>
Willy Tarreauc2186022009-10-26 19:48:54 +01005 *
Willy Tarreauf3bfede2011-07-25 11:38:17 +02006 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation, version 2.1
9 * exclusively.
Willy Tarreauc2186022009-10-26 19:48:54 +010010 *
Willy Tarreauf3bfede2011-07-25 11:38:17 +020011 * This library is distributed in the hope that it will be useful,
Willy Tarreauc2186022009-10-26 19:48:54 +010012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Willy Tarreauf3bfede2011-07-25 11:38:17 +020013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
Willy Tarreauc2186022009-10-26 19:48:54 +010015 *
Willy Tarreauf3bfede2011-07-25 11:38:17 +020016 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Willy Tarreauc2186022009-10-26 19:48:54 +010019 */
20
21/* Consult ebimtree.h for more details about those functions */
22
Willy Tarreau8d2b7772020-05-27 10:58:19 +020023#include <import/ebimtree.h>
Willy Tarreaub2551052020-06-09 09:07:15 +020024#include <import/ebpttree.h>
Willy Tarreauc2186022009-10-26 19:48:54 +010025
Joseph Herlant7c16c0e2018-11-13 19:55:57 -080026/* Find the first occurrence of a key of <len> bytes in the tree <root>.
Willy Tarreauc2186022009-10-26 19:48:54 +010027 * If none can be found, return NULL.
28 */
Willy Tarreau03e78532020-02-25 07:38:05 +010029struct ebpt_node *
Willy Tarreauc2186022009-10-26 19:48:54 +010030ebim_lookup(struct eb_root *root, const void *x, unsigned int len)
31{
32 return __ebim_lookup(root, x, len);
33}
34
35/* Insert ebpt_node <new> into subtree starting at node root <root>.
36 * Only new->key needs be set with the key. The ebpt_node is returned.
37 * If root->b[EB_RGHT]==1, the tree may only contain unique keys. The
38 * len is specified in bytes.
39 */
Willy Tarreau03e78532020-02-25 07:38:05 +010040struct ebpt_node *
Willy Tarreauc2186022009-10-26 19:48:54 +010041ebim_insert(struct eb_root *root, struct ebpt_node *new, unsigned int len)
42{
43 return __ebim_insert(root, new, len);
44}