sctp_options.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2008 iptelorg GmbH
  5. *
  6. * Permission to use, copy, modify, and distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /*
  19. * sctp options
  20. */
  21. /*
  22. * History:
  23. * --------
  24. * 2008-08-07 initial version (andrei)
  25. */
  26. #include "sctp_options.h"
  27. #include "dprint.h"
  28. struct sctp_cfg_options sctp_options;
  29. void init_sctp_options()
  30. {
  31. #ifdef USE_SCTP
  32. sctp_options.sctp_autoclose=DEFAULT_SCTP_AUTOCLOSE; /* in seconds */
  33. sctp_options.sctp_send_ttl=DEFAULT_SCTP_SEND_TTL; /* in milliseconds */
  34. sctp_options.sctp_send_retries=DEFAULT_SCTP_SEND_RETRIES;
  35. #endif
  36. }
  37. #define W_OPT_NSCTP(option) \
  38. if (sctp_options.option){\
  39. WARN("sctp_options: " #option \
  40. " cannot be enabled (sctp support not compiled-in)\n"); \
  41. sctp_options.option=0; \
  42. }
  43. void sctp_options_check()
  44. {
  45. #ifndef USE_SCTP
  46. W_OPT_NSCTP(sctp_autoclose);
  47. W_OPT_NSCTP(sctp_send_ttl);
  48. W_OPT_NSCTP(sctp_send_retries);
  49. if (sctp_options.sctp_send_retries>MAX_SCTP_SEND_RETRIES) {
  50. WARN("sctp: sctp_send_retries too high (%d), setting it to %d\n",
  51. sctp_option.sctp_send_retries, MAX_SCTP_SEND_RETRIES);
  52. sctp_options.sctp_send_retries=MAX_SCTP_SEND_RETRIES;
  53. }
  54. #endif
  55. }
  56. void sctp_options_get(struct sctp_cfg_options *s)
  57. {
  58. *s=sctp_options;
  59. }