name_tree.h File Reference

NAME tree collections APIs. More...


Data Structures

struct  name_node_
 Definition of a node in our internal Patricia tree. More...
struct  name_tree_
 Definition of the tree collection. More...

Defines

#define NAME_KEY_LENGTH   PAT_MAXKEY
 The maximum length of a key, in bytes.

Typedefs

typedef name_node_ name_node_t
 Definition of a node in our internal Patricia tree.
typedef name_tree_ name_tree_t
 Definition of the tree collection.

Functions

boolean name_tree_init (name_tree_t *tree)
 Initializes a name tree.
boolean name_tree_destroy (name_tree_t *tree)
 Destroys a name tree.
name_node_tname_tree_add (name_tree_t *tree, const char *key, void *data)
 Associates some data with the key string in a name tree.
void * name_tree_delete (name_tree_t *tree, const char *key)
 Removes data associated with the key string from a name tree.
void * name_tree_lookup (name_tree_t *tree, const char *key)
 Gets the data pointer associated with the key string from a name tree.
name_node_tname_tree_node_lookup (name_tree_t *tree, const char *key)
 Gets the node pointer associated with the key string from a name tree.
char * name_tree_first_key (name_tree_t *tree)
 Gets the first key in the name tree in lexical order.
name_node_tname_tree_next_node (name_tree_t *tree, name_node_t *node)
 Gets the next node after the specified one, in lexical order.
name_node_tname_tree_next_highest_node (name_tree_t *tree, const char *key, boolean geq)
 Gets the highest lexical match of the key.
boolean name_tree_isempty (name_tree_t *tree)
 Determines if the name tree has any nodes.
boolean name_tree_clear (name_tree_t *tree)
 Deletes all name tree nodes in the tree.


Detailed Description

NAME tree collections APIs.


Typedef Documentation

typedef struct name_node_ name_node_t
 

Definition of a node in our internal Patricia tree.

Each one of these represents an data that is associated with a name in the tree.


Function Documentation

name_node_t* name_tree_add name_tree_t tree,
const char *  key,
void *  data
 

Associates some data with the key string in a name tree.

Parameters:
[in] tree Pointer to a name tree
[in] key String to use as the key
[in] data Data to store under the key
Returns:
A pointer to the name tree node.

boolean name_tree_clear name_tree_t tree  ) 
 

Deletes all name tree nodes in the tree.

Warning:
This will not free any data associated to with the name tree nodes. It only deletes and frees the name tree nodes themselves.
Parameters:
[in] tree Pointer to a name tree
Returns:
TRUE on success; FALSE otherwise.

void* name_tree_delete name_tree_t tree,
const char *  key
 

Removes data associated with the key string from a name tree.

Parameters:
[in] tree Pointer to a name tree
[in] key String to use as the key
Returns:
Data associated with the key string; NULL if no match was found in the tree.

boolean name_tree_destroy name_tree_t tree  ) 
 

Destroys a name tree.

Traverses the tree, deallocating the nodes of the tree.

Parameters:
[in] tree Pointer to a name tree
Returns:
TRUE on success; Otherwise, return FALSE.

char* name_tree_first_key name_tree_t tree  ) 
 

Gets the first key in the name tree in lexical order.

Parameters:
[in] tree Pointer to a name tree
Returns:
A key string for the first name tree node.

boolean name_tree_init name_tree_t tree  ) 
 

Initializes a name tree.

Parameters:
[in] tree Pointer to a name tree
Returns:
TRUE on success; Otherwise, return FALSE.

boolean name_tree_isempty name_tree_t tree  ) 
 

Determines if the name tree has any nodes.

Parameters:
[in] tree Pointer to a name tree
Returns:
TRUE if the name tree has no nodes; FALSE otherwise.

void* name_tree_lookup name_tree_t tree,
const char *  key
 

Gets the data pointer associated with the key string from a name tree.

Parameters:
[in] tree Pointer to a name tree
[in] key String to use as the key
Returns:
Data associated with the key string; NULL if no match was found in the tree.

name_node_t* name_tree_next_highest_node name_tree_t tree,
const char *  key,
boolean  geq
 

Gets the highest lexical match of the key.

Parameters:
[in] tree Pointer to a name tree
[in] key String to use as the key
[in] geq FALSE for classic getnext
Returns:
A pointer to name tree node which is the highest lexical match.

name_node_t* name_tree_next_node name_tree_t tree,
name_node_t node
 

Gets the next node after the specified one, in lexical order.

Parameters:
[in] tree Pointer to a name tree
[in] node Pointer to a name tree node
Returns:
A pointer to the name tree node after after node.

name_node_t* name_tree_node_lookup name_tree_t tree,
const char *  key
 

Gets the node pointer associated with the key string from a name tree.

Parameters:
[in] tree Pointer to a name tree
[in] key String to use as the key
Returns:
Matching node associated with the key string; NULL if no match was found in the tree.


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:24:32 2010 for libjuniper by Doxygen 1.4.5