utils.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * $Id$
  3. *
  4. * Sdp mangler module
  5. *
  6. * Copyright (C) 2001-2003 FhG Fokus
  7. *
  8. * This file is part of SIP-router, a free SIP server.
  9. *
  10. * SIP-router is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version
  14. *
  15. * SIP-router 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. * History:
  25. * --------
  26. * 2003-04-07 first version.
  27. */
  28. /*!
  29. * \file
  30. * \brief SIP-utils :: Mangler
  31. * \ingroup siputils
  32. * - Module; \ref siputils
  33. */
  34. #ifndef UTILS_H
  35. #define UTILS_H
  36. #include "../../parser/msg_parser.h" /* struct sip_msg */
  37. /* replace a part of a sip message identified by (start address,length) with a new part
  38. @param msg a pointer to a sip message
  39. @param oldstr the start address of the part to be modified
  40. @param oldlen the length of the part being modified
  41. @param newstr the start address of the part to be added
  42. @param oldlen the length of the part being added
  43. @return 0 in case of success, negative on error
  44. */
  45. int patch (struct sip_msg *msg, char *oldstr, unsigned int oldlen,
  46. char *newstr, unsigned int newlen);
  47. /*
  48. modify the Content-Length header of a sip message
  49. @param msg a pointer to a sip message
  50. @param newValue the new value of Content-Length
  51. @return 0 in case of success, negative on error
  52. */
  53. int patch_content_length (struct sip_msg *msg, unsigned int newValue);
  54. #endif