id.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2005 iptelorg GmbH
  5. *
  6. * This file is part of ser, a free SIP server.
  7. *
  8. * ser 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. * For a license to use the ser software under conditions
  14. * other than those described here, or to purchase support for this
  15. * software, please contact iptel.org by e-mail at the following addresses:
  16. * [email protected]
  17. *
  18. * ser is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  26. *
  27. */
  28. #ifndef _ID_H
  29. #define _ID_H
  30. #include "str.h"
  31. #include "usr_avp.h"
  32. #include "parser/msg_parser.h"
  33. /*
  34. * Set From UID
  35. */
  36. int set_from_uid(str* uid);
  37. /*
  38. * Get From UID
  39. */
  40. int get_from_uid(str* uid, struct sip_msg* msg);
  41. /*
  42. * Set To UID
  43. */
  44. int set_to_uid(str* uid);
  45. /*
  46. * Ge To UID
  47. */
  48. int get_to_uid(str* uid, struct sip_msg* msg);
  49. /** Retrieves the UID of the callee. This function retrieves the UID (unique
  50. * identifier) of the party being called. The function first searches the list
  51. * of available attributes and if it finds an attribute with name "uid" then
  52. * the value of the attribute is returned. If no such attribute can be found
  53. * then the function retrieves the username from To header field of REGISTER
  54. * requests (because that is the party being registered), or the username from
  55. * the Reqeuest-URI of other requests. The username is then used as the UID
  56. * string identifying the callee. If no attribute with the UID was found and
  57. * the function successfully retrieved the UID from the SIP message then, in
  58. * addition to storing the result in the first parameter, the function will
  59. * also create the attribute named "uid" which will contain the UID. The
  60. * function is not reentrant because it uses an internal static buffer to
  61. * store the result.
  62. * @param uid A pointer to ::str variable where the result will be stored, the
  63. * pointer in the variable will be updated to point to a static
  64. * buffer in the function.
  65. * @param msg The SIP message being processed.
  66. * @return 1 is returned when the attribute with UID exists and it is used, 0
  67. * is returned when the function retrieved the UID from the SIP
  68. * message and created the attribute, -1 is returned on error.
  69. */
  70. int get_to_did(str* did, struct sip_msg* msg);
  71. /*
  72. * Return current From domain id
  73. */
  74. int get_from_did(str* did, struct sip_msg* msg);
  75. #endif /* _ID_H */