[doc-en] master: PHP 8.6: Document the SNMP MIB reset and output control additions (#6116)

From: Date: Mon, 23 Nov 2026 08:58:58 +0000
Subject: [doc-en] master: PHP 8.6: Document the SNMP MIB reset and output control additions (#6116)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23997@lists.php.net to get a copy of this message
Author: Asish Kumar (officialasishkumar) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-11-23T09:58:55+01:00 Commit: https://github.com/php/doc-en/commit/b5929396f68e26937c8b36a2a904c6123da9c4b0 Raw diff: https://github.com/php/doc-en/commit/b5929396f68e26937c8b36a2a904c6123da9c4b0.diff PHP 8.6: Document the SNMP MIB reset and output control additions (#6116) * PHP 8.6: Document the SNMP MIB reset and output control additions PHP 8.6 implemented the "SNMP improvements" RFC, which added functions, methods, properties and enums to ext/snmp. The migration guide already lists them, but none had a reference page, so every link to them was dead. This documents them, based on ext/snmp/snmp.c and the Net-SNMP snmpcmd(1) manual, and checked against PHP 8.6.0 with a Net-SNMP agent. New enum pages: - Snmp\Mib: the MIB parsing options, with the Net-SNMP -P option and snmp.conf token each one corresponds to. - Snmp\OidOutput: the OID output formats, and their SNMP_OID_OUTPUT_* equivalents. - Snmp\Output: the value output options, with their -O option and the SNMP property that controls each one per session. - Snmp\StringOutput: the string output formats, which only apply to objects without a DISPLAY-HINT. New function pages: - snmp_init_mib(): unloads the MIB tree, sets the MIB directories and loads the tree again. The default directories and tree are restored at the end of the request. - snmp_set_mib_option(), snmp_set_output_option() and snmp_set_string_output_format(). New method pages: SNMP::setOidOutputFormat() and SNMP::setStringOutputFormat(). The SNMP class page lists the new $numeric_index, $numeric_timeticks, $extended_index, $dont_print_units, $escape_quotes and $print_hex_text properties. It also explains that output properties take their initial values from the global settings when the object is created. snmp_set_oid_output_format() now accepts Snmp\OidOutput|int. Its page also gains the Errors section and the 8.0.0 changelog row it lacked: an invalid format throws a ValueError, where it used to raise an E_WARNING and return false. Fixes #5852 * Drop the snmp.conf mibs token from the snmp_init_mib() description * Clarify the Snmp\StringOutput::Hex description Changed paths: A reference/snmp/functions/snmp-init-mib.xml A reference/snmp/functions/snmp-set-mib-option.xml A reference/snmp/functions/snmp-set-output-option.xml A reference/snmp/functions/snmp-set-string-output-format.xml A reference/snmp/snmp.mib.xml A reference/snmp/snmp.oidoutput.xml A reference/snmp/snmp.output.xml A reference/snmp/snmp.stringoutput.xml A reference/snmp/snmp/setoidoutputformat.xml A reference/snmp/snmp/setstringoutputformat.xml M reference/snmp/book.xml M reference/snmp/functions/snmp-set-oid-output-format.xml M reference/snmp/snmp.xml M reference/snmp/versions.xml Diff: diff --git a/reference/snmp/book.xml b/reference/snmp/book.xml index e2d020f163c4..da29066bd4d2 100644 --- a/reference/snmp/book.xml +++ b/reference/snmp/book.xml @@ -29,6 +29,11 @@ &reference.snmp.snmp; &reference.snmp.snmpexception; + + &reference.snmp.snmp.mib; + &reference.snmp.snmp.oidoutput; + &reference.snmp.snmp.output; + &reference.snmp.snmp.stringoutput; </book> <!-- Keep this comment at the end of the file Local variables: diff --git a/reference/snmp/functions/snmp-init-mib.xml b/reference/snmp/functions/snmp-init-mib.xml new file mode 100644 index 000000000000..02536cb7ba55 --- /dev/null +++ b/reference/snmp/functions/snmp-init-mib.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xml:id="function.snmp-init-mib" xmlns="http://docbook.org/ns/docbook"> + <refnamediv> + <refname>snmp_init_mib</refname> + <refpurpose>Reset the <acronym>MIB</acronym> tree</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>void</type><methodname>snmp_init_mib</methodname> + <methodparam><type class="union"><type>string</type><type>null</type></type><parameter>mibdirs</parameter></methodparam> + </methodsynopsis> + <simpara> + Unloads the whole <acronym>MIB</acronym> tree of the + Net-<acronym>SNMP</acronym> library, including the <acronym>MIB</acronym> + files read with <function>snmp_read_mib</function>, sets the list of + directories in which <acronym>MIB</acronym> files are searched, and then + loads the <acronym>MIB</acronym> tree again. + </simpara> + <simpara> + When the tree is loaded again, the <acronym>MIB</acronym> modules listed in + the <envar>MIBS</envar> environment variable, or else the default modules, + are read from these directories, as well as the files listed in the + <envar>MIBFILES</envar> environment variable. + The <acronym>MIB</acronym> directories are also searched when an + <acronym>OID</acronym> such as <literal>IF-MIB::ifDescr</literal> names a + module that is not loaded yet. + </simpara> + <simpara> + This is useful to load a different set of <acronym>MIB</acronym> modules, + for instance when two vendor <acronym>MIB</acronym>s define conflicting + objects for the same <acronym>OID</acronym>. + </simpara> + <simpara> + At the end of the request, the default <acronym>MIB</acronym> directories + and tree are restored. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>mibdirs</parameter></term> + <listitem> + <simpara> + The directories in which <acronym>MIB</acronym> files are searched, + separated by a colon (<literal>:</literal>), or by a semicolon + (<literal>;</literal>) on Windows. + </simpara> + <simpara> + If &null;, the directories are taken from the <envar>MIBDIRS</envar> + environment variable, from the <literal>mibdirs</literal> token of the + Net-<acronym>SNMP</acronym> configuration file, or are the default + directories of the Net-<acronym>SNMP</acronym> library, in that order. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + &return.void; + </simpara> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>Loading <acronym>MIB</acronym> files from other directories</title> + <programlisting role="php" annotations="non-interactive"> +<![CDATA[ +<?php + +// Search for MIB files in these directories only +snmp_init_mib('/opt/vendor/mibs:/usr/share/snmp/mibs'); +$descriptions = snmp2_real_walk('localhost', 'public', 'VENDOR-MIB::vendorDescr'); + +?> +]]> + </programlisting> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><function>snmp_read_mib</function></member> + <member><function>snmp_set_mib_option</function></member> + </simplelist> + </refsect1> +</refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/functions/snmp-set-mib-option.xml b/reference/snmp/functions/snmp-set-mib-option.xml new file mode 100644 index 000000000000..f7b3be1be948 --- /dev/null +++ b/reference/snmp/functions/snmp-set-mib-option.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xml:id="function.snmp-set-mib-option" xmlns="http://docbook.org/ns/docbook"> + <refnamediv> + <refname>snmp_set_mib_option</refname> + <refpurpose>Set an option for parsing <acronym>MIB</acronym> files</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>void</type><methodname>snmp_set_mib_option</methodname> + <methodparam><type>Snmp\Mib</type><parameter>option</parameter></methodparam> + <methodparam><type>bool</type><parameter>enable</parameter></methodparam> + </methodsynopsis> + <simpara> + Enables or disables an option that controls how the + Net-<acronym>SNMP</acronym> library parses <acronym>MIB</acronym> files. + These options make it possible to read <acronym>MIB</acronym> files that + do not strictly follow the <acronym>SMI</acronym> syntax. + </simpara> + <simpara> + The options apply to the <acronym>MIB</acronym> files that are read + afterwards: with <function>snmp_read_mib</function>, when the + <acronym>MIB</acronym> tree is loaded again by + <function>snmp_init_mib</function>, or when a module is loaded + automatically from the <acronym>MIB</acronym> directories. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>option</parameter></term> + <listitem> + <simpara> + The option to set. See <enumname>Snmp\Mib</enumname> for the available + options. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>enable</parameter></term> + <listitem> + <simpara> + Whether to enable the option. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + &return.void; + </simpara> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>Reading a <acronym>MIB</acronym> file that uses underscores in names</title> + <programlisting role="php" annotations="non-interactive"> +<![CDATA[ +<?php + +snmp_set_mib_option(Snmp\Mib::AllowUnderscores, true); +snmp_read_mib('/usr/share/snmp/mibs/VENDOR-MIB.txt'); + +?> +]]> + </programlisting> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><function>snmp_read_mib</function></member> + <member><function>snmp_init_mib</function></member> + </simplelist> + </refsect1> +</refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/functions/snmp-set-oid-output-format.xml b/reference/snmp/functions/snmp-set-oid-output-format.xml index 7cfab58480b7..613a38952bd0 100644 --- a/reference/snmp/functions/snmp-set-oid-output-format.xml +++ b/reference/snmp/functions/snmp-set-oid-output-format.xml @@ -11,7 +11,7 @@ &reftitle.description; <methodsynopsis> <type>true</type><methodname>snmp_set_oid_output_format</methodname> - <methodparam><type>int</type><parameter>format</parameter></methodparam> + <methodparam><type class="union"><type>Snmp\OidOutput</type><type>int</type></type><parameter>format</parameter></methodparam> </methodsynopsis> <simpara> <function>snmp_set_oid_output_format</function> sets the output format @@ -25,6 +25,11 @@ <varlistentry> <term><parameter>format</parameter></term> <listitem> + <simpara> + A case of the <enumname>Snmp\OidOutput</enumname> enum, or one of the + <constant>SNMP_OID_OUTPUT_<replaceable>*</replaceable></constant> + constants. + </simpara> <table> <title>OID .1.3.6.1.2.1.1.3.0 representation for various <parameter>format</parameter> values</title> <tgroup cols="2"> @@ -50,6 +55,16 @@ </simpara> </refsect1> + <refsect1 role="errors"> + &reftitle.errors; + <simpara> + Throws a <exceptionname>ValueError</exceptionname> if + <parameter>format</parameter> is an <type>int</type> that is not one of the + <constant>SNMP_OID_OUTPUT_<replaceable>*</replaceable></constant> + constants. + </simpara> + </refsect1> + <refsect1 role="changelog"> &reftitle.changelog; <informaltable> @@ -61,7 +76,23 @@ </row> </thead> <tbody> + <row> + <entry>8.6.0</entry> + <entry> + <parameter>format</parameter> now also accepts a case of the + <enumname>Snmp\OidOutput</enumname> enum. + </entry> + </row> &return.type.true.83; + <row> + <entry>8.0.0</entry> + <entry> + Now throws a <exceptionname>ValueError</exceptionname> if + <parameter>format</parameter> is not valid. + Previously, an <constant>E_WARNING</constant> was raised and &false; + was returned. + </entry> + </row> </tbody> </tgroup> </informaltable> diff --git a/reference/snmp/functions/snmp-set-output-option.xml b/reference/snmp/functions/snmp-set-output-option.xml new file mode 100644 index 000000000000..3e444352c4f0 --- /dev/null +++ b/reference/snmp/functions/snmp-set-output-option.xml @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xml:id="function.snmp-set-output-option" xmlns="http://docbook.org/ns/docbook"> + <refnamediv> + <refname>snmp_set_output_option</refname> + <refpurpose>Set an option for formatting the returned values</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>void</type><methodname>snmp_set_output_option</methodname> + <methodparam><type>Snmp\Output</type><parameter>option</parameter></methodparam> + <methodparam><type>bool</type><parameter>enable</parameter></methodparam> + </methodsynopsis> + <simpara> + Enables or disables an option that controls how the + Net-<acronym>SNMP</acronym> library formats the values and + <acronym>OID</acronym>s returned by the <acronym>SNMP</acronym> functions, + such as <function>snmp2_get</function> or <function>snmp2_real_walk</function>. + </simpara> + <simpara> + A new <classname>SNMP</classname> object takes its initial output options + from the values set with this function. To change an option for a single + session, set the corresponding property of the <classname>SNMP</classname> + object instead. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>option</parameter></term> + <listitem> + <simpara> + The option to set. See <enumname>Snmp\Output</enumname> for the + available options. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>enable</parameter></term> + <listitem> + <simpara> + Whether to enable the option. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + &return.void; + </simpara> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>Formatting <literal>TimeTicks</literal> and table indexes</title> + <programlisting role="php" annotations="non-interactive"> +<![CDATA[ +<?php + +var_dump(snmp2_get('localhost', 'public', 'SNMPv2-MIB::sysUpTime.0')); + +snmp_set_output_option(Snmp\Output::NumericTimeticks, true); +var_dump(snmp2_get('localhost', 'public', 'SNMPv2-MIB::sysUpTime.0')); + +snmp_set_output_option(Snmp\Output::ExtendedIndex, true); +var_dump(snmp2_real_walk('localhost', 'public', 'IF-MIB::ifDescr')); + +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +string(40) "Timeticks: (14096763) 1 day, 15:09:27.63" +string(8) "14096763" +array(2) { + ["IF-MIB::ifDescr[1]"]=> + string(10) "STRING: lo" + ["IF-MIB::ifDescr[2]"]=> + string(12) "STRING: eth0" +} +]]> + </screen> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><enumname>Snmp\Output</enumname></member> + <member><function>snmp_set_string_output_format</function></member> + <member><function>snmp_set_oid_output_format</function></member> + <member><function>snmp_set_quick_print</function></member> + <member><function>snmp_set_enum_print</function></member> + </simplelist> + </refsect1> +</refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/functions/snmp-set-string-output-format.xml b/reference/snmp/functions/snmp-set-string-output-format.xml new file mode 100644 index 000000000000..4c062966fa21 --- /dev/null +++ b/reference/snmp/functions/snmp-set-string-output-format.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xml:id="function.snmp-set-string-output-format" xmlns="http://docbook.org/ns/docbook"> + <refnamediv> + <refname>snmp_set_string_output_format</refname> + <refpurpose>Set the output format of string values</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>void</type><methodname>snmp_set_string_output_format</methodname> + <methodparam><type>Snmp\StringOutput</type><parameter>format</parameter></methodparam> + </methodsynopsis> + <simpara> + Sets the format in which the Net-<acronym>SNMP</acronym> library prints the + string values returned by the <acronym>SNMP</acronym> functions, such as + <function>snmp2_get</function> or <function>snmp2_real_walk</function>. + The format only applies to string values whose <acronym>MIB</acronym> + object has no <literal>DISPLAY-HINT</literal>. + </simpara> + <simpara> + A new <classname>SNMP</classname> object takes its initial string output + format from the value set with this function. To change it for a single + session, use <methodname>SNMP::setStringOutputFormat</methodname> instead. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>format</parameter></term> + <listitem> + <simpara> + The format to use. See <enumname>Snmp\StringOutput</enumname> for the + available formats. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + &return.void; + </simpara> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>Printing a binary string as text</title> + <programlisting role="php" annotations="non-interactive"> +<![CDATA[ +<?php + +echo snmp2_get('localhost', 'public', 'SNMP-FRAMEWORK-MIB::snmpEngineID.0'), PHP_EOL; + +snmp_set_string_output_format(Snmp\StringOutput::Ascii); +echo snmp2_get('localhost', 'public', 'SNMP-FRAMEWORK-MIB::snmpEngineID.0'), PHP_EOL; + +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Hex-STRING: 80 00 1F 88 80 1C FC 9A 1B 26 7B FF 6A 00 00 00 +00 +STRING: ".........&{.j...." +]]> + </screen> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><enumname>Snmp\StringOutput</enumname></member> + <member><methodname>SNMP::setStringOutputFormat</methodname></member> + <member><function>snmp_set_output_option</function></member> + </simplelist> + </refsect1> +</refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/snmp.mib.xml b/reference/snmp/snmp.mib.xml new file mode 100644 index 000000000000..5f322f168a36 --- /dev/null +++ b/reference/snmp/snmp.mib.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="utf-8"?> +<reference xml:id="enum.snmp-mib" role="enum" xmlns="http://docbook.org/ns/docbook"> + <title>The Snmp\Mib Enum</title> + <titleabbrev>Snmp\Mib</titleabbrev> + + <partintro> + <section xml:id="enum.snmp-mib.intro"> + &reftitle.intro; + <simpara> + The <enumname>Snmp\Mib</enumname> enum lists the options that control + how the Net-<acronym>SNMP</acronym> library parses + <acronym>MIB</acronym> files. They are set with + <function>snmp_set_mib_option</function>, and allow reading + <acronym>MIB</acronym> files that do not strictly follow the + <acronym>SMI</acronym> syntax. + </simpara> + </section> + + <section xml:id="enum.snmp-mib.synopsis"> + &reftitle.enumsynopsis; + + <packagesynopsis> + <package>Snmp</package> + + <enumsynopsis> + <enumname>Mib</enumname> + + <enumitem> + <enumidentifier>AllowUnderscores</enumidentifier> + <enumitemdescription> + Allow the underscore character (<literal>_</literal>) in + <acronym>MIB</acronym> object names and other symbols. + This is not valid <acronym>SMI</acronym> syntax, but some vendor + <acronym>MIB</acronym> files use it. + Corresponds to the <literal>-Pu</literal> command-line option and + the <literal>mibAllowUnderline</literal> configuration token of + Net-<acronym>SNMP</acronym>. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>CommentTerm</enumidentifier> + <enumitemdescription> + Make every comment extend to the end of the line. + Strictly speaking, a second <literal>--</literal> on the same line + ends a comment, which is the default behaviour, but this breaks some + <acronym>MIB</acronym> files. + Corresponds to the <literal>-Pc</literal> command-line option and + the <literal>commentToEOL</literal> configuration token of + Net-<acronym>SNMP</acronym>. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>Replace</enumidentifier> + <enumitemdescription> + If the same <acronym>MIB</acronym> object (parent name and + sub-identifier) is defined more than once, use the definition that + was read last. By default, the first definition is used, and later + ones are discarded. + Corresponds to the <literal>-PR</literal> command-line option and + the <literal>mibReplaceWithLatest</literal> configuration token of + Net-<acronym>SNMP</acronym>. + </enumitemdescription> + </enumitem> + </enumsynopsis> + </packagesynopsis> + </section> + + <section xml:id="enum.snmp-mib.seealso"> + &reftitle.seealso; + <simplelist> + <member><function>snmp_set_mib_option</function></member> + <member><function>snmp_read_mib</function></member> + </simplelist> + </section> + </partintro> +</reference> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/snmp.oidoutput.xml b/reference/snmp/snmp.oidoutput.xml new file mode 100644 index 000000000000..2f570ab053f6 --- /dev/null +++ b/reference/snmp/snmp.oidoutput.xml @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="utf-8"?> +<reference xml:id="enum.snmp-oidoutput" role="enum" xmlns="http://docbook.org/ns/docbook"> + <title>The Snmp\OidOutput Enum</title> + <titleabbrev>Snmp\OidOutput</titleabbrev> + + <partintro> + <section xml:id="enum.snmp-oidoutput.intro"> + &reftitle.intro; + <simpara> + The <enumname>Snmp\OidOutput</enumname> enum lists the formats in which + the Net-<acronym>SNMP</acronym> library prints an <acronym>OID</acronym>. + It is accepted by <function>snmp_set_oid_output_format</function> and + <methodname>SNMP::setOidOutputFormat</methodname>. + Each case is equivalent to the + <constant>SNMP_OID_OUTPUT_<replaceable>*</replaceable></constant> + constant of the same name. + </simpara> + <simpara> + The descriptions below show how the <acronym>OID</acronym> + <literal>.1.3.6.1.2.1.1.3.0</literal> is printed in each format. + </simpara> + </section> + + <section xml:id="enum.snmp-oidoutput.synopsis"> + &reftitle.enumsynopsis; + + <packagesynopsis> + <package>Snmp</package> + + <enumsynopsis> + <enumname>OidOutput</enumname> + + <enumitem> + <enumidentifier>Suffix</enumidentifier> + <enumitemdescription> + Only the name of the <acronym>MIB</acronym> object, plus any instance + sub-identifiers: <literal>sysUpTimeInstance</literal>. + Equivalent to <constant>SNMP_OID_OUTPUT_SUFFIX</constant>. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>Module</enumidentifier> + <enumitemdescription> + The name of the <acronym>MIB</acronym> module and of the object: + <literal>DISMAN-EVENT-MIB::sysUpTimeInstance</literal>. + Equivalent to <constant>SNMP_OID_OUTPUT_MODULE</constant>. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>Full</enumidentifier> + <enumitemdescription> + The full list of <acronym>MIB</acronym> object names: + <literal>.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.sysUpTimeInstance</literal>. + Equivalent to <constant>SNMP_OID_OUTPUT_FULL</constant>. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>Numeric</enumidentifier> + <enumitemdescription> + The numeric <acronym>OID</acronym>: <literal>.1.3.6.1.2.1.1.3.0</literal>. + Equivalent to <constant>SNMP_OID_OUTPUT_NUMERIC</constant>. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>Ucd</enumidentifier> + <enumitemdescription> + The traditional UCD-style output, which removes a series of standard + prefixes from the <acronym>OID</acronym>: + <literal>system.sysUpTime.sysUpTimeInstance</literal>. + Equivalent to <constant>SNMP_OID_OUTPUT_UCD</constant>. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>None</enumidentifier> + <enumitemdescription> + The <acronym>OID</acronym> is not printed, so the keys of the arrays + returned by the walk functions are undefined. + Equivalent to <constant>SNMP_OID_OUTPUT_NONE</constant>. + </enumitemdescription> + </enumitem> + </enumsynopsis> + </packagesynopsis> + </section> + + <section xml:id="enum.snmp-oidoutput.seealso"> + &reftitle.seealso; + <simplelist> + <member><function>snmp_set_oid_output_format</function></member> + <member><methodname>SNMP::setOidOutputFormat</methodname></member> + <member><link linkend="snmp.props.oid-output-format"><varname>SNMP::$oid_output_format</varname></link></member> + </simplelist> + </section> + </partintro> +</reference> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/snmp.output.xml b/reference/snmp/snmp.output.xml new file mode 100644 index 000000000000..1b58b70b1d03 --- /dev/null +++ b/reference/snmp/snmp.output.xml @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="utf-8"?> +<reference xml:id="enum.snmp-output" role="enum" xmlns="http://docbook.org/ns/docbook"> + <title>The Snmp\Output Enum</title> + <titleabbrev>Snmp\Output</titleabbrev> + + <partintro> + <section xml:id="enum.snmp-output.intro"> + &reftitle.intro; + <simpara> + The <enumname>Snmp\Output</enumname> enum lists the options that control + how the Net-<acronym>SNMP</acronym> library formats the values and + <acronym>OID</acronym>s it returns. They are set with + <function>snmp_set_output_option</function>. + Each option can also be set on a single <classname>SNMP</classname> + session with the corresponding property. + </simpara> + </section> + + <section xml:id="enum.snmp-output.synopsis"> + &reftitle.enumsynopsis; + + <packagesynopsis> + <package>Snmp</package> + + <enumsynopsis> + <enumname>Output</enumname> + + <enumitem> + <enumidentifier>NumericIndex</enumidentifier> + <enumitemdescription> + Print table indexes numerically, instead of trying to interpret them + as strings or <acronym>OID</acronym>s. + For instance, <literal>vacmSecurityModel.0."wes"</literal> is printed + as <literal>vacmSecurityModel.0.3.119.101.115</literal>. + Corresponds to the <literal>-Ob</literal> command-line option of + Net-<acronym>SNMP</acronym> and to the + <link linkend="snmp.props.numeric-index"><varname>SNMP::$numeric_index</varname></link> + property. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>EnumPrint</enumidentifier> + <enumitemdescription> + Print enumeration values as numbers only, without their symbolic + label. For instance, <literal>INTEGER: forwarding(1)</literal> is + printed as <literal>INTEGER: 1</literal>. + Corresponds to the <literal>-Oe</literal> command-line option of + Net-<acronym>SNMP</acronym>, to <function>snmp_set_enum_print</function> + and to the + <link linkend="snmp.props.enum-print"><varname>SNMP::$enum_print</varname></link> + property. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>EscapeQuotes</enumidentifier> + <enumitemdescription> + Escape the quote characters in string table indexes. + For instance, <literal>vacmSecurityModel.0."wes"</literal> is printed + as <literal>vacmSecurityModel.0.\"wes\"</literal>. + Corresponds to the <literal>-OE</literal> command-line option of + Net-<acronym>SNMP</acronym> and to the + <link linkend="snmp.props.escape-quotes"><varname>SNMP::$escape_quotes</varname></link> + property. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>QuickPrint</enumidentifier> + <enumitemdescription> + Print only the value, without its type. + For instance, <literal>STRING: router</literal> is printed as + <literal>router</literal>. + Corresponds to the <literal>-Oq</literal> command-line option of + Net-<acronym>SNMP</acronym>, to <function>snmp_set_quick_print</function> + and to the + <link linkend="snmp.props.quick-print"><varname>SNMP::$quick_print</varname></link> + property. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>NumericTimeticks</enumidentifier> + <enumitemdescription> + Print <literal>TimeTicks</literal> values as raw numbers. + For instance, <literal>Timeticks: (14096763) 1 day, 15:09:27.63</literal> + is printed as <literal>14096763</literal>. + Corresponds to the <literal>-Ot</literal> command-line option of + Net-<acronym>SNMP</acronym> and to the + <link linkend="snmp.props.numeric-timeticks"><varname>SNMP::$numeric_timeticks</varname></link> + property. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>HexText</enumidentifier> + <enumitemdescription> + When a value is printed as a hexadecimal string, also print its + printable characters. + Corresponds to the <literal>-OT</literal> command-line option of + Net-<acronym>SNMP</acronym> and to the + <link linkend="snmp.props.print-hex-text"><varname>SNMP::$print_hex_text</varname></link> + property. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>DontPrintUnits</enumidentifier> + <enumitemdescription> + Do not append the <literal>UNITS</literal> defined in the + <acronym>MIB</acronym> to the value. + Corresponds to the <literal>-OU</literal> command-line option of + Net-<acronym>SNMP</acronym> and to the + <link linkend="snmp.props.dont-print-units"><varname>SNMP::$dont_print_units</varname></link> + property. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>ExtendedIndex</enumidentifier> + <enumitemdescription> + Print table indexes in square brackets, like array indexes. + For instance, <literal>ifDescr.1</literal> is printed as + <literal>ifDescr[1]</literal>. + Corresponds to the <literal>-OX</literal> command-line option of + Net-<acronym>SNMP</acronym> and to the + <link linkend="snmp.props.extended-index"><varname>SNMP::$extended_index</varname></link> + property. + </enumitemdescription> + </enumitem> + </enumsynopsis> + </packagesynopsis> + </section> + + <section xml:id="enum.snmp-output.seealso"> + &reftitle.seealso; + <simplelist> + <member><function>snmp_set_output_option</function></member> + <member><enumname>Snmp\StringOutput</enumname></member> + <member><enumname>Snmp\OidOutput</enumname></member> + </simplelist> + </section> + </partintro> +</reference> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/snmp.stringoutput.xml b/reference/snmp/snmp.stringoutput.xml new file mode 100644 index 000000000000..cd98ce85593f --- /dev/null +++ b/reference/snmp/snmp.stringoutput.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<reference xml:id="enum.snmp-stringoutput" role="enum" xmlns="http://docbook.org/ns/docbook"> + <title>The Snmp\StringOutput Enum</title> + <titleabbrev>Snmp\StringOutput</titleabbrev> + + <partintro> + <section xml:id="enum.snmp-stringoutput.intro"> + &reftitle.intro; + <simpara> + The <enumname>Snmp\StringOutput</enumname> enum lists the formats in + which the Net-<acronym>SNMP</acronym> library prints string values. + It is accepted by <function>snmp_set_string_output_format</function> and + <methodname>SNMP::setStringOutputFormat</methodname>. + </simpara> + <simpara> + The format only applies to string values whose <acronym>MIB</acronym> + object has no <literal>DISPLAY-HINT</literal>; values that have one are + always printed according to it. + </simpara> + </section> + + <section xml:id="enum.snmp-stringoutput.synopsis"> + &reftitle.enumsynopsis; + + <packagesynopsis> + <package>Snmp</package> + + <enumsynopsis> + <enumname>StringOutput</enumname> + + <enumitem> + <enumidentifier>Guess</enumidentifier> + <enumitemdescription> + Print the string as text if it is printable, and as a hexadecimal + string otherwise. This is the default. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>Ascii</enumidentifier> + <enumitemdescription> + Always print the string as text. + Corresponds to the <literal>-Oa</literal> command-line option of + Net-<acronym>SNMP</acronym>. + </enumitemdescription> + </enumitem> + + <enumitem> + <enumidentifier>Hex</enumidentifier> + <enumitemdescription> + Print the string as a hexadecimal string. + This is ignored when the object has a <literal>DISPLAY-HINT</literal>. + Corresponds to the <literal>-Ox</literal> command-line option of + Net-<acronym>SNMP</acronym>. + </enumitemdescription> + </enumitem> + </enumsynopsis> + </packagesynopsis> + </section> + + <section xml:id="enum.snmp-stringoutput.seealso"> + &reftitle.seealso; + <simplelist> + <member><function>snmp_set_string_output_format</function></member> + <member><methodname>SNMP::setStringOutputFormat</methodname></member> + <member><enumname>Snmp\Output</enumname></member> + </simplelist> + </section> + </partintro> +</reference> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/snmp.xml b/reference/snmp/snmp.xml index fe3c472de798..00dfa5e36ad8 100644 --- a/reference/snmp/snmp.xml +++ b/reference/snmp/snmp.xml @@ -125,6 +125,36 @@ <type>bool</type> <varname linkend="snmp.props.enum-print">enum_print</varname> </fieldsynopsis> + <fieldsynopsis> + <modifier>public</modifier> + <type>bool</type> + <varname linkend="snmp.props.numeric-index">numeric_index</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>public</modifier> + <type>bool</type> + <varname linkend="snmp.props.numeric-timeticks">numeric_timeticks</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>public</modifier> + <type>bool</type> + <varname linkend="snmp.props.extended-index">extended_index</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>public</modifier> + <type>bool</type> + <varname linkend="snmp.props.dont-print-units">dont_print_units</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>public</modifier> + <type>bool</type> + <varname linkend="snmp.props.escape-quotes">escape_quotes</varname> + </fieldsynopsis> + <fieldsynopsis> + <modifier>public</modifier> + <type>bool</type> + <varname linkend="snmp.props.print-hex-text">print_hex_text</varname> + </fieldsynopsis> <fieldsynopsis> <modifier>public</modifier> <type>int</type> @@ -150,6 +180,13 @@ <!-- {{{ SNMP properties --> <section xml:id="snmp.props"> &reftitle.properties; + <simpara> + The properties that control the output format take their initial values + from the settings in effect when the object is created, as set by + functions such as <function>snmp_set_output_option</function> and + <function>snmp_set_oid_output_format</function>. + Changing them only affects the requests of this session. + </simpara> <variablelist> <varlistentry xml:id="snmp.props.max-oids"> <term><varname>max_oids</varname></term> @@ -205,6 +242,73 @@ </simpara> </listitem> </varlistentry> + <varlistentry xml:id="snmp.props.numeric-index"> + <term><varname>numeric_index</varname></term> + <listitem> + <simpara>Controls whether table indexes are printed numerically</simpara> + <simpara> + When enabled, table indexes are printed numerically, instead of being + interpreted as strings or <acronym>OID</acronym>s. + See <constant>Snmp\Output::NumericIndex</constant>. + </simpara> + </listitem> + </varlistentry> + <varlistentry xml:id="snmp.props.numeric-timeticks"> + <term><varname>numeric_timeticks</varname></term> + <listitem> + <simpara>Controls whether <literal>TimeTicks</literal> values are printed as raw numbers</simpara> + <simpara> + When enabled, <literal>TimeTicks</literal> values are printed as raw + numbers, such as <literal>14096763</literal>, instead of + <literal>Timeticks: (14096763) 1 day, 15:09:27.63</literal>. + See <constant>Snmp\Output::NumericTimeticks</constant>. + </simpara> + </listitem> + </varlistentry> + <varlistentry xml:id="snmp.props.extended-index"> + <term><varname>extended_index</varname></term> + <listitem> + <simpara>Controls whether table indexes are printed in square brackets</simpara> + <simpara> + When enabled, table indexes are printed in square brackets, like + array indexes, such as <literal>IF-MIB::ifDescr[1]</literal>. + See <constant>Snmp\Output::ExtendedIndex</constant>. + </simpara> + </listitem> + </varlistentry> + <varlistentry xml:id="snmp.props.dont-print-units"> + <term><varname>dont_print_units</varname></term> + <listitem> + <simpara>Controls whether the units of the values are omitted</simpara> + <simpara> + When enabled, the <literal>UNITS</literal> defined in the + <acronym>MIB</acronym> are not appended to the values. + See <constant>Snmp\Output::DontPrintUnits</constant>. + </simpara> + </listitem> + </varlistentry> + <varlistentry xml:id="snmp.props.escape-quotes"> + <term><varname>escape_quotes</varname></term> + <listitem> + <simpara>Controls whether quotes in string table indexes are escaped</simpara> + <simpara> + When enabled, the quote characters in string table indexes are escaped + with a backslash. + See <constant>Snmp\Output::EscapeQuotes</constant>. + </simpara> + </listitem> + </varlistentry> + <varlistentry xml:id="snmp.props.print-hex-text"> + <term><varname>print_hex_text</varname></term> + <listitem> + <simpara>Controls whether the printable characters of hexadecimal strings are printed too</simpara> + <simpara> + When enabled, the values that are printed as hexadecimal strings are + followed by their printable characters. + See <constant>Snmp\Output::HexText</constant>. + </simpara> + </listitem> + </varlistentry> <varlistentry xml:id="snmp.props.oid-output-format"> <term><varname>oid_output_format</varname></term> <listitem> diff --git a/reference/snmp/snmp/setoidoutputformat.xml b/reference/snmp/snmp/setoidoutputformat.xml new file mode 100644 index 000000000000..81529ec017d6 --- /dev/null +++ b/reference/snmp/snmp/setoidoutputformat.xml @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xml:id="snmp.setoidoutputformat" xmlns="http://docbook.org/ns/docbook"> + <refnamediv> + <refname>SNMP::setOidOutputFormat</refname> + <refpurpose>Set the <acronym>OID</acronym> output format of the session</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis role="SNMP"> + <modifier>public</modifier> <type>bool</type><methodname>SNMP::setOidOutputFormat</methodname> + <methodparam><type>Snmp\OidOutput</type><parameter>format</parameter></methodparam> + </methodsynopsis> + <simpara> + Sets the format in which the <acronym>OID</acronym>s returned by the + requests of this session are printed, for instance in the keys of the + array returned by <methodname>SNMP::walk</methodname>. + </simpara> + <simpara> + This is the same as setting the + <link linkend="snmp.props.oid-output-format"><varname>SNMP::$oid_output_format</varname></link> + property to the corresponding + <constant>SNMP_OID_OUTPUT_<replaceable>*</replaceable></constant> + constant. It does not change the format used by the other sessions, nor by + functions such as <function>snmp2_real_walk</function>; use + <function>snmp_set_oid_output_format</function> for those. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>format</parameter></term> + <listitem> + <simpara> + The format to use. See <enumname>Snmp\OidOutput</enumname> for the + available formats. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + &return.true.always; + </simpara> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>Walking with numeric <acronym>OID</acronym>s</title> + <programlisting role="php" annotations="non-interactive"> +<![CDATA[ +<?php + +$session = new SNMP(SNMP::VERSION_2c, 'localhost', 'public'); +$session->setOidOutputFormat(Snmp\OidOutput::Numeric); + +var_dump($session->walk('IF-MIB::ifDescr')); + +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +array(2) { + [".1.3.6.1.2.1.2.2.1.2.1"]=> + string(10) "STRING: lo" + [".1.3.6.1.2.1.2.2.1.2.2"]=> + string(12) "STRING: eth0" +} +]]> + </screen> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><enumname>Snmp\OidOutput</enumname></member> + <member><methodname>SNMP::setStringOutputFormat</methodname></member> + <member><function>snmp_set_oid_output_format</function></member> + </simplelist> + </refsect1> +</refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/snmp/setstringoutputformat.xml b/reference/snmp/snmp/setstringoutputformat.xml new file mode 100644 index 000000000000..2d9680a38ba9 --- /dev/null +++ b/reference/snmp/snmp/setstringoutputformat.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xml:id="snmp.setstringoutputformat" xmlns="http://docbook.org/ns/docbook"> + <refnamediv> + <refname>SNMP::setStringOutputFormat</refname> + <refpurpose>Set the output format of string values of the session</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis role="SNMP"> + <modifier>public</modifier> <type>bool</type><methodname>SNMP::setStringOutputFormat</methodname> + <methodparam><type>Snmp\StringOutput</type><parameter>format</parameter></methodparam> + </methodsynopsis> + <simpara> + Sets the format in which the string values returned by the requests of + this session are printed. The format only applies to string values whose + <acronym>MIB</acronym> object has no <literal>DISPLAY-HINT</literal>. + </simpara> + <simpara> + It does not change the format used by the other sessions, nor by functions + such as <function>snmp2_get</function>; use + <function>snmp_set_string_output_format</function> for those. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>format</parameter></term> + <listitem> + <simpara> + The format to use. See <enumname>Snmp\StringOutput</enumname> for the + available formats. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + &return.true.always; + </simpara> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>Printing a binary string as text</title> + <programlisting role="php" annotations="non-interactive"> +<![CDATA[ +<?php + +$session = new SNMP(SNMP::VERSION_2c, 'localhost', 'public'); +$session->setStringOutputFormat(Snmp\StringOutput::Ascii); + +echo $session->get('SNMP-FRAMEWORK-MIB::snmpEngineID.0'), PHP_EOL; + +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +STRING: ".........&{.j...." +]]> + </screen> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><enumname>Snmp\StringOutput</enumname></member> + <member><methodname>SNMP::setOidOutputFormat</methodname></member> + <member><function>snmp_set_string_output_format</function></member> + </simplelist> + </refsect1> +</refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/snmp/versions.xml b/reference/snmp/versions.xml index f99430f7ae34..7d3db78573e7 100644 --- a/reference/snmp/versions.xml +++ b/reference/snmp/versions.xml @@ -4,11 +4,15 @@ <versions> <function name="snmp_get_quick_print" from="PHP 4, PHP 5, PHP 7, PHP 8"/> <function name="snmp_get_valueretrieval" from="PHP 4 &gt;= 4.3.3, PHP 5, PHP 7, PHP 8"/> + <function name="snmp_init_mib" from="PHP 8 &gt;= 8.6.0"/> <function name="snmp_read_mib" from="PHP 5, PHP 7, PHP 8"/> <function name="snmp_set_enum_print" from="PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8"/> + <function name="snmp_set_mib_option" from="PHP 8 &gt;= 8.6.0"/> <function name="snmp_set_oid_numeric_print" from="PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8"/> <function name="snmp_set_oid_output_format" from="PHP 5 &gt;= 5.2.0, PHP 7, PHP 8"/> + <function name="snmp_set_output_option" from="PHP 8 &gt;= 8.6.0"/> <function name="snmp_set_quick_print" from="PHP 4, PHP 5, PHP 7, PHP 8"/> + <function name="snmp_set_string_output_format" from="PHP 8 &gt;= 8.6.0"/> <function name="snmp_set_valueretrieval" from="PHP 4 &gt;= 4.3.3, PHP 5, PHP 7, PHP 8"/> <function name="snmpget" from="PHP 4, PHP 5, PHP 7, PHP 8"/> @@ -34,6 +38,8 @@ <function name="snmp::__construct" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8"/> <function name="snmp::close" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8"/> <function name="snmp::setSecurity" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8"/> + <function name="snmp::setOidOutputFormat" from="PHP 8 &gt;= 8.6.0"/> + <function name="snmp::setStringOutputFormat" from="PHP 8 &gt;= 8.6.0"/> <function name="snmp::get" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8"/> <function name="snmp::getnext" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8"/> <function name="snmp::walk" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8"/> @@ -43,6 +49,11 @@ <function name="snmpexception" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8"/> + <function name="snmp\mib" from="PHP 8 &gt;= 8.6.0"/> + <function name="snmp\oidoutput" from="PHP 8 &gt;= 8.6.0"/> + <function name="snmp\output" from="PHP 8 &gt;= 8.6.0"/> + <function name="snmp\stringoutput" from="PHP 8 &gt;= 8.6.0"/> + </versions> <!-- Keep this comment at the end of the file

« previous php.doc.cvs (#23997) next »