hash_mode.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2012 [email protected], 1&1 Internet AG
  5. *
  6. * This file is part of SIP-router, a free SIP server.
  7. *
  8. * SIP-router is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version
  12. *
  13. * SIP-router is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. *
  22. */
  23. #ifndef HASH_MODE_H
  24. #define HASH_MODE_H 1
  25. /*
  26. * Determines from which part of a message will be used to calculate the hash
  27. * Possible values are:
  28. *
  29. * hs_call_id the content of the Call-ID header field
  30. * hs_from_user the username part of the URI in the From header field
  31. * hs_to_user the username part of the URI in the To header field
  32. * hs_error no hash specified
  33. */
  34. enum hash_source {
  35. hs_call_id = 1,
  36. hs_from_user,
  37. hs_to_user,
  38. hs_error
  39. };
  40. /*
  41. * CRC32 hash function
  42. * Returns an integer number between 0 and denominator - 1 based on
  43. * the hash source from the msg. The hash algorithm is CRC32.
  44. */
  45. int hash_func (struct _sipcapture_object * sco,
  46. enum hash_source source, int denominator);
  47. /*
  48. * Gets the hash source type.
  49. */
  50. enum hash_source get_hash_source (const char *hash_source);
  51. #endif