php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53594 php-snmp rewrite
Submitted: 2010-12-22 19:49 UTC Modified: 2011-06-12 15:06 UTC
From: lytboris at gmail dot com Assigned: lytboris
Status: Closed Package: SNMP related
PHP Version: 5.4.0 OS: irrelevant
Private report: No CVE-ID:
 [2010-12-22 19:49 UTC] lytboris at gmail dot com
Description:
------------
The main new feature is multi OID get/getnext/set commands. Another
one - strong and simple return value logic: if command fails, return
nothing but FALSE. No empty strings, no SNMP error messages as values,
etc. Just FALSE.

Another effort was to cover source code with unit tests. Results: 100%
functions (-zm_info_snmp, but it is not actually snmp function), 94%
source code lines.


Patches

patch-ext-snmp-tests (last revision 2011-01-05 18:00 UTC) by lytboris at gmail dot com)
patch-ext-snmp-src (last revision 2011-01-05 17:59 UTC) by lytboris at gmail dot com)
patch-ext-snmp-trunk (last revision 2010-12-23 06:18 UTC) by lytboris at gmail dot com)
php-ext-snmp-source (last revision 2010-12-22 18:52 UTC) by lytboris at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-22 20:05 UTC] lytboris at gmail dot com
Patch was created for 5.3 branch and then adopted to be used in 5.2 branch.
 [2010-12-22 22:07 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-12-22 22:07 UTC] pajoye@php.net
Thanks for this great patch :)

However 5.3 is in maintenance mode (and 5.2 is dead btw), please provide a patch against trunk instead.
 [2010-12-23 07:20 UTC] lytboris at gmail dot com
I know about version lifecycle. But Cacti 087 (Larry mentioned it) runs on 5.2 branch.

Here you are patch for trunk. There is no difference between 5.3 and trunk for now so this patch may be appied to 5.3 branch too.
 [2010-12-23 09:03 UTC] lytboris at gmail dot com
This patch covers bugs
#44193
#45893
#51336
 [2010-12-29 17:56 UTC] lytboris at gmail dot com
Reuploaded patches (to be allied against trunk)

+ session-like workflow:
   $session = snmp_session_open(...);
   $result = snmpget($oid);
   ...
   snmp_session_close($session);
+ support for SNMPv3 contextName & contextEngineID properties in new syntax style

+ tests for new features

snmp(real)?{get,walk,set} functions are now polymorphic - they accepts both old (SNMPv1) arguments and new session-like. All version protocols are handled by the since protocol version is now set using snmp_session_open.
 [2010-12-29 18:02 UTC] pajoye@php.net
-PHP Version: 5.2.16 +PHP Version: trunk
 [2010-12-29 18:02 UTC] pajoye@php.net
What do you think about keeping the old APIs as it is, froze it and add a much nicer and flexible OO one instead? For any new improvements? That's what I did for zip and brings much more rooms for new stuff while reducing the maintenance work load.
 [2010-12-29 18:17 UTC] lytboris at gmail dot com
You have guessed my next target - OO interface. :-)

If you apply new patch you'll see there is very small piece of code making SNMPv1 functions be polymorphic - dozen of lines, not more.
My thoughts are that old API should be deprecated sometime, so there will be session-only support: both OO and non-OO.
 [2010-12-29 18:21 UTC] pajoye@php.net
It is much easier and cleaner to simply go straight to OO then, without procedural API, and keep the old for legacy apps.
 [2010-12-29 18:22 UTC] pajoye@php.net
No need to deprecate it, but tell anyone asking for a feature for the legacy API to migrate to the new shiny one :)
 [2010-12-31 19:52 UTC] lytboris at gmail dot com
OK. There will be full-featured OO API without adding new functions into legacy API (e.g. no session support). Though old functions will be provided with two features (in sake of code cimplicity):
 * multi-OID
 * strict output typing
 [2011-01-05 19:04 UTC] lytboris at gmail dot com
Introducing full-featured OO API.
It covers bug #46065 also.

Old API *_set_* functions actually sets `global' preferences, they are used when creating new object instance. $object->... properties are used object(session)-wise.
 [2011-01-31 12:41 UTC] lytboris@php.net
Automatic comment from SVN on behalf of lytboris
Revision: http://svn.php.net/viewvc/?view=revision&revision=307877
Log: Improved SNMP extension. FR #53594
 [2011-01-31 12:55 UTC] lytboris@php.net
-Status: Feedback +Status: To be documented -Assigned To: +Assigned To: lytboris
 [2011-01-31 12:55 UTC] lytboris@php.net
OO API should be documented from scratch as most of old API functions
 [2011-06-12 15:06 UTC] lytboris@php.net
-Status: To be documented +Status: Closed -PHP Version: trunk +PHP Version: 5.4.0
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 05:03:19 2014 UTC