mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2024-11-25 23:47:08 +00:00
Define and use macros for constants registration
This commit is contained in:
parent
d08552405a
commit
471a47f41e
1 changed files with 58 additions and 56 deletions
114
gnupg.c
114
gnupg.c
|
@ -411,12 +411,12 @@ zend_module_entry gnupg_module_entry = {
|
|||
ZEND_GET_MODULE(gnupg)
|
||||
#endif
|
||||
|
||||
/* {{{ class constants */
|
||||
static inline void gnupg_declare_long_constant(const char *const_name, long value TSRMLS_DC)
|
||||
{
|
||||
zend_declare_class_constant_long(gnupg_class_entry, (char*)const_name, strlen(const_name), value TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
#define PHP_GNUPG_SET_CLASS_CONST(_name, _value) \
|
||||
zend_declare_class_constant_long(gnupg_class_entry, \
|
||||
_name, sizeof(_name) - 1, _value TSRMLS_CC)
|
||||
|
||||
#define PHP_GNUPG_REG_CONST(_name, _value) \
|
||||
REGISTER_LONG_CONSTANT(_name, _value, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
|
@ -438,56 +438,58 @@ PHP_MINIT_FUNCTION(gnupg)
|
|||
if (SUCCESS != gnupg_keylistiterator_init()) {
|
||||
return FAILURE;
|
||||
}
|
||||
gnupg_declare_long_constant("SIG_MODE_NORMAL", GPGME_SIG_MODE_NORMAL TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIG_MODE_DETACH", GPGME_SIG_MODE_DETACH TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIG_MODE_CLEAR", GPGME_SIG_MODE_CLEAR TSRMLS_CC);
|
||||
gnupg_declare_long_constant("VALIDITY_UNKNOWN", GPGME_VALIDITY_UNKNOWN TSRMLS_CC);
|
||||
gnupg_declare_long_constant("VALIDITY_UNDEFINED", GPGME_VALIDITY_UNDEFINED TSRMLS_CC);
|
||||
gnupg_declare_long_constant("VALIDITY_NEVER", GPGME_VALIDITY_NEVER TSRMLS_CC);
|
||||
gnupg_declare_long_constant("VALIDITY_MARGINAL", GPGME_VALIDITY_MARGINAL TSRMLS_CC);
|
||||
gnupg_declare_long_constant("VALIDITY_FULL", GPGME_VALIDITY_FULL TSRMLS_CC);
|
||||
gnupg_declare_long_constant("VALIDITY_ULTIMATE", GPGME_VALIDITY_ULTIMATE TSRMLS_CC);
|
||||
gnupg_declare_long_constant("PROTOCOL_OpenPGP", GPGME_PROTOCOL_OpenPGP TSRMLS_CC);
|
||||
gnupg_declare_long_constant("PROTOCOL_CMS", GPGME_PROTOCOL_CMS TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_VALID", GPGME_SIGSUM_VALID TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_GREEN", GPGME_SIGSUM_GREEN TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_RED", GPGME_SIGSUM_RED TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_KEY_REVOKED", GPGME_SIGSUM_KEY_REVOKED TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_KEY_EXPIRED", GPGME_SIGSUM_KEY_EXPIRED TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_SIG_EXPIRED", GPGME_SIGSUM_SIG_EXPIRED TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_KEY_MISSING", GPGME_SIGSUM_KEY_MISSING TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_CRL_MISSING", GPGME_SIGSUM_CRL_MISSING TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_CRL_TOO_OLD", GPGME_SIGSUM_CRL_TOO_OLD TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_BAD_POLICY", GPGME_SIGSUM_BAD_POLICY TSRMLS_CC);
|
||||
gnupg_declare_long_constant("SIGSUM_SYS_ERROR", GPGME_SIGSUM_SYS_ERROR TSRMLS_CC);
|
||||
gnupg_declare_long_constant("ERROR_WARNING", 1 TSRMLS_CC);
|
||||
gnupg_declare_long_constant("ERROR_EXCEPTION", 2 TSRMLS_CC);
|
||||
gnupg_declare_long_constant("ERROR_SILENT", 3 TSRMLS_CC);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIG_MODE_NORMAL", GPGME_SIG_MODE_NORMAL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIG_MODE_DETACH", GPGME_SIG_MODE_DETACH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIG_MODE_CLEAR", GPGME_SIG_MODE_CLEAR, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_VALIDITY_UNKNOWN", GPGME_VALIDITY_UNKNOWN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_VALIDITY_UNDEFINED", GPGME_VALIDITY_UNDEFINED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_VALIDITY_NEVER", GPGME_VALIDITY_NEVER, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_VALIDITY_MARGINAL", GPGME_VALIDITY_MARGINAL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_VALIDITY_FULL", GPGME_VALIDITY_FULL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_VALIDITY_ULTIMATE", GPGME_VALIDITY_ULTIMATE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_PROTOCOL_OpenPGP", GPGME_PROTOCOL_OpenPGP, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_PROTOCOL_CMS", GPGME_PROTOCOL_CMS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_VALID", GPGME_SIGSUM_VALID, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_GREEN", GPGME_SIGSUM_GREEN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_RED", GPGME_SIGSUM_RED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_KEY_REVOKED", GPGME_SIGSUM_KEY_REVOKED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_KEY_EXPIRED", GPGME_SIGSUM_KEY_EXPIRED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_SIG_EXPIRED", GPGME_SIGSUM_SIG_EXPIRED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_KEY_MISSING", GPGME_SIGSUM_KEY_MISSING, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_CRL_MISSING", GPGME_SIGSUM_CRL_MISSING, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_CRL_TOO_OLD", GPGME_SIGSUM_CRL_TOO_OLD, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_BAD_POLICY", GPGME_SIGSUM_BAD_POLICY, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_SIGSUM_SYS_ERROR", GPGME_SIGSUM_SYS_ERROR, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_ERROR_WARNING", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_ERROR_EXCEPTION", 2, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("GNUPG_ERROR_SILENT", 3, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIG_MODE_NORMAL", GPGME_SIG_MODE_NORMAL);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIG_MODE_DETACH", GPGME_SIG_MODE_DETACH);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIG_MODE_CLEAR", GPGME_SIG_MODE_CLEAR);
|
||||
PHP_GNUPG_SET_CLASS_CONST("VALIDITY_UNKNOWN", GPGME_VALIDITY_UNKNOWN);
|
||||
PHP_GNUPG_SET_CLASS_CONST("VALIDITY_UNDEFINED", GPGME_VALIDITY_UNDEFINED);
|
||||
PHP_GNUPG_SET_CLASS_CONST("VALIDITY_NEVER", GPGME_VALIDITY_NEVER);
|
||||
PHP_GNUPG_SET_CLASS_CONST("VALIDITY_MARGINAL", GPGME_VALIDITY_MARGINAL);
|
||||
PHP_GNUPG_SET_CLASS_CONST("VALIDITY_FULL", GPGME_VALIDITY_FULL);
|
||||
PHP_GNUPG_SET_CLASS_CONST("VALIDITY_ULTIMATE", GPGME_VALIDITY_ULTIMATE);
|
||||
PHP_GNUPG_SET_CLASS_CONST("PROTOCOL_OpenPGP", GPGME_PROTOCOL_OpenPGP);
|
||||
PHP_GNUPG_SET_CLASS_CONST("PROTOCOL_CMS", GPGME_PROTOCOL_CMS);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_VALID", GPGME_SIGSUM_VALID);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_GREEN", GPGME_SIGSUM_GREEN);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_RED", GPGME_SIGSUM_RED);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_KEY_REVOKED", GPGME_SIGSUM_KEY_REVOKED);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_KEY_EXPIRED", GPGME_SIGSUM_KEY_EXPIRED);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_SIG_EXPIRED", GPGME_SIGSUM_SIG_EXPIRED);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_KEY_MISSING", GPGME_SIGSUM_KEY_MISSING);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_CRL_MISSING", GPGME_SIGSUM_CRL_MISSING);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_CRL_TOO_OLD", GPGME_SIGSUM_CRL_TOO_OLD);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_BAD_POLICY", GPGME_SIGSUM_BAD_POLICY);
|
||||
PHP_GNUPG_SET_CLASS_CONST("SIGSUM_SYS_ERROR", GPGME_SIGSUM_SYS_ERROR);
|
||||
PHP_GNUPG_SET_CLASS_CONST("ERROR_WARNING", 1);
|
||||
PHP_GNUPG_SET_CLASS_CONST("ERROR_EXCEPTION", 2);
|
||||
PHP_GNUPG_SET_CLASS_CONST("ERROR_SILENT", 3);
|
||||
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIG_MODE_NORMAL", GPGME_SIG_MODE_NORMAL);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIG_MODE_DETACH", GPGME_SIG_MODE_DETACH);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIG_MODE_CLEAR", GPGME_SIG_MODE_CLEAR);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_VALIDITY_UNKNOWN", GPGME_VALIDITY_UNKNOWN);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_VALIDITY_UNDEFINED", GPGME_VALIDITY_UNDEFINED);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_VALIDITY_NEVER", GPGME_VALIDITY_NEVER);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_VALIDITY_MARGINAL", GPGME_VALIDITY_MARGINAL);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_VALIDITY_FULL", GPGME_VALIDITY_FULL);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_VALIDITY_ULTIMATE", GPGME_VALIDITY_ULTIMATE);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_PROTOCOL_OpenPGP", GPGME_PROTOCOL_OpenPGP);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_PROTOCOL_CMS", GPGME_PROTOCOL_CMS);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_VALID", GPGME_SIGSUM_VALID);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_GREEN", GPGME_SIGSUM_GREEN);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_RED", GPGME_SIGSUM_RED);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_KEY_REVOKED", GPGME_SIGSUM_KEY_REVOKED);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_KEY_EXPIRED", GPGME_SIGSUM_KEY_EXPIRED);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_SIG_EXPIRED", GPGME_SIGSUM_SIG_EXPIRED);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_KEY_MISSING", GPGME_SIGSUM_KEY_MISSING);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_CRL_MISSING", GPGME_SIGSUM_CRL_MISSING);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_CRL_TOO_OLD", GPGME_SIGSUM_CRL_TOO_OLD);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_BAD_POLICY", GPGME_SIGSUM_BAD_POLICY);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_SIGSUM_SYS_ERROR", GPGME_SIGSUM_SYS_ERROR);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_ERROR_WARNING", 1);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_ERROR_EXCEPTION", 2);
|
||||
PHP_GNUPG_REG_CONST("GNUPG_ERROR_SILENT", 3);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue