pdtree.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 FhG FOKUS
  5. * Copyright (C) 2005 Voice Sistem SRL (Voice-System.RO)
  6. *
  7. * This file is part of SIP Express Router.
  8. *
  9. * This file is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version
  13. *
  14. *
  15. * This file is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * For any questions about this software and its license, please contact
  25. * Voice Sistem at following e-mail address:
  26. * [email protected]
  27. *
  28. * History:
  29. * -------
  30. * 2005-01-25 first tree version (ramona)
  31. */
  32. #ifndef _PDTREE_H_
  33. #define _PDTREE_H_
  34. #include "../../str.h"
  35. typedef struct _pdt_node
  36. {
  37. str domain;
  38. struct _pdt_node *child;
  39. } pdt_node_t;
  40. #define PDT_MAX_DEPTH 32
  41. #define PDT_NODE_SIZE 10
  42. typedef struct _pdt_tree
  43. {
  44. pdt_node_t *head;
  45. int idsync;
  46. } pdt_tree_t;
  47. int pdt_add_to_tree(pdt_tree_t *pt, str *code, str *domain);
  48. int pdt_remove_from_tree(pdt_tree_t *pt, str *code);
  49. str* pdt_get_domain(pdt_tree_t *pt, str *code, int *plen);
  50. pdt_tree_t* pdt_init_tree();
  51. void pdt_free_tree(pdt_tree_t *pt);
  52. int pdt_print_tree(pdt_tree_t *pt);
  53. #endif