summaryrefslogtreecommitdiffstats
path: root/php/environs
diff options
context:
space:
mode:
authorChristophe Nowicki <cnowicki@easter-eggs.com>2004-08-04 16:12:49 +0000
committerChristophe Nowicki <cnowicki@easter-eggs.com>2004-08-04 16:12:49 +0000
commitf3e2bfbb4f3243bc82caa57eb922ba414909ee37 (patch)
tree2f0b56c8a0e9f021a9bc068287fde47fe367079d /php/environs
parent59073ea1dde142312d2dec01e14f1607501e8cd9 (diff)
downloadlasso-f3e2bfbb4f3243bc82caa57eb922ba414909ee37.tar.gz
lasso-f3e2bfbb4f3243bc82caa57eb922ba414909ee37.tar.xz
lasso-f3e2bfbb4f3243bc82caa57eb922ba414909ee37.zip
first php binding import
Diffstat (limited to 'php/environs')
-rw-r--r--php/environs/lasso_federation.c58
-rw-r--r--php/environs/lasso_identity.c127
-rw-r--r--php/environs/lasso_login.c209
-rw-r--r--php/environs/lasso_profile.c261
-rw-r--r--php/environs/lasso_server.c187
-rw-r--r--php/environs/lasso_session.c33
6 files changed, 875 insertions, 0 deletions
diff --git a/php/environs/lasso_federation.c b/php/environs/lasso_federation.c
new file mode 100644
index 00000000..ba461f68
--- /dev/null
+++ b/php/environs/lasso_federation.c
@@ -0,0 +1,58 @@
+/*
+ * PHP lasso -- PHP bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_lasso.h"
+
+#include "lasso.h"
+
+/* {{{ proto resource lasso_federation_new(string remote_providerID) */
+PHP_FUNCTION(lasso_federation_new) {
+ LassoFederation *federation;
+ char *remote_providerID;
+ int remote_providerID_len;
+
+ int num_args;
+
+ zend_printf("DEBUG: lasso_federation_new\n");
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "s",
+ &remote_providerID, &remote_providerID_len) == FAILURE) {
+ return;
+ }
+
+
+ federation = lasso_federation_new(remote_providerID);
+
+ ZEND_REGISTER_RESOURCE(return_value, federation, le_lassofederation);
+}
+/* }}} */
diff --git a/php/environs/lasso_identity.c b/php/environs/lasso_identity.c
new file mode 100644
index 00000000..d61b924b
--- /dev/null
+++ b/php/environs/lasso_identity.c
@@ -0,0 +1,127 @@
+/*
+ * PHP lasso -- PHP bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_lasso.h"
+
+#include "lasso.h"
+
+/* {{{ proto resource lasso_identity_new() */
+PHP_FUNCTION(lasso_identity_new) {
+ LassoIdentity *identity;
+
+ zend_printf("DEBUG: lasso_identity_new\n");
+
+ identity = lasso_identity_new();
+
+ ZEND_REGISTER_RESOURCE(return_value, identity, le_lassoidentity);
+}
+/* }}} */
+
+/* {{{ proto lasso_identity_destroy(resource identity) */
+PHP_FUNCTION(lasso_identity_destroy) {
+
+ LassoIdentity *identity;
+ zval *param;
+
+ zend_printf("DEBUG: lasso_identity_destroy\n");
+
+ int num_args;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &param) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(identity, LassoIdentity *, &param, -1, le_lassoidentity_name, le_lassoidentity);
+
+ zend_printf("DEBUG: identity at 0x%p\n", identity);
+
+ lasso_identity_destroy(identity);
+
+ zend_list_delete(Z_RESVAL_PP(&param));
+}
+/* }}} */
+
+/* {{{ proto lasso_identity_dump(resource identity) */
+PHP_FUNCTION(lasso_identity_dump) {
+ LassoIdentity *identity;
+ zval *param;
+ char *identity_dump;
+
+ int num_args;
+
+ zend_printf("DEBUG: lasso_identity_dump\n");
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &param) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(identity, LassoIdentity *, &param, -1, le_lassoidentity_name, le_lassoidentity);
+
+ zend_printf("DEBUG: identity at 0x%p\n", identity);
+
+ identity_dump = lasso_identity_dump(identity);
+
+ RETURN_STRING(identity_dump, 1);
+
+}
+/* }}} */
+
+/* {{{ proto resource lasso_identity_get_next_providerID(resource identity) */
+PHP_FUNCTION(lasso_identity_get_next_providerid)
+{
+ LassoIdentity *identity;
+ char *providerID;
+ zval *param;
+
+ zend_printf("DEBUG: lasso_identity_get_next_providerID\n");
+
+ int num_args;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &param) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(identity, LassoIdentity *, &param, -1, le_lassoidentity_name, le_lassoidentity);
+
+ zend_printf("DEBUG: identity at 0x%p\n", identity);
+
+ providerID = (char *) lasso_identity_get_next_providerID(identity);
+ RETURN_STRING(providerID, 1);
+}
+/* }}} */
diff --git a/php/environs/lasso_login.c b/php/environs/lasso_login.c
new file mode 100644
index 00000000..cebaca3f
--- /dev/null
+++ b/php/environs/lasso_login.c
@@ -0,0 +1,209 @@
+/*
+ * PHP lasso -- PHP bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_lasso.h"
+
+#include "lasso.h"
+
+/* {{{ proto resource lasso_login_new(resource server) */
+PHP_FUNCTION(lasso_login_new) {
+
+ LassoLogin *login;
+ LassoServer *server;
+ zval *param;
+
+ zend_printf("DEBUG: lasso_login_new\n");
+
+ int num_args;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &param) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(server, LassoServer *, &param, -1, le_lassoserver_name, le_lassoserver);
+
+ zend_printf("DEBUG: server at 0x%p\n", server);
+
+ login = lasso_login_new(server);
+
+ ZEND_REGISTER_RESOURCE(return_value, login, le_lassologin);
+}
+/* }}} */
+
+/* {{{ proto resource lasso_login_init_authn_request(resource login, string metadata) */
+PHP_FUNCTION(lasso_login_init_authn_request) {
+ LassoLogin *login;
+ zval *param;
+ char *meta;
+ int meta_len;
+
+ zend_printf("DEBUG: lasso_login_new\n");
+
+ int num_args;
+ int ret;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 2)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "zs", &param,
+ &meta, &meta_len) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(login, LassoLogin *, &param, -1,
+ le_lassologin_name, le_lassologin);
+
+ zend_printf("DEBUG: login at 0x%p\n", login);
+
+ ret = lasso_login_init_authn_request(login, meta);
+
+ (ret) ? (RETURN_FALSE) : (RETURN_TRUE);
+}
+/* }}} */
+
+
+
+/* {{{ proto lasso_login_destroy(resource login) */
+PHP_FUNCTION(lasso_login_destroy) {
+
+ LassoLogin *login;
+ zval *param;
+
+ zend_printf("DEBUG: lasso_login_destroy\n");
+
+ int num_args;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &param) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(login, LassoLogin *, &param, -1, le_lassologin_name, le_lassologin);
+
+ zend_printf("DEBUG: login at 0x%p\n", login);
+
+ lasso_login_destroy(login);
+
+ zend_list_delete(Z_RESVAL_PP(&param));
+}
+/* }}} */
+
+/* {{{ proto resource lasso_login_new_from_dump(resource server, string dump) */
+PHP_FUNCTION(lasso_login_new_from_dump) {
+
+ LassoServer *server;
+ LassoLogin *login;
+ char *dump;
+ int dump_len;
+
+ zend_printf("DEBUG: lasso_login_new_from_dump\n");
+
+ zval *parm_server, *parm_user;
+
+ int num_args;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 2)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "zs", &parm_server,
+ &dump, &dump_len) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(server, LassoServer *, &parm_server, -1, le_lassoserver_name, le_lassoserver);
+
+ zend_printf("DEBUG: server at 0x%p\n", server);
+
+
+ login = lasso_login_new_from_dump(server, dump);
+
+ ZEND_REGISTER_RESOURCE(return_value, login, le_lassologin);
+}
+/* }}} */
+
+
+/* {{{ proto lasso_login_build_request_msg(resource login) */
+PHP_FUNCTION(lasso_login_build_request_msg) {
+
+ LassoLogin *login;
+
+ zend_printf("DEBUG: lasso_login_build_request_msg\n");
+
+ zval *parm;
+
+ int num_args;
+ int ret;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin);
+
+ zend_printf("DEBUG: login at 0x%p\n", login);
+
+ lasso_login_build_request_msg(login);
+}
+/* }}} */
+
+/* {{{ proto lasso_login_build_authn_request_msg(resource login) */
+PHP_FUNCTION(lasso_login_build_authn_request_msg) {
+
+ LassoLogin *login;
+
+ zend_printf("DEBUG: lasso_login_build_authn_request_msg\n");
+
+ zval *parm;
+
+ int num_args;
+ int ret;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin);
+
+ zend_printf("DEBUG: login at 0x%p\n", login);
+
+ lasso_login_build_authn_request_msg(login);
+}
+/* }}} */
diff --git a/php/environs/lasso_profile.c b/php/environs/lasso_profile.c
new file mode 100644
index 00000000..9f835cd8
--- /dev/null
+++ b/php/environs/lasso_profile.c
@@ -0,0 +1,261 @@
+/*
+ *
+ * PHP lasso -- PHP bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_lasso.h"
+
+#include "lasso.h"
+
+/* {{{ proto lasso_profile_new(resource server, resource identity, resource session) */
+PHP_FUNCTION(lasso_profile_new)
+{
+ LassoServer *server;
+ LassoIdentity *identity;
+ LassoSession *session;
+ LassoProfile *ctx;
+
+ zval *parm_server, *parm_identity, *parm_session;
+
+ zend_printf("DEBUG: lasso_profile_new\n");
+
+ int num_args;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 3)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "zzz",
+ &parm_server, &parm_identity, &parm_session) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(server, LassoServer *, &parm_server, -1, le_lassoserver_name, le_lassoserver);
+
+ zend_printf("DEBUG: server at 0x%p\n", server);
+
+
+ ZEND_FETCH_RESOURCE(identity, LassoIdentity *, &parm_identity, -1, le_lassoidentity_name, le_lassoidentity);
+
+ zend_printf("DEBUG: identity at 0x%p\n", identity);
+
+ ZEND_FETCH_RESOURCE(session, LassoSession *, &parm_session, -1, le_lassosession_name, le_lassosession);
+
+ zend_printf("DEBUG: session at 0x%p\n", session);
+
+ ctx = lasso_profile_new(server, identity, session);
+
+ ZEND_REGISTER_RESOURCE(return_value, ctx, le_lassoprofile);
+
+}
+/* }}} */
+
+/* {{{ proto lasso_profile_dump() */
+PHP_FUNCTION(lasso_profile_dump)
+{
+ zend_printf("DEBUG: lasso_profile_dump\n");
+}
+/* }}} */
+
+/* {{{ proto lasso_profile_set_remote_providerid() */
+PHP_FUNCTION(lasso_profile_set_remote_providerid)
+{
+ zend_printf("DEBUG: lasso_profile_set_remote_providerid\n");
+}
+/* }}} */
+
+/* {{{ proto lasso_profile_set_response_status() */
+PHP_FUNCTION(lasso_profile_set_response_status)
+{
+ zend_printf("DEBUG: lasso_profile_set_response_status\n");
+}
+/* }}} */
+
+/* {{{ proto lasso_profile_user_from_dump() */
+PHP_FUNCTION(lasso_profile_user_from_dump)
+{
+ zend_printf("DEBUG: lasso_profile_user_from_dump\n");
+}
+/* }}} */
+
+/* {{{ proto lasso_profile_get_request_type_from_soap_msg() */
+PHP_FUNCTION(lasso_profile_get_request_type_from_soap_msg)
+{
+ zend_printf("DEBUG: lasso_profile_get_request_type_from_soap_msg\n");
+}
+/* }}} */
+
+/* {{{ proto resource lasso_cast_to_profile(resource login) */
+PHP_FUNCTION(lasso_cast_to_profile)
+{
+ LassoProfile *ctx;
+ LassoLogin *login;
+
+ zend_printf("DEBUG: lasso_cast_to_profile\n");
+
+ zval *parm;
+
+ int num_args;
+ int ret;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin);
+
+ zend_printf("DEBUG: login at 0x%p\n", login);
+
+ ctx = LASSO_PROFILE(login);
+
+ ZEND_REGISTER_RESOURCE(return_value, ctx, le_lassoprofile);
+}
+/* }}} */
+
+/* {{{ proto resource lasso_profile_get_request(resource ctx) */
+PHP_FUNCTION(lasso_profile_get_request) {
+ LassoProfile *ctx;
+ LassoNode *node;
+
+ zend_printf("DEBUG: lasso_profile_get_request\n");
+
+ zval *parm;
+
+ int num_args;
+ int ret;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile);
+
+ zend_printf("DEBUG: profile at 0x%p\n", ctx);
+
+ zend_printf("DEBUG: ctx->request at 0x%p\n", ctx->request);
+ node = ctx->request;
+
+ ZEND_REGISTER_RESOURCE(return_value, node, le_lassonode);
+}
+
+/* {{{ proto string lasso_profile_get_msg_url(resource ctx) */
+PHP_FUNCTION(lasso_profile_get_msg_url) {
+ LassoProfile *ctx;
+ LassoNode *node;
+
+ zend_printf("DEBUG: lasso_profile_get_msg_url\n");
+
+ zval *parm;
+
+ int num_args;
+ int ret;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile);
+
+ zend_printf("DEBUG: profile at 0x%p\n", ctx);
+
+ zend_printf("DEBUG: ctx->msg_url at 0x%p\n", ctx->msg_url);
+
+ if (ctx->msg_url)
+ RETURN_STRING(ctx->msg_url, 1);
+}
+
+/* }}} */
+
+/* {{{ proto string lasso_profile_get_msg_body(resource ctx) */
+PHP_FUNCTION(lasso_profile_get_msg_body) {
+ LassoProfile *ctx;
+ LassoNode *node;
+
+ zend_printf("DEBUG: lasso_profile_get_msg_body\n");
+
+ zval *parm;
+
+ int num_args;
+ int ret;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile);
+
+ zend_printf("DEBUG: profile at 0x%p\n", ctx);
+
+ zend_printf("DEBUG: ctx->msg_body at 0x%p\n", ctx->msg_body);
+
+ if (ctx->msg_body)
+ RETURN_STRING(ctx->msg_body, 1);
+}
+/* }}} */
+
+/* {{{ proto string lasso_profile_get_msg_relaystate(resource ctx) */
+PHP_FUNCTION(lasso_profile_get_msg_relaystate) {
+ LassoProfile *ctx;
+ LassoNode *node;
+
+ zend_printf("DEBUG: lasso_profile_get_msg_relaystate\n");
+
+ zval *parm;
+
+ int num_args;
+ int ret;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile);
+
+ zend_printf("DEBUG: profile at 0x%p\n", ctx);
+
+ zend_printf("DEBUG: ctx->msg_relayState at 0x%p\n", ctx->msg_relayState);
+
+ if (ctx->msg_relayState)
+ RETURN_STRING(ctx->msg_relayState, 1);
+}
+/* }}} */
diff --git a/php/environs/lasso_server.c b/php/environs/lasso_server.c
new file mode 100644
index 00000000..2ec37d48
--- /dev/null
+++ b/php/environs/lasso_server.c
@@ -0,0 +1,187 @@
+/*
+ * PHP lasso -- PHP bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_lasso.h"
+
+#include "lasso.h"
+
+
+/* {{{ proto lasso_server_new(string sp, string rsapub, string rsakey,
+ * string rsacert, long signaturemethod) */
+PHP_FUNCTION(lasso_server_new) {
+
+ LassoServer *server;
+
+ char *sp;
+ int sp_len;
+ char *rsapub;
+ int rsapub_len;
+ char *rsakey;
+ int rsakey_len;
+ char *rsacert;
+ int rsacert_len;
+ long signaturemethod;
+
+ int num_args;
+
+ zend_printf("DEBUG: lasso_server_new\n");
+
+ if ((num_args = ZEND_NUM_ARGS()) != 5)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "ssssl",
+ &sp, &sp_len, &rsapub, &rsapub_len,
+ &rsakey, &rsakey_len, &rsacert, &rsacert_len,
+ &signaturemethod) == FAILURE) {
+ return;
+ }
+
+ server = lasso_server_new(sp, rsapub, rsakey, rsacert, signaturemethod);
+
+ zend_printf("DEBUG: server at 0x%p\n", server);
+
+ ZEND_REGISTER_RESOURCE(return_value, server, le_lassoserver);
+}
+/* }}} */
+
+/* {{{ proto lasso_server_add_provider(resource server, string idp, string a, string b) */
+PHP_FUNCTION(lasso_server_add_provider) {
+
+ LassoServer *server;
+ zval *param;
+ char *idp;
+ int idp_len;
+ char *a;
+ int a_len;
+ char *b;
+ int b_len;
+
+ zend_printf("DEBUG: lasso_server_add_provider\n");
+
+ int num_args;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 4)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "zsss", &param,
+ &idp, &idp_len, &a, &a_len, &b, &b_len) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(server, LassoServer *, &param, -1, le_lassoserver_name, le_lassoserver);
+
+ zend_printf("DEBUG: server at 0x%p\n", server);
+
+ lasso_server_add_provider(server, idp, a, b);
+
+
+}
+/* }}} */
+
+/* {{{ proto string lasso_server_new(resource server) */
+PHP_FUNCTION(lasso_server_dump) {
+
+ LassoServer *server;
+ zval *param;
+ char *server_dump;
+
+ int num_args;
+
+ zend_printf("DEBUG: lasso_server_dump\n");
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &param) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(server, LassoServer *, &param, -1, le_lassoserver_name, le_lassoserver);
+
+ zend_printf("DEBUG: server at 0x%p\n", server);
+
+ server_dump = lasso_server_dump(server);
+
+ RETURN_STRING(server_dump, 1);
+}
+/* }}} */
+
+/* {{{ proto lasso_server_destroy(resource server) */
+PHP_FUNCTION(lasso_server_destroy) {
+
+ LassoServer *server;
+ zval *param;
+
+ zend_printf("DEBUG: lasso_server_destroy\n");
+
+ int num_args;
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "z", &param) == FAILURE) {
+ return;
+ }
+
+ ZEND_FETCH_RESOURCE(server, LassoServer *, &param, -1, le_lassoserver_name, le_lassoserver);
+
+ zend_printf("DEBUG: server at 0x%p\n", server);
+
+ lasso_server_destroy(server);
+
+ zend_list_delete(Z_RESVAL_PP(&param));
+}
+/* }}} */
+
+/* {{{ proto resource lasso_server_new_from_dump(string dump) */
+PHP_FUNCTION(lasso_server_new_from_dump) {
+
+ LassoServer *server;
+ char *dump;
+ int dump_len;
+ int num_args;
+
+ zend_printf("DEBUG: lasso_server_new_from_dump\n");
+
+ if ((num_args = ZEND_NUM_ARGS()) != 1)
+ WRONG_PARAM_COUNT
+
+ if (zend_parse_parameters(num_args TSRMLS_CC, "s",
+ &dump, &dump_len) == FAILURE) {
+ return;
+ }
+
+ server = lasso_server_new_from_dump(dump);
+
+ ZEND_REGISTER_RESOURCE(return_value, server, le_lassoserver);
+}
+/* }}} */
+
+
diff --git a/php/environs/lasso_session.c b/php/environs/lasso_session.c
new file mode 100644
index 00000000..38787897
--- /dev/null
+++ b/php/environs/lasso_session.c
@@ -0,0 +1,33 @@
+/*
+ * PHP lasso -- PHP bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_lasso.h"
+
+#include "lasso.h"