rbtree in freeradius

srithar jeevadurai srijeevadurai1 at gmail.com
Mon Dec 7 07:40:48 CET 2015


Hi Friends,

I want to understand the rbtree data structure used in freeradius.

my requirement is I have to store name-value pair in rbtree and I have to
retrieve data base on name.

As I understand from existing code.


*declaration:*

rbtree_t *conf= NULL;

*creation: *


rbtree_create( <1>, <NULL>, 0);

1-> function pointer to compare data for search
2-> NULL (I don;t know the purpose of 2nd parameter and 3rd parameter)
3->0


*Insert data:*
struct data* temp={"Name", "Value"}
rbtree_insert(conf, temp);


*Search:*

rbtree_finddata(conf, "Name");


*Delete:*


rbtree_deletebydata(conf, "Name");

*compare function ( function pointer to compare data for search):*

static int data_cmp(const void *one, const void two)
{
   const data * data1 = (const data *) one;
   const data *data2 = (const data*) two;
    return strcmp(data1->name, data2->name);
}



-- 
Regards,
Srithar Durairaj
Alternate Mail I.D: srijeevadurai1 at yahoo.co.in
Mobile: +919886251852


More information about the Freeradius-Users mailing list