root/ext/sockets/multicast.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 7                                                        |
   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 
  19 /* $Id$ */
  20 
  21 #if defined(MCAST_JOIN_GROUP) && !defined(__APPLE__)
  22 # define RFC3678_API 1
  23 /* has block/unblock and source membership, in this case for both IPv4 and IPv6 */
  24 # define HAS_MCAST_EXT 1
  25 #elif defined(IP_ADD_SOURCE_MEMBERSHIP) && !defined(__APPLE__)
  26 /* has block/unblock and source membership, but only for IPv4 */
  27 # define HAS_MCAST_EXT 1
  28 #endif
  29 
  30 #ifndef RFC3678_API
  31 # define PHP_MCAST_JOIN_GROUP                   IP_ADD_MEMBERSHIP
  32 # define PHP_MCAST_LEAVE_GROUP                  IP_DROP_MEMBERSHIP
  33 # ifdef HAS_MCAST_EXT
  34 #  define PHP_MCAST_BLOCK_SOURCE                IP_BLOCK_SOURCE
  35 #  define PHP_MCAST_UNBLOCK_SOURCE              IP_UNBLOCK_SOURCE
  36 #  define PHP_MCAST_JOIN_SOURCE_GROUP   IP_ADD_SOURCE_MEMBERSHIP
  37 #  define PHP_MCAST_LEAVE_SOURCE_GROUP  IP_DROP_SOURCE_MEMBERSHIP
  38 # endif
  39 #else
  40 # define PHP_MCAST_JOIN_GROUP                   MCAST_JOIN_GROUP
  41 # define PHP_MCAST_LEAVE_GROUP                  MCAST_LEAVE_GROUP
  42 # define PHP_MCAST_BLOCK_SOURCE                 MCAST_BLOCK_SOURCE
  43 # define PHP_MCAST_UNBLOCK_SOURCE               MCAST_UNBLOCK_SOURCE
  44 # define PHP_MCAST_JOIN_SOURCE_GROUP    MCAST_JOIN_SOURCE_GROUP
  45 # define PHP_MCAST_LEAVE_SOURCE_GROUP   MCAST_LEAVE_SOURCE_GROUP
  46 #endif
  47 
  48 int php_do_setsockopt_ip_mcast(php_socket *php_sock,
  49                                                            int level,
  50                                                            int optname,
  51                                                            zval *arg4);
  52 
  53 int php_do_setsockopt_ipv6_mcast(php_socket *php_sock,
  54                                                                  int level,
  55                                                                  int optname,
  56                                                                  zval *arg4);
  57 
  58 int php_if_index_to_addr4(
  59         unsigned if_index,
  60         php_socket *php_sock,
  61         struct in_addr *out_addr);
  62 
  63 int php_add4_to_if_index(
  64         struct in_addr *addr,
  65         php_socket *php_sock,
  66         unsigned *if_index);
  67 
  68 int php_string_to_if_index(const char *val, unsigned *out);
  69 
  70 int php_mcast_join(
  71         php_socket *sock,
  72         int level,
  73         struct sockaddr *group,
  74         socklen_t group_len,
  75         unsigned int if_index);
  76 
  77 int php_mcast_leave(
  78         php_socket *sock,
  79         int level,
  80         struct sockaddr *group,
  81         socklen_t group_len,
  82         unsigned int if_index);
  83 
  84 #ifdef HAS_MCAST_EXT
  85 int php_mcast_join_source(
  86         php_socket *sock,
  87         int level,
  88         struct sockaddr *group,
  89         socklen_t group_len,
  90         struct sockaddr *source,
  91         socklen_t source_len,
  92         unsigned int if_index);
  93 
  94 int php_mcast_leave_source(
  95         php_socket *sock,
  96         int level,
  97         struct sockaddr *group,
  98         socklen_t group_len,
  99         struct sockaddr *source,
 100         socklen_t source_len,
 101         unsigned int if_index);
 102 
 103 int php_mcast_block_source(
 104         php_socket *sock,
 105         int level,
 106         struct sockaddr *group,
 107         socklen_t group_len,
 108         struct sockaddr *source,
 109         socklen_t source_len,
 110         unsigned int if_index);
 111 
 112 int php_mcast_unblock_source(
 113         php_socket *sock,
 114         int level,
 115         struct sockaddr *group,
 116         socklen_t group_len,
 117         struct sockaddr *source,
 118         socklen_t source_len,
 119         unsigned int if_index);
 120 #endif

/* [<][>][^][v][top][bottom][index][help] */