Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10382 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85096 invoked by uid 1010); 10 Jun 2004 12:06:15 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85070 invoked from network); 10 Jun 2004 12:06:15 -0000 Received: from unknown (HELO iggypop1.siwnet.net) (81.216.65.11) by pb1.pair.com with SMTP; 10 Jun 2004 12:06:15 -0000 Received: from localhost (localhost.siwnet.net [127.0.0.1]) by iggypop1.siwnet.net (Postfix) with ESMTP id E543C7A4F0 for ; Thu, 10 Jun 2004 14:05:29 +0200 (CEST) Received: from iggypop1.siwnet.net ([127.0.0.1]) by localhost (iggypop1.siwnet.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 83307-01 for ; Thu, 10 Jun 2004 14:05:29 +0200 (CEST) Received: from [172.26.14.128] (ahfw1-t4-sto.se.sn.net [195.54.133.58]) by iggypop1.siwnet.net (Postfix) with ESMTP id 7C9797A487 for ; Thu, 10 Jun 2004 14:05:29 +0200 (CEST) To: Date: Thu, 10 Jun 2004 14:03:59 +0200 User-Agent: KMail/1.6.1 MIME-Version: 1.0 Content-Disposition: inline Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Message-ID: <200406101404.00080.anders.x.karlsson@songnetworks.se> X-Virus-Scanned: by amavisd-new at iggypop1.siwnet.net Subject: Adding optional argument to snmp_get / walk From: anders.x.karlsson@songnetworks.se ("Anders Karlsson (X:et)") =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi guys, I've done some small work to add support for specifying wheter to use snmp= =20 version 1 or 2c in snmp_get and snmp_walk. It's an optional argument that is defaulted to version 1 ( for not wrecking= =20 any code that is using snmp_get or walk ). Is this the correct place to send patches for php extensions, if not could = you=20 point me in a direction ?. Anyway, here is the diff: =2D --- php-4.3.7.orig/ext/snmp/snmp.c Tue Feb 3 15:44:17 2004 +++ php-4.3.7/ext/snmp/snmp.c Tue Jun 8 10:41:00 2004 @@ -524,6 +524,7 @@ struct snmp_session session; long timeout=3DSNMP_DEFAULT_TIMEOUT; long retries=3DSNMP_DEFAULT_RETRIES; + long version=3DSNMP_VERSION_1; int myargc =3D ZEND_NUM_ARGS(); char type =3D (char) 0; char *value =3D (char *) 0; @@ -570,6 +571,15 @@ convert_to_long_ex(a5); retries =3D Z_LVAL_PP(a5); } + =09 + if(myargc > 5) { + convert_to_string_ex(a6); + if ( strcmp(Z_STRVAL_PP(a6),"2c") =3D=3D 0 ) { + version =3D SNMP_VERSION_2c; + } + } + =09 + =09 } =20 snmp_sess_init(&session); @@ -580,7 +590,7 @@ =20 session.peername =3D hostname; session.remote_port =3D remote_port; =2D - session.version =3D SNMP_VERSION_1; + session.version =3D version; /* * FIXME: potential memory leak * This is a workaround for an "artifact" (Mike Slifcak) Cheers Anders =2D --=20 SongNetworks anders.x.karlsson@songnetworks.se CDTT (Certified Duct Tape Technician) Programming today is a race between software engineers striving to build=20 bigger and better idiot-proof programs, and the Universe trying to produce= =20 bigger and better idiots. So far, the Universe is winning. - Rich Cook =20 =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAyE4vi30A6pYsr0wRApwxAJsEOvea6jO/Wb8RSAfRTPxlHb6AZQCdFPNa 5f1vnejWJ68Cltl24BcSXnI=3D =3Dlsu1 =2D----END PGP SIGNATURE-----