diff options
author | Kalle Sommer Nielsen <kalle@php.net> | 2008-11-07 11:05:24 +0000 |
---|---|---|
committer | Kalle Sommer Nielsen <kalle@php.net> | 2008-11-07 11:05:24 +0000 |
commit | 2b0df36f42d51585fbaa53e06b1f05e95ff155ed (patch) | |
tree | 97c59998632f8a1191ac71d960e5abb2468e99cf /ext/snmp | |
parent | 57b9a6449a46614b07e9abc2809b458890c779d5 (diff) | |
download | php-git-2b0df36f42d51585fbaa53e06b1f05e95ff155ed.tar.gz |
MFH: New parameter parsing API
Diffstat (limited to 'ext/snmp')
-rw-r--r-- | ext/snmp/winsnmp.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/ext/snmp/winsnmp.c b/ext/snmp/winsnmp.c index 331a116e74..508dc06cd5 100644 --- a/ext/snmp/winsnmp.c +++ b/ext/snmp/winsnmp.c @@ -57,34 +57,32 @@ DLEXPORT zend_module_entry *get_module() { return &snmp_module_entry; } /* {{{ _php_snmp */ -void _php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) { - zval *a1, *a2, *a3; - INT operation; - LPSTR agent; - LPSTR community; - RFC1157VarBindList variableBindings; - LPSNMP_MGR_SESSION session; - - INT timeout = TIMEOUT; - INT retries = RETRIES; - - BYTE requestType; - AsnInteger errorStatus; - AsnInteger errorIndex; - AsnObjectIdentifier oid; - char *chkPtr = NULL; - - if (zend_get_parameters_ex(3, &a1, &a2, &a3) == FAILURE) { - WRONG_PARAM_COUNT; +void _php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) +{ + INT operation; + + RFC1157VarBindList variableBindings; + LPSNMP_MGR_SESSION session; + + char *agent, *community, *object_id; + int agent_len, community_len, object_id_len; + + INT timeout = TIMEOUT; + INT retries = RETRIES; + + BYTE requestType; + AsnInteger errorStatus; + AsnInteger errorIndex; + AsnObjectIdentifier oid; + + char *chkPtr = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &agent, &agent_len, &community, &community_len, &object_id, &object_id_len) == FAILURE) { + return; } - convert_to_string_ex(a1); - convert_to_string_ex(a2); - convert_to_string_ex(a3); - - agent=Z_STRVAL_PP(a1); - community=Z_STRVAL_PP(a2); - operation=st; - SnmpMgrStrToOid(Z_STRVAL_PP(a3), &oid); + + operation = st; + SnmpMgrStrToOid(object_id, &oid); /* I've limited this to only one oid, but we can create a |