[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    [DOC-CVS] =?utf-8?q?svn:_/phpdoc/en/trunk/reference/snmp/functions/_snmp2-get.xml_snmp2-getnext.xml_
From:       Christian_Hammers <ch () php ! net>
Date:       2011-02-20 12:46:37
Message-ID: svn-ch-1298205997-308499-2098523155 () svn ! php ! net
[Download RAW message or body]

ch                                       Sun, 20 Feb 2011 12:46:37 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=308499

Log:
Added documentation for the snmp2_* functions.

Changed paths:
    U   phpdoc/en/trunk/reference/snmp/functions/snmp2-get.xml
    U   phpdoc/en/trunk/reference/snmp/functions/snmp2-getnext.xml
    U   phpdoc/en/trunk/reference/snmp/functions/snmp2-real-walk.xml
    U   phpdoc/en/trunk/reference/snmp/functions/snmp2-set.xml
    U   phpdoc/en/trunk/reference/snmp/functions/snmp2-walk.xml


["svn-diffs-308499.txt" (text/x-diff)]

Modified: phpdoc/en/trunk/reference/snmp/functions/snmp2-get.xml
===================================================================
--- phpdoc/en/trunk/reference/snmp/functions/snmp2-get.xml	2011-02-20 12:36:32 UTC \
                (rev 308498)
+++ phpdoc/en/trunk/reference/snmp/functions/snmp2-get.xml	2011-02-20 12:46:37 UTC \
(rev 308499) @@ -4,9 +4,9 @@
 <refentry xml:id="function.snmp2-get" xmlns="http://docbook.org/ns/docbook" \
xmlns:xlink="http://www.w3.org/1999/xlink">  <refnamediv>
   <refname>snmp2_get</refname>
-  <refpurpose>Description</refpurpose>
+  <refpurpose>Fetch an <acronym>SNMP</acronym> object</refpurpose>
  </refnamediv>
-
+
  <refsect1 role="description">
   &reftitle.description;
   <methodsynopsis>
@@ -18,13 +18,12 @@
    <methodparam choice="opt"><type>string</type><parameter>retries</parameter><initializer>5</initializer></methodparam>
  </methodsynopsis>
   <para>
-
+   The <function>snmp2_get</function> function is used to read the
+   value of an <acronym>SNMP</acronym> object specified by the
+   <parameter>object_id</parameter>.
   </para>
-
-  &warn.undocumented.func;
-
  </refsect1>
-
+
  <refsect1 role="parameters">
   &reftitle.parameters;
   <variablelist>
@@ -32,7 +31,7 @@
     <term><parameter>host</parameter></term>
     <listitem>
      <para>
-
+      The <acronym>SNMP</acronym> agent.
      </para>
     </listitem>
    </varlistentry>
@@ -40,7 +39,7 @@
     <term><parameter>community</parameter></term>
     <listitem>
      <para>
-
+      The read community.
      </para>
     </listitem>
    </varlistentry>
@@ -48,7 +47,7 @@
     <term><parameter>object_id</parameter></term>
     <listitem>
      <para>
-
+      The <acronym>SNMP</acronym> object.
      </para>
     </listitem>
    </varlistentry>
@@ -56,7 +55,7 @@
     <term><parameter>timeout</parameter></term>
     <listitem>
      <para>
-
+      The number of microseconds until the first timeout.
      </para>
     </listitem>
    </varlistentry>
@@ -64,20 +63,45 @@
     <term><parameter>retries</parameter></term>
     <listitem>
      <para>
-
+      The number of retries in case timeouts occur.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </refsect1>
-
+
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
-
+   Returns <acronym>SNMP</acronym> object value on success or &false; on error.
   </para>
  </refsect1>
-
+
+ <refsect1 role="examples">
+  &reftitle.examples;
+  <para>
+   <example>
+    <title>Using <function>snmp2_get</function></title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+$syscontact = snmp2_get("127.0.0.1", "public", "system.SysContact.0");
+?>
+]]>
+    </programlisting>
+   </example>
+  </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <para>
+   <simplelist>
+    <member><function>snmp2_set</function></member>
+   </simplelist>
+  </para>
+ </refsect1>
+
 </refentry>

 <!-- Keep this comment at the end of the file
@@ -100,3 +124,4 @@
 vim: et tw=78 syn=sgml
 vi: ts=1 sw=1
 -->
+

Modified: phpdoc/en/trunk/reference/snmp/functions/snmp2-getnext.xml
===================================================================
--- phpdoc/en/trunk/reference/snmp/functions/snmp2-getnext.xml	2011-02-20 12:36:32 \
                UTC (rev 308498)
+++ phpdoc/en/trunk/reference/snmp/functions/snmp2-getnext.xml	2011-02-20 12:46:37 \
UTC (rev 308499) @@ -4,9 +4,9 @@
 <refentry xml:id="function.snmp2-getnext" xmlns="http://docbook.org/ns/docbook" \
xmlns:xlink="http://www.w3.org/1999/xlink">  <refnamediv>
   <refname>snmp2_getnext</refname>
-  <refpurpose>Description</refpurpose>
+  <refpurpose>Fetch the <acronym>SNMP</acronym> object which follows the given \
object id</refpurpose>  </refnamediv>
-
+
  <refsect1 role="description">
   &reftitle.description;
   <methodsynopsis>
@@ -18,13 +18,12 @@
    <methodparam choice="opt"><type>string</type><parameter>retries</parameter><initializer>5</initializer></methodparam>
  </methodsynopsis>
   <para>
-
+   The <function>snmp2_get_next</function> function is used to read the
+   value of the <acronym>SNMP</acronym> object that follows the specified
+   <parameter>object_id</parameter>.
   </para>
-
-  &warn.undocumented.func;
-
  </refsect1>
-
+
  <refsect1 role="parameters">
   &reftitle.parameters;
   <variablelist>
@@ -32,7 +31,7 @@
     <term><parameter>host</parameter></term>
     <listitem>
      <para>
-
+      The hostname of the <acronym>SNMP</acronym> agent (server).
      </para>
     </listitem>
    </varlistentry>
@@ -40,7 +39,7 @@
     <term><parameter>community</parameter></term>
     <listitem>
      <para>
-
+      The read community.
      </para>
     </listitem>
    </varlistentry>
@@ -48,7 +47,7 @@
     <term><parameter>object_id</parameter></term>
     <listitem>
      <para>
-
+      The <acronym>SNMP</acronym> object id which precedes the wanted one.
      </para>
     </listitem>
    </varlistentry>
@@ -56,7 +55,7 @@
     <term><parameter>timeout</parameter></term>
     <listitem>
      <para>
-
+      The number of microseconds until the first timeout.
      </para>
     </listitem>
    </varlistentry>
@@ -64,20 +63,48 @@
     <term><parameter>retries</parameter></term>
     <listitem>
      <para>
-
+      The number of retries in case timeouts occur.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </refsect1>
-
+
+
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
-
+   Returns <acronym>SNMP</acronym> object value on success or &false; on error.
+   In case of an error, an E_WARNING message is shown.
   </para>
  </refsect1>
-
+
+ <refsect1 role="examples">
+  &reftitle.examples;
+  <para>
+   <example>
+    <title>Using <function>snmp2_get_next</function></title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+$nameOfSecondInterface = snmp2_get_netxt('localhost', 'public', 'IF-MIB::ifName.1';
+?>
+]]>
+    </programlisting>
+   </example>
+  </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <para>
+   <simplelist>
+    <member><function>snmp2_get</function></member>
+    <member><function>snmp2_walk</function></member>
+   </simplelist>
+  </para>
+ </refsect1>
+
 </refentry>

 <!-- Keep this comment at the end of the file
@@ -100,3 +127,4 @@
 vim: et tw=78 syn=sgml
 vi: ts=1 sw=1
 -->
+

Modified: phpdoc/en/trunk/reference/snmp/functions/snmp2-real-walk.xml
===================================================================
--- phpdoc/en/trunk/reference/snmp/functions/snmp2-real-walk.xml	2011-02-20 12:36:32 \
                UTC (rev 308498)
+++ phpdoc/en/trunk/reference/snmp/functions/snmp2-real-walk.xml	2011-02-20 12:46:37 \
UTC (rev 308499) @@ -4,9 +4,9 @@
 <refentry xml:id="function.snmp2-real-walk" xmlns="http://docbook.org/ns/docbook" \
xmlns:xlink="http://www.w3.org/1999/xlink">  <refnamediv>
   <refname>snmp2_real_walk</refname>
-  <refpurpose>Description</refpurpose>
+  <refpurpose>Return all objects including their respective object ID within the \
specified one</refpurpose>  </refnamediv>
-
+
  <refsect1 role="description">
   &reftitle.description;
   <methodsynopsis>
@@ -18,13 +18,12 @@
    <methodparam choice="opt"><type>string</type><parameter>retries</parameter><initializer>5</initializer></methodparam>
  </methodsynopsis>
   <para>
-
+   The <function>snmp2_real_walk</function> function is used to traverse over a \
number +   of <acronym>SNMP</acronym> objects starting from \
<parameter>object_id</parameter> +   and return not only their values but also their \
object ids.  </para>
-
-  &warn.undocumented.func;
-
  </refsect1>
-
+
  <refsect1 role="parameters">
   &reftitle.parameters;
   <variablelist>
@@ -32,7 +31,7 @@
     <term><parameter>host</parameter></term>
     <listitem>
      <para>
-
+      The hostname of the <acronym>SNMP</acronym> agent (server).
      </para>
     </listitem>
    </varlistentry>
@@ -40,7 +39,7 @@
     <term><parameter>community</parameter></term>
     <listitem>
      <para>
-
+      The read community.
      </para>
     </listitem>
    </varlistentry>
@@ -48,7 +47,7 @@
     <term><parameter>object_id</parameter></term>
     <listitem>
      <para>
-
+      The <acronym>SNMP</acronym> object id which precedes the wanted one.
      </para>
     </listitem>
    </varlistentry>
@@ -56,7 +55,7 @@
     <term><parameter>timeout</parameter></term>
     <listitem>
      <para>
-
+      The number of microseconds until the first timeout.
      </para>
     </listitem>
    </varlistentry>
@@ -64,20 +63,61 @@
     <term><parameter>retries</parameter></term>
     <listitem>
      <para>
-
+      The number of retries in case timeouts occur.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </refsect1>
-
+
+
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
-
+   Returns an associative array of the <acronym>SNMP</acronym> object ids and their \
values on success or &false; on error. +   In case of an error, an E_WARNING message \
is shown.  </para>
  </refsect1>
-
+
+ <refsect1 role="examples">
+  &reftitle.examples;
+  <para>
+   <example>
+    <title>Using <function>snmp2_real_walk</function></title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+ print_r(snmp2_real_walk("localhost", "public", "IF-MIB::ifName"));
+?>
+]]>
+    </programlisting>
+
+    <para>
+     The above will output something like:
+<![CDATA[
+    Array
+      (
+      [IF-MIB::ifName.1] => STRING: lo
+      [IF-MIB::ifName.2] => STRING: eth0
+      [IF-MIB::ifName.3] => STRING: eth2
+      [IF-MIB::ifName.4] => STRING: sit0
+      [IF-MIB::ifName.5] => STRING: sixxs
+    )
+]]>
+    </para>
+   </example>
+  </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <para>
+   <simplelist>
+    <member><function>snmp2_walk</function></member>
+   </simplelist>
+  </para>
+ </refsect1>
+
 </refentry>

 <!-- Keep this comment at the end of the file
@@ -100,3 +140,4 @@
 vim: et tw=78 syn=sgml
 vi: ts=1 sw=1
 -->
+

Modified: phpdoc/en/trunk/reference/snmp/functions/snmp2-set.xml
===================================================================
--- phpdoc/en/trunk/reference/snmp/functions/snmp2-set.xml	2011-02-20 12:36:32 UTC \
                (rev 308498)
+++ phpdoc/en/trunk/reference/snmp/functions/snmp2-set.xml	2011-02-20 12:46:37 UTC \
(rev 308499) @@ -4,9 +4,9 @@
 <refentry xml:id="function.snmp2-set" xmlns="http://docbook.org/ns/docbook" \
xmlns:xlink="http://www.w3.org/1999/xlink">  <refnamediv>
   <refname>snmp2_set</refname>
-  <refpurpose>Description</refpurpose>
+  <refpurpose>Set the value of an <acronym>SNMP</acronym> object</refpurpose>
  </refnamediv>
-
+
  <refsect1 role="description">
   &reftitle.description;
   <methodsynopsis>
@@ -20,13 +20,12 @@
    <methodparam choice="opt"><type>string</type><parameter>retries</parameter><initializer>5</initializer></methodparam>
  </methodsynopsis>
   <para>
-
+   <function>snmp2_set</function> is used to set the value of an \
<acronym>SNMP</acronym> object +   specified by the <parameter>object_id</parameter>.
   </para>
-
-  &warn.undocumented.func;
-
+
  </refsect1>
-
+
  <refsect1 role="parameters">
   &reftitle.parameters;
   <variablelist>
@@ -34,7 +33,7 @@
     <term><parameter>host</parameter></term>
     <listitem>
      <para>
-
+      The hostname of the <acronym>SNMP</acronym> agent (server).
      </para>
     </listitem>
    </varlistentry>
@@ -42,7 +41,7 @@
     <term><parameter>community</parameter></term>
     <listitem>
      <para>
-
+      The write community.
      </para>
     </listitem>
    </varlistentry>
@@ -50,7 +49,7 @@
     <term><parameter>object_id</parameter></term>
     <listitem>
      <para>
-
+      The <acronym>SNMP</acronym> object id.
      </para>
     </listitem>
    </varlistentry>
@@ -58,15 +57,70 @@
     <term><parameter>type</parameter></term>
     <listitem>
      <para>
-
+      The <acronym>MIB</acronym> defines the type of each object id. It has to be \
specified as a single character from the below list.  </para>
+     <table>
+      <title>types</title>
+      <tgroup cols="2">
+       <tbody>
+        <row><entry>=</entry><entry>The type is taken from the MIB</entry></row>
+        <row><entry>i</entry><entry>INTEGER</entry> </row>
+        <row><entry>u</entry><entry>INTEGER</entry></row>
+        <row><entry>s</entry><entry>STRING</entry></row>
+        <row><entry>x</entry><entry>HEX STRING</entry></row>
+        <row><entry>d</entry><entry>DECIMAL STRING</entry></row>
+        <row><entry>n</entry><entry>NULLOBJ</entry></row>
+        <row><entry>o</entry><entry>OBJID</entry></row>
+        <row><entry>t</entry><entry>TIMETICKS</entry></row>
+        <row><entry>a</entry><entry>IPADDRESS</entry></row>
+        <row><entry>b</entry><entry>BITS</entry></row>
+       </tbody>
+      </tgroup>
+     </table>
+     <para>
+      If OPAQUE_SPECIAL_TYPES was defined while compiling the SNMP library, the \
following are also valid: +     </para>
+     <table>
+      <title>types</title>
+      <tgroup cols="2">
+       <tbody>
+        <row><entry>U</entry><entry>unsigned int64</entry></row>
+        <row><entry>I</entry><entry>signed int64</entry></row>
+        <row><entry>F</entry><entry>float</entry></row>
+        <row><entry>D</entry><entry>double</entry></row>
+       </tbody>
+      </tgroup>
+     </table>
+     <para>
+      Most of these will use the obvious corresponding ASN.1 type.  's', 'x', 'd' \
and 'b' are all different ways of specifying an OCTET STRING value, and +      the \
'u' unsigned type is also used for handling Gauge32 values. +     </para>
+     <para>
+      If the MIB-Files are loaded by into the MIB Tree with "snmp_read_mib" or by \
specifying it in the libsnmp config, '=' may be used as the \
<parameter>type</parameter> parameter +      for all object ids as the type can then \
be automatically read from the MIB. +     </para>
+     <para>
+      Note that there are two ways to set a variable of the type BITS like e.g. \
"SYNTAX    BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}" +   \
</para> +     <itemizedlist>
+      <listitem>
+       <para>
+        Using type "b" and a list of bit numbers like: <programlisting \
role="php">snmpset('FOO-MIB::bar.42', 'b', '0 1 2 3 4');</programlisting> with the \
disadvantage that the success is not easily verifyable as an snmpget() for the same \
OID would return e.g. 0xF8. +       </para>
+      </listitem>
+      <listitem>
+       <para>
+        Using type "x" and a hex number but without(!) the usual "0x" prefix: \
<programlisting role="php">snmpset('FOO-MIB::bar.42', 'x', 'F0');</programlisting> +  \
</para> +      </listitem>
+     </itemizedlist>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>value</parameter></term>
     <listitem>
      <para>
-
+      The new value.
      </para>
     </listitem>
    </varlistentry>
@@ -74,7 +128,7 @@
     <term><parameter>timeout</parameter></term>
     <listitem>
      <para>
-
+      The number of microseconds until the first timeout.
      </para>
     </listitem>
    </varlistentry>
@@ -82,20 +136,51 @@
     <term><parameter>retries</parameter></term>
     <listitem>
      <para>
-
+      The number of retries in case of timeouts.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </refsect1>
-
+
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
-
+   &return.success;
   </para>
+  <para>
+   If the SNMP host rejects the data type, an E_WARNING message like "Warning: Error \
in packet. Reason: (badValue) The value given has the wrong type or length." is \
shown. +   If an unknown or invalid OID is specified the warning probably reads \
"Could not add variable". +  </para>
  </refsect1>
-
+
+
+
+ <refsect1 role="examples">
+  &reftitle.examples;
+  <para>
+   <example>
+    <title>Using <function>snmp2_set</function></title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+  snmp2_set("localhost", "public", "IF-MIB::ifAlias.3", "s", "foo");
+?>
+ ]]>
+    </programlisting>
+   </example>
+  </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <para>
+   <simplelist>
+    <member><function>snmp2_get</function></member>
+   </simplelist>
+  </para>
+ </refsect1>
+
 </refentry>

 <!-- Keep this comment at the end of the file
@@ -118,3 +203,4 @@
 vim: et tw=78 syn=sgml
 vi: ts=1 sw=1
 -->
+

Modified: phpdoc/en/trunk/reference/snmp/functions/snmp2-walk.xml
===================================================================
--- phpdoc/en/trunk/reference/snmp/functions/snmp2-walk.xml	2011-02-20 12:36:32 UTC \
                (rev 308498)
+++ phpdoc/en/trunk/reference/snmp/functions/snmp2-walk.xml	2011-02-20 12:46:37 UTC \
(rev 308499) @@ -4,9 +4,9 @@
 <refentry xml:id="function.snmp2-walk" xmlns="http://docbook.org/ns/docbook" \
xmlns:xlink="http://www.w3.org/1999/xlink">  <refnamediv>
   <refname>snmp2_walk</refname>
-  <refpurpose>Description</refpurpose>
+  <refpurpose>Fetch all the <acronym>SNMP</acronym> objects from an \
agent</refpurpose>  </refnamediv>
-
+
  <refsect1 role="description">
   &reftitle.description;
   <methodsynopsis>
@@ -18,13 +18,11 @@
    <methodparam choice="opt"><type>string</type><parameter>retries</parameter><initializer>5</initializer></methodparam>
  </methodsynopsis>
   <para>
-
+   <function>snmp2_walk</function> function is used to read all the values from
+   an <acronym>SNMP</acronym> agent specified by the \
<parameter>hostname</parameter>.  </para>
-
-  &warn.undocumented.func;
-
  </refsect1>
-
+
  <refsect1 role="parameters">
   &reftitle.parameters;
   <variablelist>
@@ -32,7 +30,7 @@
     <term><parameter>host</parameter></term>
     <listitem>
      <para>
-
+      The SNMP agent (server).
      </para>
     </listitem>
    </varlistentry>
@@ -40,7 +38,7 @@
     <term><parameter>community</parameter></term>
     <listitem>
      <para>
-
+      The read community.
      </para>
     </listitem>
    </varlistentry>
@@ -48,15 +46,21 @@
     <term><parameter>object_id</parameter></term>
     <listitem>
      <para>
-
+      If &null;, <parameter>object_id</parameter> is taken as the root of
+      the <acronym>SNMP</acronym> objects tree and all objects under that tree are \
returned as +      an array.
      </para>
+     <para>
+      If <parameter>object_id</parameter> is specified, all the \
<acronym>SNMP</acronym> objects +      below that <parameter>object_id</parameter> \
are returned. +     </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>timeout</parameter></term>
     <listitem>
      <para>
-
+      The number of microseconds until the first timeout.
      </para>
     </listitem>
    </varlistentry>
@@ -64,20 +68,56 @@
     <term><parameter>retries</parameter></term>
     <listitem>
      <para>
-
+      <para>The number of retries in case timeouts occur.</para>
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </refsect1>
-
+
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
+   Returns an array of <acronym>SNMP</acronym> object values starting from the
+   <parameter>object_id</parameter> as root or &false; on error.
+  </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+  &reftitle.examples;
+  <para>
+   <example>
+    <title><function>snm2_pwalk</function> Example</title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+$a = snmp2_walk("127.0.0.1", "public", "");

+foreach ($a as $val) {
+    echo "$val\n";
+}
+
+?>
+]]>
+    </programlisting>
+   </example>
   </para>
+  <para>
+   Above function call would return all the <acronym>SNMP</acronym> objects from the
+   <acronym>SNMP</acronym> agent running on localhost. One can step through the \
values +   with a loop
+  </para>
  </refsect1>
-
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <para>
+   <simplelist>
+    <member><function>snmp2_real_walk</function></member>
+   </simplelist>
+  </para>
+ </refsect1>
+
 </refentry>

 <!-- Keep this comment at the end of the file
@@ -100,3 +140,4 @@
 vim: et tw=78 syn=sgml
 vi: ts=1 sw=1
 -->
+



-- 
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic