summaryrefslogtreecommitdiffstats
path: root/php/environs/lasso_logout.c
blob: 37e7dabf8227f125483ef1e2719f80dd89aa4efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*  
 * 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
 */

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "../php_lasso.h"

#ifdef HAVE_CONFIG_H
#include "lasso_config.h"
#endif

#include "lasso.h"

/* {{{ proto resource lasso_logout_new(resource server, long provider_type) */
PHP_FUNCTION(lasso_logout_new) {

  	LassoLogout *logout;
	LassoServer  *server;
	zval *param;
	long provider_type;

	int num_args;

	if ((num_args = ZEND_NUM_ARGS()) != 2) 
		WRONG_PARAM_COUNT

	if (zend_parse_parameters(num_args TSRMLS_CC, "zl", 
		  &param, &provider_type) == FAILURE) {
		return;
	}

	ZEND_FETCH_RESOURCE(server, LassoServer *, &param, -1, le_lassoserver_name, le_lassoserver);
	
  	logout = lasso_logout_new(server, provider_type);

	ZEND_REGISTER_RESOURCE(return_value, logout, le_lassologout);
}
/* }}} */

/* {{{ proto resource lasso_logout_init_request(resource logout, string remote_providerid) */
PHP_FUNCTION(lasso_logout_init_request) {

  	LassoLogout *logout;
	char *remote_providerid;
	int remote_providerid_len;
	zval *param;
	long provider_type;

	int num_args;

	if ((num_args = ZEND_NUM_ARGS()) != 1) 
		WRONG_PARAM_COUNT

	if (zend_parse_parameters(num_args TSRMLS_CC, "zs", 
		  &param, &remote_providerid, &remote_providerid_len) == FAILURE) {
		return;
	}

	ZEND_FETCH_RESOURCE(logout, LassoLogout *, &param, -1, le_lassologout_name, le_lassologout);
	
  	lasso_logout_init_request(logout, remote_providerid);
}
/* }}} */

/* {{{ proto resource lasso_logout_build_request_msg(resource logout) */
PHP_FUNCTION(lasso_logout_build_request_msg) {

  	LassoLogout *logout;
	zval *param;
	long provider_type;

	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(logout, LassoLogout *, &param, -1, le_lassologout_name, le_lassologout);
	
  	lasso_logout_build_request_msg(logout);
}
/* }}} */