php-doc-en/reference/snmp/functions/snmp-set-valueretrieval.xml
2021-07-11 18:08:21 +03:00

140 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.snmp-set-valueretrieval" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>snmp_set_valueretrieval</refname>
<refpurpose>
Specify the method how the SNMP values will be returned
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>snmp_set_valueretrieval</methodname>
<methodparam><type>int</type><parameter>method</parameter></methodparam>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term>
<parameter>method</parameter>
</term>
<listitem>
<table>
<title>types</title>
<tgroup cols="2">
<tbody>
<row>
<entry>SNMP_VALUE_LIBRARY</entry>
<entry>The return values will be as returned by the Net-SNMP library.</entry>
</row>
<row>
<entry>SNMP_VALUE_PLAIN</entry>
<entry>The return values will be the plain value without the SNMP type hint.</entry>
</row>
<row>
<entry>SNMP_VALUE_OBJECT</entry>
<entry>
The return values will be objects with the properties <literal>value</literal> and <literal>type</literal>, where the latter
is one of the <constant>SNMP_OCTET_STR</constant>, <constant>SNMP_COUNTER</constant> etc. constants. The
way <literal>value</literal> is returned is based on which one of constants
<constant>SNMP_VALUE_LIBRARY</constant>, <constant>SNMP_VALUE_PLAIN</constant> is set.
</entry>
</row>
</tbody>
</tgroup>
</table>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Using
<function>snmp_set_valueretrieval</function>
</title>
<programlisting role="php">
<![CDATA[
<?php
snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// $ret = "STRING: lo"
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// $ret = "lo";
snmp_set_valueretrieval(SNMP_VALUE_OBJECT);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => lo
// )
snmp_set_valueretrieval(SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => lo
// )
snmp_set_valueretrieval(SNMP_VALUE_OBJECT | SNMP_VALUE_LIBRARY);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => STRING: lo
// )
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>snmp_get_valueretrieval</function>
</member>
<member><xref linkend="snmp.constants"/></member>
</simplelist>
</para>
</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
-->