diff options
author | Stanley Cheung <stanleycheung@google.com> | 2015-10-21 17:00:49 -0700 |
---|---|---|
committer | Stanley Cheung <stanleycheung@google.com> | 2015-10-23 11:07:42 -0700 |
commit | aeea10287f1859ac6a0f07eb979e4085dd09981a (patch) | |
tree | e67d702d6b7e6bf3ebc2bf92db2630f1a96dc441 /src | |
parent | af93a8fddb7f61450e5a08df688d8bb0eb8a86a8 (diff) |
php: split grpc_credentials to channel_credentials and call_credentials
Diffstat (limited to 'src')
-rw-r--r-- | src/php/ext/grpc/call_credentials.c | 138 | ||||
-rwxr-xr-x | src/php/ext/grpc/call_credentials.h | 63 | ||||
-rw-r--r-- | src/php/ext/grpc/channel.c | 8 | ||||
-rwxr-xr-x | src/php/ext/grpc/config.m4 | 4 | ||||
-rw-r--r-- | src/php/ext/grpc/credentials.c | 120 | ||||
-rwxr-xr-x | src/php/ext/grpc/credentials.h | 24 | ||||
-rw-r--r-- | src/php/ext/grpc/package.xml | 18 | ||||
-rw-r--r-- | src/php/ext/grpc/php_grpc.c | 4 | ||||
-rwxr-xr-x | src/php/tests/unit_tests/SecureEndToEndTest.php | 4 |
9 files changed, 293 insertions, 90 deletions
diff --git a/src/php/ext/grpc/call_credentials.c b/src/php/ext/grpc/call_credentials.c new file mode 100644 index 0000000000..a773792062 --- /dev/null +++ b/src/php/ext/grpc/call_credentials.c @@ -0,0 +1,138 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "credentials.h" +#include "call_credentials.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <php.h> +#include <php_ini.h> +#include <ext/standard/info.h> +#include <ext/spl/spl_exceptions.h> +#include "php_grpc.h" + +#include <zend_exceptions.h> +#include <zend_hash.h> + +#include <grpc/grpc.h> +#include <grpc/grpc_security.h> + +zend_class_entry *grpc_ce_call_credentials; + +/* Frees and destroys an instance of wrapped_grpc_call_credentials */ +void free_wrapped_grpc_call_credentials(void *object TSRMLS_DC) { + wrapped_grpc_call_credentials *creds = + (wrapped_grpc_call_credentials *)object; + if (creds->wrapped != NULL) { + grpc_call_credentials_release(creds->wrapped); + } + efree(creds); +} + +/* Initializes an instance of wrapped_grpc_call_credentials to be + * associated with an object of a class specified by class_type */ +zend_object_value create_wrapped_grpc_call_credentials( + zend_class_entry *class_type TSRMLS_DC) { + zend_object_value retval; + wrapped_grpc_call_credentials *intern; + + intern = (wrapped_grpc_call_credentials *)emalloc( + sizeof(wrapped_grpc_call_credentials)); + memset(intern, 0, sizeof(wrapped_grpc_call_credentials)); + + zend_object_std_init(&intern->std, class_type TSRMLS_CC); + object_properties_init(&intern->std, class_type); + retval.handle = zend_objects_store_put( + intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, + free_wrapped_grpc_call_credentials, NULL TSRMLS_CC); + retval.handlers = zend_get_std_object_handlers(); + return retval; +} + +zval *grpc_php_wrap_call_credentials(grpc_call_credentials *wrapped) { + zval *credentials_object; + MAKE_STD_ZVAL(credentials_object); + object_init_ex(credentials_object, grpc_ce_call_credentials); + wrapped_grpc_call_credentials *credentials = + (wrapped_grpc_call_credentials *)zend_object_store_get_object( + credentials_object TSRMLS_CC); + credentials->wrapped = wrapped; + return credentials_object; +} + +/** + * Create composite credentials from two existing credentials. + * @param Credentials cred1 The first credential + * @param Credentials cred2 The second credential + * @return Credentials The new composite credentials object + */ +PHP_METHOD(CallCredentials, createComposite) { + zval *cred1_obj; + zval *cred2_obj; + + /* "OO" == 3 Objects */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO", &cred1_obj, + grpc_ce_call_credentials, &cred2_obj, + grpc_ce_call_credentials) == FAILURE) { + zend_throw_exception(spl_ce_InvalidArgumentException, + "createComposite expects 2 CallCredentials", + 1 TSRMLS_CC); + return; + } + wrapped_grpc_call_credentials *cred1 = + (wrapped_grpc_call_credentials *)zend_object_store_get_object( + cred1_obj TSRMLS_CC); + wrapped_grpc_call_credentials *cred2 = + (wrapped_grpc_call_credentials *)zend_object_store_get_object( + cred2_obj TSRMLS_CC); + grpc_call_credentials *creds = + grpc_composite_call_credentials_create(cred1->wrapped, cred2->wrapped, + NULL); + zval *creds_object = grpc_php_wrap_call_credentials(creds); + RETURN_DESTROY_ZVAL(creds_object); +} + +static zend_function_entry call_credentials_methods[] = { + PHP_ME(CallCredentials, createComposite, NULL, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_FE_END}; + +void grpc_init_call_credentials(TSRMLS_D) { + zend_class_entry ce; + INIT_CLASS_ENTRY(ce, "Grpc\\CallCredentials", call_credentials_methods); + ce.create_object = create_wrapped_grpc_call_credentials; + grpc_ce_call_credentials = zend_register_internal_class(&ce TSRMLS_CC); +} diff --git a/src/php/ext/grpc/call_credentials.h b/src/php/ext/grpc/call_credentials.h new file mode 100755 index 0000000000..8f35ac68bc --- /dev/null +++ b/src/php/ext/grpc/call_credentials.h @@ -0,0 +1,63 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_ +#define NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_ini.h" +#include "ext/standard/info.h" +#include "php_grpc.h" + +#include "grpc/grpc.h" +#include "grpc/grpc_security.h" + +/* Class entry for the CallCredentials PHP class */ +extern zend_class_entry *grpc_ce_call_credentials; + +/* Wrapper struct for grpc_call_credentials that can be associated + * with a PHP object */ +typedef struct wrapped_grpc_call_credentials { + zend_object std; + + grpc_call_credentials *wrapped; +} wrapped_grpc_call_credentials; + +/* Initializes the CallCredentials PHP class */ +void grpc_init_call_credentials(TSRMLS_D); + +#endif /* NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_ */ diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index a4313b6bd4..55541934a1 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -139,7 +139,7 @@ PHP_METHOD(Channel, __construct) { grpc_channel_args args; HashTable *array_hash; zval **creds_obj = NULL; - wrapped_grpc_credentials *creds = NULL; + wrapped_grpc_channel_credentials *creds = NULL; /* "s|a" == 1 string, 1 optional array */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &target, &target_length, &args_array) == FAILURE) { @@ -153,13 +153,13 @@ PHP_METHOD(Channel, __construct) { array_hash = Z_ARRVAL_P(args_array); if (zend_hash_find(array_hash, "credentials", sizeof("credentials"), (void **)&creds_obj) == SUCCESS) { - if (zend_get_class_entry(*creds_obj TSRMLS_CC) != grpc_ce_credentials) { + if (zend_get_class_entry(*creds_obj TSRMLS_CC) != grpc_ce_channel_credentials) { zend_throw_exception(spl_ce_InvalidArgumentException, - "credentials must be a Credentials object", + "credentials must be a ChannelCredentials object", 1 TSRMLS_CC); return; } - creds = (wrapped_grpc_credentials *)zend_object_store_get_object( + creds = (wrapped_grpc_channel_credentials *)zend_object_store_get_object( *creds_obj TSRMLS_CC); zend_hash_del(array_hash, "credentials", 12); } diff --git a/src/php/ext/grpc/config.m4 b/src/php/ext/grpc/config.m4 index 8bacdfbfec..131fc2a159 100755 --- a/src/php/ext/grpc/config.m4 +++ b/src/php/ext/grpc/config.m4 @@ -71,5 +71,7 @@ if test "$PHP_GRPC" != "no"; then PHP_SUBST(GRPC_SHARED_LIBADD) - PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c completion_queue.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -std=c11) + PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c call_credentials.c channel.c \ + completion_queue.c credentials.c timeval.c server.c server_credentials.c \ + php_grpc.c, $ext_shared, , -Wall -Werror -std=c11) fi diff --git a/src/php/ext/grpc/credentials.c b/src/php/ext/grpc/credentials.c index e413070b45..796c4cb93b 100644 --- a/src/php/ext/grpc/credentials.c +++ b/src/php/ext/grpc/credentials.c @@ -32,6 +32,7 @@ */ #include "credentials.h" +#include "call_credentials.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -49,55 +50,56 @@ #include <grpc/grpc.h> #include <grpc/grpc_security.h> -zend_class_entry *grpc_ce_credentials; +zend_class_entry *grpc_ce_channel_credentials; -/* Frees and destroys an instance of wrapped_grpc_credentials */ -void free_wrapped_grpc_credentials(void *object TSRMLS_DC) { - wrapped_grpc_credentials *creds = (wrapped_grpc_credentials *)object; +/* Frees and destroys an instance of wrapped_grpc_channel_credentials */ +void free_wrapped_grpc_channel_credentials(void *object TSRMLS_DC) { + wrapped_grpc_channel_credentials *creds = + (wrapped_grpc_channel_credentials *)object; if (creds->wrapped != NULL) { - grpc_credentials_release(creds->wrapped); + grpc_channel_credentials_release(creds->wrapped); } efree(creds); } -/* Initializes an instance of wrapped_grpc_credentials to be associated with an - * object of a class specified by class_type */ -zend_object_value create_wrapped_grpc_credentials(zend_class_entry *class_type - TSRMLS_DC) { +/* Initializes an instance of wrapped_grpc_channel_credentials to be + * associated with an object of a class specified by class_type */ +zend_object_value create_wrapped_grpc_channel_credentials( + zend_class_entry *class_type TSRMLS_DC) { zend_object_value retval; - wrapped_grpc_credentials *intern; + wrapped_grpc_channel_credentials *intern; - intern = - (wrapped_grpc_credentials *)emalloc(sizeof(wrapped_grpc_credentials)); - memset(intern, 0, sizeof(wrapped_grpc_credentials)); + intern = (wrapped_grpc_channel_credentials *)emalloc( + sizeof(wrapped_grpc_channel_credentials)); + memset(intern, 0, sizeof(wrapped_grpc_channel_credentials)); zend_object_std_init(&intern->std, class_type TSRMLS_CC); object_properties_init(&intern->std, class_type); retval.handle = zend_objects_store_put( intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, - free_wrapped_grpc_credentials, NULL TSRMLS_CC); + free_wrapped_grpc_channel_credentials, NULL TSRMLS_CC); retval.handlers = zend_get_std_object_handlers(); return retval; } -zval *grpc_php_wrap_credentials(grpc_credentials *wrapped) { +zval *grpc_php_wrap_channel_credentials(grpc_channel_credentials *wrapped) { zval *credentials_object; MAKE_STD_ZVAL(credentials_object); - object_init_ex(credentials_object, grpc_ce_credentials); - wrapped_grpc_credentials *credentials = - (wrapped_grpc_credentials *)zend_object_store_get_object( + object_init_ex(credentials_object, grpc_ce_channel_credentials); + wrapped_grpc_channel_credentials *credentials = + (wrapped_grpc_channel_credentials *)zend_object_store_get_object( credentials_object TSRMLS_CC); credentials->wrapped = wrapped; return credentials_object; } /** - * Create a default credentials object. - * @return Credentials The new default credentials object + * Create a default channel credentials object. + * @return ChannelCredentials The new default channel credentials object */ -PHP_METHOD(Credentials, createDefault) { - grpc_credentials *creds = grpc_google_default_credentials_create(); - zval *creds_object = grpc_php_wrap_credentials(creds); +PHP_METHOD(ChannelCredentials, createDefault) { + grpc_channel_credentials *creds = grpc_google_default_credentials_create(); + zval *creds_object = grpc_php_wrap_channel_credentials(creds); RETURN_DESTROY_ZVAL(creds_object); } @@ -108,9 +110,9 @@ PHP_METHOD(Credentials, createDefault) { * (optional) * @param string pem_cert_chain PEM encoding of the client's certificate chain * (optional) - * @return Credentials The new SSL credentials object + * @return ChannelCredentials The new SSL credentials object */ -PHP_METHOD(Credentials, createSsl) { +PHP_METHOD(ChannelCredentials, createSsl) { char *pem_root_certs = NULL; grpc_ssl_pem_key_cert_pair pem_key_cert_pair; @@ -121,71 +123,65 @@ PHP_METHOD(Credentials, createSsl) { /* "|s!s!s! == 3 optional nullable strings */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!", &pem_root_certs, &root_certs_length, - &pem_key_cert_pair.private_key, &private_key_length, + &pem_key_cert_pair.private_key, + &private_key_length, &pem_key_cert_pair.cert_chain, &cert_chain_length) == FAILURE) { zend_throw_exception(spl_ce_InvalidArgumentException, "createSsl expects 3 optional strings", 1 TSRMLS_CC); return; } - grpc_credentials *creds = grpc_ssl_credentials_create( + grpc_channel_credentials *creds = grpc_ssl_credentials_create( pem_root_certs, pem_key_cert_pair.private_key == NULL ? NULL : &pem_key_cert_pair, NULL); - zval *creds_object = grpc_php_wrap_credentials(creds); + zval *creds_object = grpc_php_wrap_channel_credentials(creds); RETURN_DESTROY_ZVAL(creds_object); } /** * Create composite credentials from two existing credentials. - * @param Credentials cred1 The first credential - * @param Credentials cred2 The second credential - * @return Credentials The new composite credentials object + * @param ChannelCredentials cred1 The first credential + * @param CallCredentials cred2 The second credential + * @return ChannelCredentials The new composite credentials object */ -PHP_METHOD(Credentials, createComposite) { +PHP_METHOD(ChannelCredentials, createComposite) { zval *cred1_obj; zval *cred2_obj; /* "OO" == 3 Objects */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO", &cred1_obj, - grpc_ce_credentials, &cred2_obj, - grpc_ce_credentials) == FAILURE) { + grpc_ce_channel_credentials, &cred2_obj, + grpc_ce_call_credentials) == FAILURE) { zend_throw_exception(spl_ce_InvalidArgumentException, "createComposite expects 2 Credentials", 1 TSRMLS_CC); return; } - wrapped_grpc_credentials *cred1 = - (wrapped_grpc_credentials *)zend_object_store_get_object( + wrapped_grpc_channel_credentials *cred1 = + (wrapped_grpc_channel_credentials *)zend_object_store_get_object( cred1_obj TSRMLS_CC); - wrapped_grpc_credentials *cred2 = - (wrapped_grpc_credentials *)zend_object_store_get_object( + wrapped_grpc_call_credentials *cred2 = + (wrapped_grpc_call_credentials *)zend_object_store_get_object( cred2_obj TSRMLS_CC); - grpc_credentials *creds = - grpc_composite_credentials_create(cred1->wrapped, cred2->wrapped, NULL); - zval *creds_object = grpc_php_wrap_credentials(creds); + grpc_channel_credentials *creds = + grpc_composite_channel_credentials_create(cred1->wrapped, cred2->wrapped, + NULL); + zval *creds_object = grpc_php_wrap_channel_credentials(creds); RETURN_DESTROY_ZVAL(creds_object); } -/** - * Create Google Compute Engine credentials - * @return Credentials The new GCE credentials object - */ -PHP_METHOD(Credentials, createGce) { - grpc_credentials *creds = grpc_google_compute_engine_credentials_create(NULL); - zval *creds_object = grpc_php_wrap_credentials(creds); - RETURN_DESTROY_ZVAL(creds_object); -} - -static zend_function_entry credentials_methods[] = { - PHP_ME(Credentials, createDefault, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Credentials, createSsl, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Credentials, createComposite, NULL, - ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Credentials, createGce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_FE_END}; +static zend_function_entry channel_credentials_methods[] = { + PHP_ME(ChannelCredentials, createDefault, NULL, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(ChannelCredentials, createSsl, NULL, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(ChannelCredentials, createComposite, NULL, + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_FE_END}; -void grpc_init_credentials(TSRMLS_D) { +void grpc_init_channel_credentials(TSRMLS_D) { zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "Grpc\\Credentials", credentials_methods); - ce.create_object = create_wrapped_grpc_credentials; - grpc_ce_credentials = zend_register_internal_class(&ce TSRMLS_CC); + INIT_CLASS_ENTRY(ce, "Grpc\\ChannelCredentials", + channel_credentials_methods); + ce.create_object = create_wrapped_grpc_channel_credentials; + grpc_ce_channel_credentials = zend_register_internal_class(&ce TSRMLS_CC); } diff --git a/src/php/ext/grpc/credentials.h b/src/php/ext/grpc/credentials.h index 86d7ae5b14..d89984ce60 100755 --- a/src/php/ext/grpc/credentials.h +++ b/src/php/ext/grpc/credentials.h @@ -31,8 +31,8 @@ * */ -#ifndef NET_GRPC_PHP_GRPC_CREDENTIALS_H_ -#define NET_GRPC_PHP_GRPC_CREDENTIALS_H_ +#ifndef NET_GRPC_PHP_GRPC_CHANNEL_CREDENTIALS_H_ +#define NET_GRPC_PHP_GRPC_CHANNEL_CREDENTIALS_H_ #ifdef HAVE_CONFIG_H #include "config.h" @@ -46,18 +46,18 @@ #include "grpc/grpc.h" #include "grpc/grpc_security.h" -/* Class entry for the Credentials PHP class */ -extern zend_class_entry *grpc_ce_credentials; +/* Class entry for the ChannelCredentials PHP class */ +extern zend_class_entry *grpc_ce_channel_credentials; -/* Wrapper struct for grpc_credentials that can be associated with a PHP - * object */ -typedef struct wrapped_grpc_credentials { +/* Wrapper struct for grpc_channel_credentials that can be associated + * with a PHP object */ +typedef struct wrapped_grpc_channel_credentials { zend_object std; - grpc_credentials *wrapped; -} wrapped_grpc_credentials; + grpc_channel_credentials *wrapped; +} wrapped_grpc_channel_credentials; -/* Initializes the Credentials PHP class */ -void grpc_init_credentials(TSRMLS_D); +/* Initializes the ChannelCredentials PHP class */ +void grpc_init_channel_credentials(TSRMLS_D); -#endif /* NET_GRPC_PHP_GRPC_CREDENTIALS_H_ */ +#endif /* NET_GRPC_PHP_GRPC_CHANNEL_CREDENTIALS_H_ */ diff --git a/src/php/ext/grpc/package.xml b/src/php/ext/grpc/package.xml index 921cfc6ae6..8a25239eec 100644 --- a/src/php/ext/grpc/package.xml +++ b/src/php/ext/grpc/package.xml @@ -10,8 +10,8 @@ <email>grpc-packages@google.com</email> <active>yes</active> </lead> - <date>2015-10-07</date> - <time>13:40:54</time> + <date>2015-10-21</date> + <time>16:58:38</time> <version> <release>0.6.1</release> <api>0.6.0</api> @@ -30,16 +30,18 @@ <file baseinstalldir="/" md5sum="c8de0f819499c48adfc8d7f472c0196b" name="byte_buffer.h" role="src" /> <file baseinstalldir="/" md5sum="d64c9005993de02abac55664b0b9e0b2" name="call.c" role="src" /> <file baseinstalldir="/" md5sum="26acbf04c30162c2d2aca4688bb2aec8" name="call.h" role="src" /> - <file baseinstalldir="/" md5sum="15e56239b32c803f073e8a2b9f96e8c3" name="channel.c" role="src" /> + <file baseinstalldir="/" md5sum="cc48804689564aa1e18095f957f06685" name="call_credentials.c" role="src" /> + <file baseinstalldir="/" md5sum="e45269975f9a30fd349a90daf6b31aa2" name="call_credentials.h" role="src" /> + <file baseinstalldir="/" md5sum="00b3dc982f9171e03758ff12ddb6729b" name="channel.c" role="src" /> <file baseinstalldir="/" md5sum="ed4b00c0cf3702b115d0cfa87450dc09" name="channel.h" role="src" /> <file baseinstalldir="/" md5sum="55ab7a42f9dd9bfc7e28a61cfc5fca63" name="completion_queue.c" role="src" /> <file baseinstalldir="/" md5sum="f10b5bb232d74a6878e829e2e76cdaa2" name="completion_queue.h" role="src" /> - <file baseinstalldir="/" md5sum="a22f8eac0164761058cc4d9eb2ceb069" name="config.m4" role="src" /> - <file baseinstalldir="/" md5sum="588752c908f7bc1663f7b8fc922ae661" name="credentials.c" role="src" /> - <file baseinstalldir="/" md5sum="6988d6e97c19c8f8e3eb92371cf8246b" name="credentials.h" role="src" /> + <file baseinstalldir="/" md5sum="7d80c71737336f4548574da2a6f306d3" name="config.m4" role="src" /> + <file baseinstalldir="/" md5sum="f9c2e18949c809acdc8ee1a17cfb7320" name="credentials.c" role="src" /> + <file baseinstalldir="/" md5sum="a86250e03f610ce6c2c7595a84e08821" name="credentials.h" role="src" /> <file baseinstalldir="/" md5sum="38a1bc979d810c36ebc2a52d4b7b5319" name="CREDITS" role="doc" /> <file baseinstalldir="/" md5sum="3f35b472bbdef5a788cd90617d7d0847" name="LICENSE" role="doc" /> - <file baseinstalldir="/" md5sum="b77f1f3941aaf7a21090b493e9f26037" name="php_grpc.c" role="src" /> + <file baseinstalldir="/" md5sum="c35ad9b424b18a5fb5eb9bd3e07893c5" name="php_grpc.c" role="src" /> <file baseinstalldir="/" md5sum="673b07859d9f69232f8a754c56780686" name="php_grpc.h" role="src" /> <file baseinstalldir="/" md5sum="7533a6d3ea02c78cad23a9651de0825d" name="README.md" role="doc" /> <file baseinstalldir="/" md5sum="3e4e960454ebb2fc7b78a840493f5315" name="server.c" role="src" /> @@ -122,7 +124,7 @@ Update to wrap gRPC C Core version 0.10.0 <release>beta</release> <api>beta</api> </stability> - <date>2015-10-07</date> + <date>2015-10-21</date> <license>BSD</license> <notes> - fixed undefined constant fatal error when run with apache/nginx #2275 diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index fcd94a6306..934f6c7b53 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -36,6 +36,7 @@ #include "server.h" #include "timeval.h" #include "credentials.h" +#include "call_credentials.h" #include "server_credentials.h" #include "completion_queue.h" @@ -233,7 +234,8 @@ PHP_MINIT_FUNCTION(grpc) { grpc_init_channel(TSRMLS_C); grpc_init_server(TSRMLS_C); grpc_init_timeval(TSRMLS_C); - grpc_init_credentials(TSRMLS_C); + grpc_init_channel_credentials(TSRMLS_C); + grpc_init_call_credentials(TSRMLS_C); grpc_init_server_credentials(TSRMLS_C); grpc_php_init_completion_queue(TSRMLS_C); return SUCCESS; diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index d7fca14a0d..75256e5d33 100755 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -33,7 +33,7 @@ */ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ public function setUp() { - $credentials = Grpc\Credentials::createSsl( + $channel_credentials = Grpc\ChannelCredentials::createSsl( file_get_contents(dirname(__FILE__) . '/../data/ca.pem')); $server_credentials = Grpc\ServerCredentials::createSsl( null, @@ -49,7 +49,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ [ 'grpc.ssl_target_name_override' => $this->host_override, 'grpc.default_authority' => $this->host_override, - 'credentials' => $credentials + 'credentials' => $channel_credentials ]); } |