Perl code patch contributed by "Kurt J. Pires" <kjpires@iat.com>
[openssl.git] / perl / typemap
1
2 datum                   T_DATUM
3 EVP_MD_CTX *            T_MD_CTX
4 EVP_CIPHER_CTX *        T_CIPHER_CTX
5 BIGNUM *                T_BIGNUM
6 SSL_METHOD *            T_SSL_METHOD
7 SSL_CTX *               T_SSL_CTX
8 SSL_CIPHER *            T_SSL_CIPHER
9 SSL *                   T_SSL
10 BIO *                   T_BIO
11 X509 *                  T_X509
12
13 INPUT
14 T_DATUM
15         $var.dptr=SvPV($arg,$var.dsize);
16 T_MD_CTX
17         if (sv_derived_from($arg, \"OpenSSL::MD\")) {
18                 IV tmp = SvIV((SV*)SvRV($arg));
19                 $var = (EVP_MD_CTX *) tmp;
20                 }
21         else
22                 croak(\"$var is not of type OpenSSL::MD\")
23 T_CIPHER_CTX
24         if (sv_derived_from($arg, \"OpenSSL::Cipher\")) {
25                 IV tmp = SvIV((SV*)SvRV($arg));
26                 $var = (EVP_CIPHER_CTX *) tmp;
27                 }
28         else
29                 croak(\"$var is not of type OpenSSL::Cipher\")
30 T_BIGNUM
31         sv_to_BIGNUM(&($var),$arg,\"$var is not of type OpenSSL::MD, int or string\")
32 T_SSL_METHOD
33         if (sv_derived_from($arg, \"OpenSSL::SSL::METHOD\")) {
34                 IV tmp = SvIV((SV*)SvRV($arg));
35                 $var = (SSL_METHOD *) tmp;
36                 }
37         else
38                 croak(\"$var is not of type OpenSSL::SSL::METHOD\")
39 T_SSL_CTX
40         if (sv_derived_from($arg, \"OpenSSL::SSL::CTX\")) {
41                 IV tmp = SvIV((SV*)SvRV($arg));
42                 $var = (SSL_CTX *) tmp;
43                 }
44         else
45                 croak(\"$var is not of type OpenSSL::SSL::CTX\")
46 T_SSL_CIPHER
47         if (sv_derived_from($arg, \"OpenSSL::SSL::CIPHER\")) {
48                 IV tmp = SvIV((SV*)SvRV($arg));
49                 $var = (SSL_CIPHER *) tmp;
50                 }
51         else
52                 croak(\"$var is not of type OpenSSL::SSL::CIPHER\")
53 T_SSL
54         if (sv_derived_from($arg, \"OpenSSL::SSL\")) {
55                 IV tmp = SvIV((SV*)SvRV($arg));
56                 $var = (SSL *) tmp;
57                 }
58         else
59                 croak(\"$var is not of type OpenSSL::SSL\")
60 T_BIO
61         if (sv_derived_from($arg, \"OpenSSL::BIO\")) {
62                 IV tmp = SvIV((SV*)SvRV($arg));
63                 $var = (BIO *) tmp;
64                 }
65         else
66                 croak(\"$var is not of type OpenSSL::BIO\")
67 T_X509
68         if (sv_derived_from($arg, \"OpenSSL::X509\")) {
69                 IV tmp = SvIV((SV*)SvRV($arg));
70                 $var = (X509 *) tmp;
71                 }
72         else
73                 croak(\"$var is not of type OpenSSL::X509\")
74 OUTPUT
75 T_DATUM
76         sv_setpvn($arg,$var.dptr,$var.dsize);
77 T_MD_CTX
78         sv_setref_pv($arg, \"OpenSSL::MD\", (void*)$var);
79 T_CIPHER_CTX
80         sv_setref_pv($arg, \"OpenSSL::Cipher\", (void*)$var);
81 T_BIGNUM
82         sv_setref_pv($arg, \"OpenSSL::BN\", (void*)$var);
83 T_SSL_METHOD
84         sv_setref_pv($arg, \"OpenSSL::SSL::METHOD\", (void*)$var);
85 T_SSL_CTX
86         sv_setref_pv($arg, \"OpenSSL::SSL::CTX\", (void*)$var);
87 T_SSL_CIPHER
88         sv_setref_pv($arg, \"OpenSSL::SSL::CIPHER\", (void*)$var);
89 T_SSL
90         sv_setref_pv($arg, \"OpenSSL::SSL\", (void*)$var);
91 T_BIO
92         sv_setref_pv($arg, \"OpenSSL::BIO\", (void*)$var);
93 T_X509
94         sv_setref_pv($arg, \"OpenSSL::X509\", (void*)$var);
95
96