multicast.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Gustavo Lopes <cataphract@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. /* $Id$ */
  19. #if defined(MCAST_JOIN_GROUP) && !defined(__APPLE__)
  20. # define RFC3678_API 1
  21. /* has block/unblock and source membership, in this case for both IPv4 and IPv6 */
  22. # define HAS_MCAST_EXT 1
  23. #elif defined(IP_ADD_SOURCE_MEMBERSHIP) && !defined(__APPLE__)
  24. /* has block/unblock and source membership, but only for IPv4 */
  25. # define HAS_MCAST_EXT 1
  26. #endif
  27. #ifndef RFC3678_API
  28. # define PHP_MCAST_JOIN_GROUP IP_ADD_MEMBERSHIP
  29. # define PHP_MCAST_LEAVE_GROUP IP_DROP_MEMBERSHIP
  30. # ifdef HAS_MCAST_EXT
  31. # define PHP_MCAST_BLOCK_SOURCE IP_BLOCK_SOURCE
  32. # define PHP_MCAST_UNBLOCK_SOURCE IP_UNBLOCK_SOURCE
  33. # define PHP_MCAST_JOIN_SOURCE_GROUP IP_ADD_SOURCE_MEMBERSHIP
  34. # define PHP_MCAST_LEAVE_SOURCE_GROUP IP_DROP_SOURCE_MEMBERSHIP
  35. # endif
  36. #else
  37. # define PHP_MCAST_JOIN_GROUP MCAST_JOIN_GROUP
  38. # define PHP_MCAST_LEAVE_GROUP MCAST_LEAVE_GROUP
  39. # define PHP_MCAST_BLOCK_SOURCE MCAST_BLOCK_SOURCE
  40. # define PHP_MCAST_UNBLOCK_SOURCE MCAST_UNBLOCK_SOURCE
  41. # define PHP_MCAST_JOIN_SOURCE_GROUP MCAST_JOIN_SOURCE_GROUP
  42. # define PHP_MCAST_LEAVE_SOURCE_GROUP MCAST_LEAVE_SOURCE_GROUP
  43. #endif
  44. int php_do_setsockopt_ip_mcast(php_socket *php_sock,
  45. int level,
  46. int optname,
  47. zval **arg4 TSRMLS_DC);
  48. int php_do_setsockopt_ipv6_mcast(php_socket *php_sock,
  49. int level,
  50. int optname,
  51. zval **arg4 TSRMLS_DC);
  52. int php_if_index_to_addr4(
  53. unsigned if_index,
  54. php_socket *php_sock,
  55. struct in_addr *out_addr TSRMLS_DC);
  56. int php_add4_to_if_index(
  57. struct in_addr *addr,
  58. php_socket *php_sock,
  59. unsigned *if_index TSRMLS_DC);
  60. int php_string_to_if_index(const char *val, unsigned *out TSRMLS_DC);
  61. int php_mcast_join(
  62. php_socket *sock,
  63. int level,
  64. struct sockaddr *group,
  65. socklen_t group_len,
  66. unsigned int if_index TSRMLS_DC);
  67. int php_mcast_leave(
  68. php_socket *sock,
  69. int level,
  70. struct sockaddr *group,
  71. socklen_t group_len,
  72. unsigned int if_index TSRMLS_DC);
  73. #ifdef HAS_MCAST_EXT
  74. int php_mcast_join_source(
  75. php_socket *sock,
  76. int level,
  77. struct sockaddr *group,
  78. socklen_t group_len,
  79. struct sockaddr *source,
  80. socklen_t source_len,
  81. unsigned int if_index TSRMLS_DC);
  82. int php_mcast_leave_source(
  83. php_socket *sock,
  84. int level,
  85. struct sockaddr *group,
  86. socklen_t group_len,
  87. struct sockaddr *source,
  88. socklen_t source_len,
  89. unsigned int if_index TSRMLS_DC);
  90. int php_mcast_block_source(
  91. php_socket *sock,
  92. int level,
  93. struct sockaddr *group,
  94. socklen_t group_len,
  95. struct sockaddr *source,
  96. socklen_t source_len,
  97. unsigned int if_index TSRMLS_DC);
  98. int php_mcast_unblock_source(
  99. php_socket *sock,
  100. int level,
  101. struct sockaddr *group,
  102. socklen_t group_len,
  103. struct sockaddr *source,
  104. socklen_t source_len,
  105. unsigned int if_index TSRMLS_DC);
  106. #endif