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