modules_s/pdt/pdtree.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG FOKUS
00005  * Copyright (C) 2005 Voice Sistem SRL (Voice-System.RO)
00006  *
00007  * This file is part of SIP Express Router.
00008  *
00009  * This file is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  *
00015  * This file is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  * For any questions about this software and its license, please contact
00025  * Voice Sistem at following e-mail address:
00026  *         office@voice-sistem.ro
00027  *
00028  * History:
00029  * -------
00030  * 2005-01-25  first tree version (ramona)
00031  */
00032 
00033                        
00034 #ifndef _PDTREE_H_
00035 #define _PDTREE_H_
00036 
00037 #include "../../str.h"
00038 
00039 typedef struct _pdt_node
00040 {
00041         str domain;
00042         struct _pdt_node *child;
00043 } pdt_node_t;
00044 
00045 #define PDT_MAX_DEPTH   32
00046 
00047 #define PDT_NODE_SIZE   10
00048 
00049 typedef struct _pdt_tree
00050 {
00051         pdt_node_t *head;
00052         int idsync;
00053 } pdt_tree_t;
00054 
00055 
00056 int pdt_add_to_tree(pdt_tree_t *pt, str *code, str *domain);
00057 int pdt_remove_from_tree(pdt_tree_t *pt, str *code);
00058 str* pdt_get_domain(pdt_tree_t *pt, str *code, int *plen);
00059 
00060 pdt_tree_t* pdt_init_tree();
00061 void pdt_free_tree(pdt_tree_t *pt);
00062 int pdt_print_tree(pdt_tree_t *pt);
00063 
00064 #endif
00065