File: php_spplus.c

package info (click to toggle)
spplus 1.0-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,060 kB
  • ctags: 250
  • sloc: sh: 8,331; ansic: 2,004; makefile: 64; php: 50; awk: 43
file content (152 lines) | stat: -rw-r--r-- 4,808 bytes parent folder | download
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
  +----------------------------------------------------------------------+
  | PHP Version 4                                                        |
  +----------------------------------------------------------------------+
  | Copyright (c) 1997-2002 The PHP Group                                |
  +----------------------------------------------------------------------+
  | This source file is subject to version 2.02 of the PHP license,      |
  | that is bundled with this package in the file LICENSE, and is        |
  | available at through the world-wide-web at                           |
  | http://www.php.net/license/2_02.txt.                                 |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to          |
  | license@php.net so we can mail you a copy immediately.               |
  +----------------------------------------------------------------------+
  | Author: EPRO <contact@epro.fr> CHAILLAN Nicolas <nicos@php.net>                             |
  +----------------------------------------------------------------------+

  $Id: php_spplus.c,v 1.2 2004/01/19 09:50:55 vied Exp $
*/

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

#include "php.h"
#include "php_ini.h"

#include "spp_signe.h"

ZEND_MINFO_FUNCTION(php_spplus);
ZEND_FUNCTION(calcul_hmac);
ZEND_FUNCTION(nthmac);
ZEND_FUNCTION(signeurlpaiement);
ZEND_FUNCTION(calculhmac);

/* {{{ spplus_functions[] */
zend_function_entry php_spplus_functions[] = {
	ZEND_FE(calcul_hmac,	NULL)
	ZEND_FE(nthmac,	NULL)
	ZEND_FE(signeurlpaiement,	NULL)
	ZEND_FE(calculhmac,	NULL)
	{NULL, NULL, NULL}	
};
/* }}} */

/* {{{ spplus_module_entry */
zend_module_entry php_spplus_module_entry={
	STANDARD_MODULE_HEADER,
	"SPPLUS",
	php_spplus_functions,
	NULL,
	NULL,
	NULL,
	NULL,
	ZEND_MINFO(php_spplus),
	"3.0",
	STANDARD_MODULE_PROPERTIES
};
/* }}} */

#if COMPILE_DL_PHP_SPPLUS
ZEND_GET_MODULE(php_spplus)
#endif

/* {{{ ZEND_MINFO_FUNCTION
 */
ZEND_MINFO_FUNCTION(php_spplus)
{
	php_info_print_table_start();
	php_info_print_table_row(2, "SPPLUS functions", "enabled ");
	php_info_print_table_end();

}
/* }}} */

/* {{{ proto string calcul_hmac(string clent , string codesiret , string montant , string reference , string validite , string taxe , string devise , string langue) Getting a calcul_hmac key. */
ZEND_FUNCTION(calcul_hmac)
{
	char   *iclent, *icodesiret, *imontant, *ireference, *ivalidite, *itaxe, *idevise, *ilangue;
	int   iclent_len, icodesiret_len, imontant_len, ireference_len, ivalidite_len, itaxe_len, idevise_len, ilangue_len;
	char   *result;
	
	if (zend_parse_parameters(8, "ssssssss", &iclent, &iclent_len, &icodesiret, &icodesiret_len, &ireference, &ireference_len, &ilangue, &ilangue_len, &idevise, &idevise_len, &imontant, &imontant_len, &itaxe, &itaxe_len, &ivalidite, &ivalidite_len) == FAILURE) {
		WRONG_PARAM_COUNT;
	}

	result = sp_calcul_hmac(iclent, icodesiret, ireference, ilangue, idevise, imontant, itaxe, ivalidite);

	RETURN_STRING(result, 1);
}
/* }}} */

/* {{{ proto string nthmac(string clent , string data) Getting a nthmac key. Note that data is: $data = "$codesiret$reference$langue$devise$montant$taxe$validite"; */
ZEND_FUNCTION(nthmac)
{
	char   *iclent, *idata;
	int   iclent_len, idata_len;
	char   *result;

	if (zend_parse_parameters(2, "ss", &iclent, &iclent_len, &idata, &idata_len) == FAILURE) {
		WRONG_PARAM_COUNT;
	}

	result = sp_NTHMAC(iclent, idata);

	RETURN_STRING(result, 1);
}
/* }}} */

/* {{{ proto string signerurlpaiement(string clent , string data) Getting a url for the paiement redirection. Note that data is: $data = "$codesiret$reference$langue$devise$montant$taxe$validite"; */
ZEND_FUNCTION(signeurlpaiement)
{
	char   *iclent, *idata;
	int   iclent_len, idata_len;
	char   *result;

	if (zend_parse_parameters(2, "ss", &iclent, &iclent_len, &idata, &idata_len) == FAILURE) {
		WRONG_PARAM_COUNT;
	}

	result = sp_signeURLPaiement(iclent, idata);

	RETURN_STRING(result, 1);
}
/* }}} */

/* {{{ proto string calculhmac(string clent , string data) Getting a calculhmac key. Note that data is: $data = "$codesiret$reference$langue$devise$montant$taxe$validite"; */
ZEND_FUNCTION(calculhmac)
{
	char   *iclent, *idata;
	int   iclent_len, idata_len;
	char   *result;

	if (zend_parse_parameters(2, "ss", &iclent, &iclent_len, &idata, &idata_len) == FAILURE) {
		WRONG_PARAM_COUNT;
	}

	result = sp_CalculHmac(iclent, idata);

	RETURN_STRING(result, 1);

}
/* }}} */

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 * vim600: noet sw=4 ts=4 fdm=marker
 * vim<600: noet sw=4 ts=4
 */