Skip to content

Commit 936e199

Browse files
author
Brad House
committed
sync missing functions from libmonetra-5
1 parent e77c65f commit 936e199

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

ext/mcve/mcve.c

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ function_entry mcve_functions[] = {
6060
PHP_FE(m_setdropfile, NULL)
6161
PHP_FE(m_setip, NULL)
6262
PHP_FE(m_setssl, NULL)
63+
#if LIBMONETRA_VERSION >= 050000
64+
PHP_FE(m_setssl_cafile, NULL)
65+
PHP_FE(m_responsekeys, NULL)
66+
#endif
6367
PHP_FE(m_setssl_files, NULL)
6468
PHP_FE(m_settimeout, NULL)
6569
PHP_FE(m_setblocking, NULL)
@@ -734,6 +738,31 @@ PHP_FUNCTION(m_setssl)
734738
}
735739
/* }}} */
736740

741+
#if LIBMONETRA_VERSION >= 050000
742+
/* {{{ proto int m_setssl_cafile(resource conn, string cafile)
743+
Set SSL CA (Certificate Authority) file for verification of server
744+
certificate
745+
*/
746+
PHP_FUNCTION(m_setssl_cafile)
747+
{
748+
MCVE_CONN *conn;
749+
int retval;
750+
zval **arg1, **arg2;
751+
752+
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
753+
WRONG_PARAM_COUNT;
754+
755+
756+
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
757+
convert_to_string_ex(arg2);
758+
759+
retval = M_SetSSL_CAfile(conn, Z_STRVAL_PP(arg2));
760+
761+
RETURN_LONG(retval);
762+
}
763+
/* }}} */
764+
#endif
765+
737766
/* {{{ proto int m_setssl_files(resource conn, string sslkeyfile, string sslcertfile)
738767
Set certificate key files and certificates if server requires client certificate
739768
verification
@@ -1150,6 +1179,36 @@ PHP_FUNCTION(m_responseparam)
11501179
}
11511180
/* }}} */
11521181

1182+
#if LIBMONETRA_VERSION >= 050000
1183+
/* {{{ proto array m_responsekeys(resource conn, long identifier)
1184+
Returns array of strings which represents the keys that can be used
1185+
for response parameters on this transaction
1186+
*/
1187+
PHP_FUNCTION(m_responsekeys)
1188+
{
1189+
MCVE_CONN *conn;
1190+
char **retval;
1191+
int num_keys, i;
1192+
zval **arg1, **arg2;
1193+
1194+
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
1195+
WRONG_PARAM_COUNT;
1196+
1197+
ZEND_FETCH_RESOURCE(conn, MCVE_CONN *, arg1, -1, "mcve connection", le_conn);
1198+
convert_to_long_ex(arg2);
1199+
1200+
array_init(return_value);
1201+
1202+
retval=M_ResponseKeys(conn, Z_LVAL_PP(arg2), &num_keys);
1203+
if (retval != NULL) {
1204+
for (i=0; i<num_keys; i++)
1205+
add_next_index_string(return_value, retval[i], 1);
1206+
M_FreeResponseKeys(retval, num_keys);
1207+
}
1208+
}
1209+
/* }}} */
1210+
#endif
1211+
11531212
/* {{{ proto string m_getuserparam(resource conn, long identifier, int key)
11541213
Get a user response parameter */
11551214
PHP_FUNCTION(m_getuserparam)

ext/mcve/php_mcve.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ PHP_FUNCTION(m_destroyconn);
5151
PHP_FUNCTION(m_setdropfile);
5252
PHP_FUNCTION(m_setip);
5353
PHP_FUNCTION(m_setssl);
54+
#if LIBMONETRA_VERSION >= 050000
55+
PHP_FUNCTION(m_setssl_cafile);
56+
PHP_FUNCTION(m_responsekeys);
57+
#endif
5458
PHP_FUNCTION(m_setssl_files);
5559
PHP_FUNCTION(m_setblocking);
5660
PHP_FUNCTION(m_settimeout);

0 commit comments

Comments
 (0)