OSS_SNMP.SNMP.html 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <!DOCTYPE html><html xmlns:date="http://exslt.org/dates-and-times" lang="en">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  4. <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
  5. <meta charset="utf-8">
  6. <title>OSS_SNMP » \OSS_SNMP\SNMP</title>
  7. <meta name="author" content="Mike van Riel">
  8. <meta name="description" content="">
  9. <link href="../css/template.css" rel="stylesheet" media="all">
  10. <script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script><script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script><script src="../js/jquery.mousewheel.min.js" type="text/javascript"></script><script src="../js/bootstrap.js" type="text/javascript"></script><script src="../js/template.js" type="text/javascript"></script><script src="../js/prettify/prettify.min.js" type="text/javascript"></script><link rel="shortcut icon" href="../img/favicon.ico">
  11. <link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
  12. <link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
  13. <link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">
  14. </head>
  15. <body>
  16. <div class="navbar navbar-fixed-top">
  17. <div class="navbar-inner"><div class="container">
  18. <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a class="brand" href="../index.html">OSS_SNMP</a><div class="nav-collapse"><ul class="nav">
  19. <li class="dropdown">
  20. <a href="#api" class="dropdown-toggle" data-toggle="dropdown">
  21. API Documentation <b class="caret"></b></a><ul class="dropdown-menu">
  22. <li><a>Namespaces</a></li>
  23. <li><a href="../namespaces/OSS_SNMP.html"><i class="icon-th"></i> OSS_SNMP</a></li>
  24. </ul>
  25. </li>
  26. <li class="dropdown" id="charts-menu">
  27. <a href="#charts" class="dropdown-toggle" data-toggle="dropdown">
  28. Charts <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="../graph_class.html"><i class="icon-list-alt"></i> Class hierarchy diagram</a></li></ul>
  29. </li>
  30. <li class="dropdown" id="reports-menu">
  31. <a href="#reports" class="dropdown-toggle" data-toggle="dropdown">
  32. Reports <b class="caret"></b></a><ul class="dropdown-menu">
  33. <li><a href="../errors.html"><i class="icon-remove-sign"></i> Errors 
  34. <span class="label label-info">37</span></a></li>
  35. <li><a href="../markers.html"><i class="icon-map-marker"></i> Markers 
  36. <ul><li>todo 
  37. <span class="label label-info">1</span>
  38. </li></ul></a></li>
  39. <li><a href="../deprecated.html"><i class="icon-stop"></i> Deprecated elements 
  40. <span class="label label-info">0</span></a></li>
  41. </ul>
  42. </li>
  43. </ul></div>
  44. </div></div>
  45. <div class="go_to_top"><a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a></div>
  46. </div>
  47. <div id="___" class="container">
  48. <noscript><div class="alert alert-warning">
  49. Javascript is disabled; several features are only available
  50. if Javascript is enabled.
  51. </div></noscript>
  52. <div class="row">
  53. <div class="span4">
  54. <span class="btn-group visibility" data-toggle="buttons-checkbox"><button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button></span><div class="btn-group view pull-right" data-toggle="buttons-radio">
  55. <button class="btn details" title="Show descriptions and method names"><i class="icon-list"></i></button><button class="btn simple" title="Show only method names"><i class="icon-align-justify"></i></button>
  56. </div>
  57. <ul class="side-nav nav nav-list">
  58. <li class="nav-header">
  59. <i class="icon-custom icon-method"></i> Methods</li>
  60. <li class="method public "><a href="#__call" title="__call :: Magic method for generic function calls"><span class="description">Magic method for generic function calls</span><pre>__call()</pre></a></li>
  61. <li class="method public "><a href="#__construct" title="__construct :: The constructor."><span class="description">The constructor.</span><pre>__construct()</pre></a></li>
  62. <li class="method public "><a href="#cache" title="cache :: Query whether we are using the cache or not"><span class="description">Query whether we are using the cache or not</span><pre>cache()</pre></a></li>
  63. <li class="method public "><a href="#disableCache" title="disableCache :: Disable lookups of the local cache"><span class="description">Disable lookups of the local cache</span><pre>disableCache()</pre></a></li>
  64. <li class="method public "><a href="#enableCache" title="enableCache :: Enable lookups of the local cache"><span class="description">Enable lookups of the local cache</span><pre>enableCache()</pre></a></li>
  65. <li class="method public "><a href="#get" title="get :: Get a single SNMP value"><span class="description">Get a single SNMP value</span><pre>get()</pre></a></li>
  66. <li class="method public "><a href="#getCache" title="getCache :: Get the cache in use (or create a Cache\Basic instance"><span class="description">Get the cache in use (or create a Cache\Basic instance</span><pre>getCache()</pre></a></li>
  67. <li class="method public "><a href="#getCommunity" title="getCommunity :: Returns the community string currently in use."><span class="description">Returns the community string currently in use.</span><pre>getCommunity()</pre></a></li>
  68. <li class="method public "><a href="#getHost" title="getHost :: Returns the target host as currently configured for SNMP queries"><span class="description">Returns the target host as currently configured for SNMP queries</span><pre>getHost()</pre></a></li>
  69. <li class="method public "><a href="#getLastResult" title="getLastResult :: Returns the unaltered original last SNMP result"><span class="description">Returns the unaltered original last SNMP result</span><pre>getLastResult()</pre></a></li>
  70. <li class="method public "><a href="#getResultCache" title="getResultCache :: Returns the internal result cache"><span class="description">Returns the internal result cache</span><pre>getResultCache()</pre></a></li>
  71. <li class="method public "><a href="#getRetry" title="getRetry :: Returns the SNMP query retry count"><span class="description">Returns the SNMP query retry count</span><pre>getRetry()</pre></a></li>
  72. <li class="method public "><a href="#getTimeout" title="getTimeout :: Returns the SNMP query timeout (microseconds)."><span class="description">Returns the SNMP query timeout (microseconds).</span><pre>getTimeout()</pre></a></li>
  73. <li class="method public "><a href="#parseSnmpValue" title="parseSnmpValue :: Parse the result of an SNMP query into a PHP type"><span class="description">Parse the result of an SNMP query into a PHP type</span><pre>parseSnmpValue()</pre></a></li>
  74. <li class="method public "><a href="#ppTruthValue" title="ppTruthValue :: Utility function to convert TruthValue SNMP responses to true / false"><span class="description">Utility function to convert TruthValue SNMP responses to true / false</span><pre>ppTruthValue()</pre></a></li>
  75. <li class="method public "><a href="#realWalk" title="realWalk :: Proxy to the snmp2_real_walk command"><span class="description">Proxy to the snmp2_real_walk command</span><pre>realWalk()</pre></a></li>
  76. <li class="method public "><a href="#setCache" title="setCache :: Set the cache to use"><span class="description">Set the cache to use</span><pre>setCache()</pre></a></li>
  77. <li class="method public "><a href="#setCommunity" title="setCommunity :: Sets the community string to use for SNMP queries."><span class="description">Sets the community string to use for SNMP queries.</span><pre>setCommunity()</pre></a></li>
  78. <li class="method public "><a href="#setHost" title="setHost :: Sets the target host for SNMP queries."><span class="description">Sets the target host for SNMP queries.</span><pre>setHost()</pre></a></li>
  79. <li class="method public "><a href="#setOidOutputFormat" title="setOidOutputFormat :: Sets the output format for SNMP queries."><span class="description">Sets the output format for SNMP queries.</span><pre>setOidOutputFormat()</pre></a></li>
  80. <li class="method public "><a href="#setRetry" title="setRetry :: Sets the SNMP query retry count."><span class="description">Sets the SNMP query retry count.</span><pre>setRetry()</pre></a></li>
  81. <li class="method public "><a href="#setTimeout" title="setTimeout :: Sets the timeout to use for SNMP queries (microseconds)."><span class="description">Sets the timeout to use for SNMP queries (microseconds).</span><pre>setTimeout()</pre></a></li>
  82. <li class="method public "><a href="#subOidWalk" title="subOidWalk :: Get indexed SNMP values where the array key is the given position of the OID"><span class="description">Get indexed SNMP values where the array key is the given position of the OID</span><pre>subOidWalk()</pre></a></li>
  83. <li class="method public "><a href="#translate" title="translate :: Utility function to translate one value(s) to another via an associated array"><span class="description">Utility function to translate one value(s) to another via an associated array</span><pre>translate()</pre></a></li>
  84. <li class="method public "><a href="#useExtension" title="useExtension :: This is the MIB Extension magic"><span class="description">This is the MIB Extension magic</span><pre>useExtension()</pre></a></li>
  85. <li class="method public "><a href="#walk1d" title="walk1d :: Get indexed SNMP values (first degree)"><span class="description">Get indexed SNMP values (first degree)</span><pre>walk1d()</pre></a></li>
  86. <li class="nav-header">
  87. <i class="icon-custom icon-property"></i> Properties</li>
  88. <li class="property public "><a href="#%24SNMP_TRUTHVALUES" title="$SNMP_TRUTHVALUES :: "><span class="description">$SNMP_TRUTHVALUES</span><pre>$SNMP_TRUTHVALUES</pre></a></li>
  89. <li class="nav-header protected">» Protected</li>
  90. <li class="property protected "><a href="#%24_cache" title="$_cache :: "><span class="description">$_cache</span><pre>$_cache</pre></a></li>
  91. <li class="property protected "><a href="#%24_community" title="$_community :: "><span class="description">$_community</span><pre>$_community</pre></a></li>
  92. <li class="property protected "><a href="#%24_disableCache" title="$_disableCache :: "><span class="description">$_disableCache</span><pre>$_disableCache</pre></a></li>
  93. <li class="property protected "><a href="#%24_host" title="$_host :: "><span class="description">$_host</span><pre>$_host</pre></a></li>
  94. <li class="property protected "><a href="#%24_lastResult" title="$_lastResult :: "><span class="description">$_lastResult</span><pre>$_lastResult</pre></a></li>
  95. <li class="property protected "><a href="#%24_retry" title="$_retry :: "><span class="description">$_retry</span><pre>$_retry</pre></a></li>
  96. <li class="property protected "><a href="#%24_timeout" title="$_timeout :: "><span class="description">$_timeout</span><pre>$_timeout</pre></a></li>
  97. <li class="nav-header">
  98. <i class="icon-custom icon-constant"></i> Constants</li>
  99. <li class="constant "><a href="#OID_OUTPUT_FULL" title="OID_OUTPUT_FULL :: "><span class="description">OID_OUTPUT_FULL</span><pre>OID_OUTPUT_FULL</pre></a></li>
  100. <li class="constant "><a href="#OID_OUTPUT_NUMERIC" title="OID_OUTPUT_NUMERIC :: "><span class="description">OID_OUTPUT_NUMERIC</span><pre>OID_OUTPUT_NUMERIC</pre></a></li>
  101. <li class="constant "><a href="#SNMP_TRUTHVALUE_FALSE" title="SNMP_TRUTHVALUE_FALSE :: "><span class="description">SNMP_TRUTHVALUE_FALSE</span><pre>SNMP_TRUTHVALUE_FALSE</pre></a></li>
  102. <li class="constant "><a href="#SNMP_TRUTHVALUE_TRUE" title="SNMP_TRUTHVALUE_TRUE :: "><span class="description">SNMP_TRUTHVALUE_TRUE</span><pre>SNMP_TRUTHVALUE_TRUE</pre></a></li>
  103. </ul>
  104. </div>
  105. <div class="span8">
  106. <a name="%5COSS_SNMP%5CSNMP" id="\OSS_SNMP\SNMP"></a><ul class="breadcrumb">
  107. <li>
  108. <a href="../index.html"><i class="icon-custom icon-class"></i></a><span class="divider">\</span>
  109. </li>
  110. <li><a href="../namespaces/OSS_SNMP.html">OSS_SNMP</a></li>
  111. <li class="active">
  112. <span class="divider">\</span><a href="../classes/OSS_SNMP.SNMP.html">SNMP</a>
  113. </li>
  114. </ul>
  115. <div href="../classes/OSS_SNMP.SNMP.html" class="element class">
  116. <p class="short_description">A class for performing SNMP V2 queries and processing the results.</p>
  117. <div class="details">
  118. <p class="long_description"></p>
  119. <table class="table table-bordered">
  120. <tr>
  121. <th>copyright</th>
  122. <td>Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland</td>
  123. </tr>
  124. <tr>
  125. <th>author</th>
  126. <td><a href="mailto:barry@opensolutions.ie">Barry O'Donovan</a></td>
  127. </tr>
  128. </table>
  129. <h3>
  130. <i class="icon-custom icon-method"></i> Methods</h3>
  131. <a name="__call" id="__call"></a><div class="element clickable method public __call" data-toggle="collapse" data-target=".__call .collapse">
  132. <h2>Magic method for generic function calls</h2>
  133. <pre>__call(string $method, array $args) </pre>
  134. <div class="labels"></div>
  135. <div class="row collapse"><div class="detail-description">
  136. <p class="long_description"></p>
  137. <h3>Parameters</h3>
  138. <div class="subelement argument">
  139. <h4>$method</h4>
  140. <code>string</code>
  141. </div>
  142. <div class="subelement argument">
  143. <h4>$args</h4>
  144. <code>array</code>
  145. </div>
  146. <h3>Exceptions</h3>
  147. <table class="table table-bordered"><tr>
  148. <th><code><a href="http://php.net/manual/en/class.exception.php">\Exception</a></code></th>
  149. <td></td>
  150. </tr></table>
  151. </div></div>
  152. </div>
  153. <a name="__construct" id="__construct"></a><div class="element clickable method public __construct" data-toggle="collapse" data-target=".__construct .collapse">
  154. <h2>The constructor.</h2>
  155. <pre>__construct(string $host, string $community) : \OSS_SNMP</pre>
  156. <div class="labels"></div>
  157. <div class="row collapse"><div class="detail-description">
  158. <p class="long_description"></p>
  159. <h3>Parameters</h3>
  160. <div class="subelement argument">
  161. <h4>$host</h4>
  162. <code>string</code><p>The target host for SNMP queries.</p></div>
  163. <div class="subelement argument">
  164. <h4>$community</h4>
  165. <code>string</code><p>The community to use for SNMP queries.</p></div>
  166. <h3>Returns</h3>
  167. <div class="subelement response">
  168. <code>\OSS_SNMP</code>An instance of $this (for fluent interfaces)</div>
  169. </div></div>
  170. </div>
  171. <a name="cache" id="cache"></a><div class="element clickable method public cache" data-toggle="collapse" data-target=".cache .collapse">
  172. <h2>Query whether we are using the cache or not</h2>
  173. <pre>cache() : boolean</pre>
  174. <div class="labels"></div>
  175. <div class="row collapse"><div class="detail-description">
  176. <p class="long_description"></p>
  177. <h3>Returns</h3>
  178. <div class="subelement response">
  179. <code>boolean</code>True of the local lookup cache is enabled. Otherwise false.</div>
  180. </div></div>
  181. </div>
  182. <a name="disableCache" id="disableCache"></a><div class="element clickable method public disableCache" data-toggle="collapse" data-target=".disableCache .collapse">
  183. <h2>Disable lookups of the local cache</h2>
  184. <pre>disableCache() : <a href="http://php.net/manual/en/class.snmp.php">\SNMP</a></pre>
  185. <div class="labels"></div>
  186. <div class="row collapse"><div class="detail-description">
  187. <p class="long_description"></p>
  188. <h3>Returns</h3>
  189. <div class="subelement response">
  190. <code><a href="http://php.net/manual/en/class.snmp.php">\SNMP</a></code>An instance of this for fluent interfaces</div>
  191. </div></div>
  192. </div>
  193. <a name="enableCache" id="enableCache"></a><div class="element clickable method public enableCache" data-toggle="collapse" data-target=".enableCache .collapse">
  194. <h2>Enable lookups of the local cache</h2>
  195. <pre>enableCache() : <a href="http://php.net/manual/en/class.snmp.php">\SNMP</a></pre>
  196. <div class="labels"></div>
  197. <div class="row collapse"><div class="detail-description">
  198. <p class="long_description"></p>
  199. <h3>Returns</h3>
  200. <div class="subelement response">
  201. <code><a href="http://php.net/manual/en/class.snmp.php">\SNMP</a></code>An instance of this for fluent interfaces</div>
  202. </div></div>
  203. </div>
  204. <a name="get" id="get"></a><div class="element clickable method public get" data-toggle="collapse" data-target=".get .collapse">
  205. <h2>Get a single SNMP value</h2>
  206. <pre>get(string $oid) : mixed</pre>
  207. <div class="labels"></div>
  208. <div class="row collapse"><div class="detail-description">
  209. <p class="long_description"></p>
  210. <h3>Parameters</h3>
  211. <div class="subelement argument">
  212. <h4>$oid</h4>
  213. <code>string</code><p>The OID to get</p></div>
  214. <h3>Exceptions</h3>
  215. <table class="table table-bordered"><tr>
  216. <th><code><a href="../classes/OSS_SNMP.Exception.html">\OSS_SNMP\Exception</a></code></th>
  217. <td>On *any* SNMP error, warnings are supressed and a generic exception is thrown</td>
  218. </tr></table>
  219. <h3>Returns</h3>
  220. <div class="subelement response">
  221. <code>mixed</code>The resultant value</div>
  222. </div></div>
  223. </div>
  224. <a name="getCache" id="getCache"></a><div class="element clickable method public getCache" data-toggle="collapse" data-target=".getCache .collapse">
  225. <h2>Get the cache in use (or create a Cache\Basic instance</h2>
  226. <pre>getCache() : <a href="../classes/OSS_SNMP.Cache.html">\OSS_SNMP\Cache</a></pre>
  227. <div class="labels"></div>
  228. <div class="row collapse"><div class="detail-description">
  229. <p class="long_description"><p>We kind of mandate the use of a cache as the code is written with a cache in mind.
  230. You are free to disable it via disableCache() but your machines may be hammered!</p>
  231. <p>We would suggest disableCache() / enableCache() used in pairs only when really needed.</p></p>
  232. <h3>Returns</h3>
  233. <div class="subelement response">
  234. <code><a href="../classes/OSS_SNMP.Cache.html">\OSS_SNMP\Cache</a></code>The cache object</div>
  235. </div></div>
  236. </div>
  237. <a name="getCommunity" id="getCommunity"></a><div class="element clickable method public getCommunity" data-toggle="collapse" data-target=".getCommunity .collapse">
  238. <h2>Returns the community string currently in use.</h2>
  239. <pre>getCommunity() : string</pre>
  240. <div class="labels"></div>
  241. <div class="row collapse"><div class="detail-description">
  242. <p class="long_description"></p>
  243. <h3>Returns</h3>
  244. <div class="subelement response">
  245. <code>string</code>The community string currently in use.</div>
  246. </div></div>
  247. </div>
  248. <a name="getHost" id="getHost"></a><div class="element clickable method public getHost" data-toggle="collapse" data-target=".getHost .collapse">
  249. <h2>Returns the target host as currently configured for SNMP queries</h2>
  250. <pre>getHost() : string</pre>
  251. <div class="labels"></div>
  252. <div class="row collapse"><div class="detail-description">
  253. <p class="long_description"></p>
  254. <h3>Returns</h3>
  255. <div class="subelement response">
  256. <code>string</code>The target host as currently configured for SNMP queries</div>
  257. </div></div>
  258. </div>
  259. <a name="getLastResult" id="getLastResult"></a><div class="element clickable method public getLastResult" data-toggle="collapse" data-target=".getLastResult .collapse">
  260. <h2>Returns the unaltered original last SNMP result</h2>
  261. <pre>getLastResult() : mixed</pre>
  262. <div class="labels"></div>
  263. <div class="row collapse"><div class="detail-description">
  264. <p class="long_description"></p>
  265. <h3>Returns</h3>
  266. <div class="subelement response">
  267. <code>mixed</code>The unaltered original last SNMP result</div>
  268. </div></div>
  269. </div>
  270. <a name="getResultCache" id="getResultCache"></a><div class="element clickable method public getResultCache" data-toggle="collapse" data-target=".getResultCache .collapse">
  271. <h2>Returns the internal result cache</h2>
  272. <pre>getResultCache() : array</pre>
  273. <div class="labels"></div>
  274. <div class="row collapse"><div class="detail-description">
  275. <p class="long_description"></p>
  276. <h3>Returns</h3>
  277. <div class="subelement response">
  278. <code>array</code>The internal result cache</div>
  279. </div></div>
  280. </div>
  281. <a name="getRetry" id="getRetry"></a><div class="element clickable method public getRetry" data-toggle="collapse" data-target=".getRetry .collapse">
  282. <h2>Returns the SNMP query retry count</h2>
  283. <pre>getRetry() : string</pre>
  284. <div class="labels"></div>
  285. <div class="row collapse"><div class="detail-description">
  286. <p class="long_description"></p>
  287. <h3>Returns</h3>
  288. <div class="subelement response">
  289. <code>string</code>The SNMP query retry count</div>
  290. </div></div>
  291. </div>
  292. <a name="getTimeout" id="getTimeout"></a><div class="element clickable method public getTimeout" data-toggle="collapse" data-target=".getTimeout .collapse">
  293. <h2>Returns the SNMP query timeout (microseconds).</h2>
  294. <pre>getTimeout() : int</pre>
  295. <div class="labels"></div>
  296. <div class="row collapse"><div class="detail-description">
  297. <p class="long_description"></p>
  298. <h3>Returns</h3>
  299. <div class="subelement response">
  300. <code>int</code>The the SNMP query timeout (microseconds)</div>
  301. </div></div>
  302. </div>
  303. <a name="parseSnmpValue" id="parseSnmpValue"></a><div class="element clickable method public parseSnmpValue" data-toggle="collapse" data-target=".parseSnmpValue .collapse">
  304. <h2>Parse the result of an SNMP query into a PHP type</h2>
  305. <pre>parseSnmpValue(string $v) : mixed</pre>
  306. <div class="labels"></div>
  307. <div class="row collapse"><div class="detail-description">
  308. <p class="long_description"><p>For example, [STRING: "blah"] is parsed to a PHP string containing: blah</p></p>
  309. <h3>Parameters</h3>
  310. <div class="subelement argument">
  311. <h4>$v</h4>
  312. <code>string</code><p>The value to parse</p></div>
  313. <h3>Exceptions</h3>
  314. <table class="table table-bordered"><tr>
  315. <th><code><a href="http://php.net/manual/en/class.exception.php">\Exception</a></code></th>
  316. <td></td>
  317. </tr></table>
  318. <h3>Returns</h3>
  319. <div class="subelement response">
  320. <code>mixed</code>The parsed value</div>
  321. </div></div>
  322. </div>
  323. <a name="ppTruthValue" id="ppTruthValue"></a><div class="element clickable method public ppTruthValue" data-toggle="collapse" data-target=".ppTruthValue .collapse">
  324. <h2>Utility function to convert TruthValue SNMP responses to true / false</h2>
  325. <pre>ppTruthValue(integer $value) : boolean</pre>
  326. <div class="labels"></div>
  327. <div class="row collapse"><div class="detail-description">
  328. <p class="long_description"></p>
  329. <h3>Parameters</h3>
  330. <div class="subelement argument">
  331. <h4>$value</h4>
  332. <code>integer</code><p>The TruthValue ( 1 => true, 2 => false) to convert</p>
  333. </div>
  334. <h3>Returns</h3>
  335. <div class="subelement response"><code>boolean</code></div>
  336. </div></div>
  337. </div>
  338. <a name="realWalk" id="realWalk"></a><div class="element clickable method public realWalk" data-toggle="collapse" data-target=".realWalk .collapse">
  339. <h2>Proxy to the snmp2_real_walk command</h2>
  340. <pre>realWalk(string $oid) : array</pre>
  341. <div class="labels"></div>
  342. <div class="row collapse"><div class="detail-description">
  343. <p class="long_description"></p>
  344. <h3>Parameters</h3>
  345. <div class="subelement argument">
  346. <h4>$oid</h4>
  347. <code>string</code><p>The OID to walk</p></div>
  348. <h3>Returns</h3>
  349. <div class="subelement response">
  350. <code>array</code>The results of the walk</div>
  351. </div></div>
  352. </div>
  353. <a name="setCache" id="setCache"></a><div class="element clickable method public setCache" data-toggle="collapse" data-target=".setCache .collapse">
  354. <h2>Set the cache to use</h2>
  355. <pre>setCache(<a href="../classes/OSS_SNMP.Cache.html">\OSS_SNMP\Cache</a> $c) : <a href="../classes/OSS_SNMP.SNMP.html">\OSS_SNMP\SNMP</a></pre>
  356. <div class="labels"></div>
  357. <div class="row collapse"><div class="detail-description">
  358. <p class="long_description"></p>
  359. <h3>Parameters</h3>
  360. <div class="subelement argument">
  361. <h4>$c</h4>
  362. <code><a href="../classes/OSS_SNMP.Cache.html">\OSS_SNMP\Cache</a></code><p>The cache to use</p></div>
  363. <h3>Returns</h3>
  364. <div class="subelement response">
  365. <code><a href="../classes/OSS_SNMP.SNMP.html">\OSS_SNMP\SNMP</a></code>For fluent interfaces</div>
  366. </div></div>
  367. </div>
  368. <a name="setCommunity" id="setCommunity"></a><div class="element clickable method public setCommunity" data-toggle="collapse" data-target=".setCommunity .collapse">
  369. <h2>Sets the community string to use for SNMP queries.</h2>
  370. <pre>setCommunity(string $c) : \OSS_SNMP</pre>
  371. <div class="labels"></div>
  372. <div class="row collapse"><div class="detail-description">
  373. <p class="long_description"></p>
  374. <h3>Parameters</h3>
  375. <div class="subelement argument">
  376. <h4>$c</h4>
  377. <code>string</code><p>The community to use for SNMP queries.</p></div>
  378. <h3>Returns</h3>
  379. <div class="subelement response">
  380. <code>\OSS_SNMP</code>An instance of $this (for fluent interfaces)</div>
  381. </div></div>
  382. </div>
  383. <a name="setHost" id="setHost"></a><div class="element clickable method public setHost" data-toggle="collapse" data-target=".setHost .collapse">
  384. <h2>Sets the target host for SNMP queries.</h2>
  385. <pre>setHost(string $h) : <a href="../classes/OSS_SNMP.SNMP.html">\OSS_SNMP\SNMP</a></pre>
  386. <div class="labels"></div>
  387. <div class="row collapse"><div class="detail-description">
  388. <p class="long_description"></p>
  389. <h3>Parameters</h3>
  390. <div class="subelement argument">
  391. <h4>$h</h4>
  392. <code>string</code><p>The target host for SNMP queries.</p></div>
  393. <h3>Returns</h3>
  394. <div class="subelement response">
  395. <code><a href="../classes/OSS_SNMP.SNMP.html">\OSS_SNMP\SNMP</a></code>An instance of $this (for fluent interfaces)</div>
  396. </div></div>
  397. </div>
  398. <a name="setOidOutputFormat" id="setOidOutputFormat"></a><div class="element clickable method public setOidOutputFormat" data-toggle="collapse" data-target=".setOidOutputFormat .collapse">
  399. <h2>Sets the output format for SNMP queries.</h2>
  400. <pre>setOidOutputFormat(int $f) : <a href="../classes/OSS_SNMP.SNMP.html">\OSS_SNMP\SNMP</a></pre>
  401. <div class="labels"></div>
  402. <div class="row collapse"><div class="detail-description">
  403. <p class="long_description"><p>Should be one of the class OID_OUTPUT_* constants</p></p>
  404. <h3>Parameters</h3>
  405. <div class="subelement argument">
  406. <h4>$f</h4>
  407. <code>int</code><p>The fomat to use</p></div>
  408. <h3>Returns</h3>
  409. <div class="subelement response">
  410. <code><a href="../classes/OSS_SNMP.SNMP.html">\OSS_SNMP\SNMP</a></code>An instance of $this (for fluent interfaces)</div>
  411. </div></div>
  412. </div>
  413. <a name="setRetry" id="setRetry"></a><div class="element clickable method public setRetry" data-toggle="collapse" data-target=".setRetry .collapse">
  414. <h2>Sets the SNMP query retry count.</h2>
  415. <pre>setRetry(int $r) : \OSS_SNMP</pre>
  416. <div class="labels"></div>
  417. <div class="row collapse"><div class="detail-description">
  418. <p class="long_description"></p>
  419. <h3>Parameters</h3>
  420. <div class="subelement argument">
  421. <h4>$r</h4>
  422. <code>int</code><p>The SNMP query retry count</p></div>
  423. <h3>Returns</h3>
  424. <div class="subelement response">
  425. <code>\OSS_SNMP</code>An instance of $this (for fluent interfaces)</div>
  426. </div></div>
  427. </div>
  428. <a name="setTimeout" id="setTimeout"></a><div class="element clickable method public setTimeout" data-toggle="collapse" data-target=".setTimeout .collapse">
  429. <h2>Sets the timeout to use for SNMP queries (microseconds).</h2>
  430. <pre>setTimeout(int $t) : \OSS_SNMP</pre>
  431. <div class="labels"></div>
  432. <div class="row collapse"><div class="detail-description">
  433. <p class="long_description"></p>
  434. <h3>Parameters</h3>
  435. <div class="subelement argument">
  436. <h4>$t</h4>
  437. <code>int</code><p>The timeout to use for SNMP queries (microseconds).</p>
  438. </div>
  439. <h3>Returns</h3>
  440. <div class="subelement response">
  441. <code>\OSS_SNMP</code>An instance of $this (for fluent interfaces)</div>
  442. </div></div>
  443. </div>
  444. <a name="subOidWalk" id="subOidWalk"></a><div class="element clickable method public subOidWalk" data-toggle="collapse" data-target=".subOidWalk .collapse">
  445. <h2>Get indexed SNMP values where the array key is the given position of the OID</h2>
  446. <pre>subOidWalk(string $oid, int $position) : array</pre>
  447. <div class="labels"></div>
  448. <div class="row collapse"><div class="detail-description">
  449. <p class="long_description"><p>I.e. the following query with sample results:</p>
  450. <p>subOidWalk( '.1.3.6.1.4.1.9.9.23.1.2.1.1.9', 15 )</p>
  451. <pre><code> .1.3.6.1.4.1.9.9.23.1.2.1.1.9.10101.5 = Hex-STRING: 00 00 00 01
  452. .1.3.6.1.4.1.9.9.23.1.2.1.1.9.10105.2 = Hex-STRING: 00 00 00 01
  453. .1.3.6.1.4.1.9.9.23.1.2.1.1.9.10108.4 = Hex-STRING: 00 00 00 01
  454. </code></pre>
  455. <p>would yield an array:</p>
  456. <pre><code> 10101 =&gt; Hex-STRING: 00 00 00 01
  457. 10105 =&gt; Hex-STRING: 00 00 00 01
  458. 10108 =&gt; Hex-STRING: 00 00 00 01
  459. </code></pre></p>
  460. <h3>Parameters</h3>
  461. <div class="subelement argument">
  462. <h4>$oid</h4>
  463. <code>string</code><p>The OID to walk</p></div>
  464. <div class="subelement argument">
  465. <h4>$position</h4>
  466. <code>int</code><p>The position of the OID to use as the key</p></div>
  467. <h3>Exceptions</h3>
  468. <table class="table table-bordered"><tr>
  469. <th><code><a href="../classes/OSS_SNMP.Exception.html">\OSS_SNMP\Exception</a></code></th>
  470. <td>On *any* SNMP error, warnings are supressed and a generic exception is thrown</td>
  471. </tr></table>
  472. <h3>Returns</h3>
  473. <div class="subelement response">
  474. <code>array</code>The resultant values</div>
  475. </div></div>
  476. </div>
  477. <a name="translate" id="translate"></a><div class="element clickable method public translate" data-toggle="collapse" data-target=".translate .collapse">
  478. <h2>Utility function to translate one value(s) to another via an associated array</h2>
  479. <pre>translate(mixed $values, array $translator) : mixed</pre>
  480. <div class="labels"></div>
  481. <div class="row collapse"><div class="detail-description">
  482. <p class="long_description"><p>I.e. all elements '$value' will be replaced with $translator( $value ) where
  483. $translator is an associated array.</p>
  484. <p>Huh? Just read the code below!</p></p>
  485. <h3>Parameters</h3>
  486. <div class="subelement argument">
  487. <h4>$values</h4>
  488. <code>mixed</code><p>A scalar or array or values to translate</p></div>
  489. <div class="subelement argument">
  490. <h4>$translator</h4>
  491. <code>array</code><p>An associated array to use to translate the values</p></div>
  492. <h3>Returns</h3>
  493. <div class="subelement response">
  494. <code>mixed</code>The translated scalar or array</div>
  495. </div></div>
  496. </div>
  497. <a name="useExtension" id="useExtension"></a><div class="element clickable method public useExtension" data-toggle="collapse" data-target=".useExtension .collapse">
  498. <h2>This is the MIB Extension magic</h2>
  499. <pre>useExtension(string $mib, array $args) : \OSS_SNMP\MIBS</pre>
  500. <div class="labels"></div>
  501. <div class="row collapse"><div class="detail-description">
  502. <p class="long_description"><p>Calling $this->useXXX_YYY_ZZZ()->fn() will instantiate
  503. an extension MIB class is the given name and this $this SNMP
  504. instance and then call fn().</p>
  505. <p>See the examples for more information.</p></p>
  506. <h3>Parameters</h3>
  507. <div class="subelement argument">
  508. <h4>$mib</h4>
  509. <code>string</code><p>The extension class to use</p></div>
  510. <div class="subelement argument">
  511. <h4>$args</h4>
  512. <code>array</code>
  513. </div>
  514. <h3>Returns</h3>
  515. <div class="subelement response"><code>\OSS_SNMP\MIBS</code></div>
  516. </div></div>
  517. </div>
  518. <a name="walk1d" id="walk1d"></a><div class="element clickable method public walk1d" data-toggle="collapse" data-target=".walk1d .collapse">
  519. <h2>Get indexed SNMP values (first degree)</h2>
  520. <pre>walk1d(string $oid) : array</pre>
  521. <div class="labels"></div>
  522. <div class="row collapse"><div class="detail-description">
  523. <p class="long_description"><p>Walks the SNMP tree returning an array of key => value pairs.</p>
  524. <p>This is a first degree walk and it will throw an exception if there is more that one degree of values.</p>
  525. <p>I.e. the following query with sample results:</p>
  526. <p>walk1d( '.1.0.8802.1.1.2.1.3.7.1.4' )</p>
  527. <pre><code> .1.0.8802.1.1.2.1.3.7.1.4.1 = STRING: "GigabitEthernet1/0/1"
  528. .1.0.8802.1.1.2.1.3.7.1.4.2 = STRING: "GigabitEthernet1/0/2"
  529. .1.0.8802.1.1.2.1.3.7.1.4.3 = STRING: "GigabitEthernet1/0/3"
  530. .....
  531. </code></pre>
  532. <p>would yield an array:</p>
  533. <pre><code> 1 =&gt; GigabitEthernet1/0/1
  534. 2 =&gt; GigabitEthernet1/0/2
  535. 3 =&gt; GigabitEthernet1/0/3
  536. </code></pre></p>
  537. <h3>Parameters</h3>
  538. <div class="subelement argument">
  539. <h4>$oid</h4>
  540. <code>string</code><p>The OID to walk</p></div>
  541. <h3>Exceptions</h3>
  542. <table class="table table-bordered"><tr>
  543. <th><code>\OSS_SNMPException</code></th>
  544. <td>On *any* SNMP error, warnings are supressed and a generic exception is thrown</td>
  545. </tr></table>
  546. <h3>Returns</h3>
  547. <div class="subelement response">
  548. <code>array</code>The resultant values</div>
  549. </div></div>
  550. </div>
  551. <h3>
  552. <i class="icon-custom icon-property"></i> Properties</h3>
  553. <a name="%24SNMP_TRUTHVALUES" id="$SNMP_TRUTHVALUES"> </a><div class="element clickable property public $SNMP_TRUTHVALUES" data-toggle="collapse" data-target=".$SNMP_TRUTHVALUES .collapse">
  554. <h2>$SNMP_TRUTHVALUES</h2>
  555. <pre>$SNMP_TRUTHVALUES </pre>
  556. <div class="labels"></div>
  557. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  558. </div>
  559. <a name="%24_cache" id="$_cache"> </a><div class="element clickable property protected $_cache" data-toggle="collapse" data-target=".$_cache .collapse">
  560. <h2>$_cache</h2>
  561. <pre>$_cache </pre>
  562. <div class="labels"></div>
  563. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  564. </div>
  565. <a name="%24_community" id="$_community"> </a><div class="element clickable property protected $_community" data-toggle="collapse" data-target=".$_community .collapse">
  566. <h2>$_community</h2>
  567. <pre>$_community </pre>
  568. <div class="labels"></div>
  569. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  570. </div>
  571. <a name="%24_disableCache" id="$_disableCache"> </a><div class="element clickable property protected $_disableCache" data-toggle="collapse" data-target=".$_disableCache .collapse">
  572. <h2>$_disableCache</h2>
  573. <pre>$_disableCache </pre>
  574. <div class="labels"></div>
  575. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  576. </div>
  577. <a name="%24_host" id="$_host"> </a><div class="element clickable property protected $_host" data-toggle="collapse" data-target=".$_host .collapse">
  578. <h2>$_host</h2>
  579. <pre>$_host </pre>
  580. <div class="labels"></div>
  581. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  582. </div>
  583. <a name="%24_lastResult" id="$_lastResult"> </a><div class="element clickable property protected $_lastResult" data-toggle="collapse" data-target=".$_lastResult .collapse">
  584. <h2>$_lastResult</h2>
  585. <pre>$_lastResult </pre>
  586. <div class="labels"></div>
  587. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  588. </div>
  589. <a name="%24_retry" id="$_retry"> </a><div class="element clickable property protected $_retry" data-toggle="collapse" data-target=".$_retry .collapse">
  590. <h2>$_retry</h2>
  591. <pre>$_retry </pre>
  592. <div class="labels"></div>
  593. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  594. </div>
  595. <a name="%24_timeout" id="$_timeout"> </a><div class="element clickable property protected $_timeout" data-toggle="collapse" data-target=".$_timeout .collapse">
  596. <h2>$_timeout</h2>
  597. <pre>$_timeout </pre>
  598. <div class="labels"></div>
  599. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  600. </div>
  601. <h3>
  602. <i class="icon-custom icon-constant"></i> Constants</h3>
  603. <a name="OID_OUTPUT_FULL" id="OID_OUTPUT_FULL"> </a><div class="element clickable constant OID_OUTPUT_FULL" data-toggle="collapse" data-target=".OID_OUTPUT_FULL .collapse">
  604. <h2>OID_OUTPUT_FULL</h2>
  605. <pre>OID_OUTPUT_FULL </pre>
  606. <div class="labels"></div>
  607. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  608. </div>
  609. <a name="OID_OUTPUT_NUMERIC" id="OID_OUTPUT_NUMERIC"> </a><div class="element clickable constant OID_OUTPUT_NUMERIC" data-toggle="collapse" data-target=".OID_OUTPUT_NUMERIC .collapse">
  610. <h2>OID_OUTPUT_NUMERIC</h2>
  611. <pre>OID_OUTPUT_NUMERIC </pre>
  612. <div class="labels"></div>
  613. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  614. </div>
  615. <a name="SNMP_TRUTHVALUE_FALSE" id="SNMP_TRUTHVALUE_FALSE"> </a><div class="element clickable constant SNMP_TRUTHVALUE_FALSE" data-toggle="collapse" data-target=".SNMP_TRUTHVALUE_FALSE .collapse">
  616. <h2>SNMP_TRUTHVALUE_FALSE</h2>
  617. <pre>SNMP_TRUTHVALUE_FALSE </pre>
  618. <div class="labels"></div>
  619. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  620. </div>
  621. <a name="SNMP_TRUTHVALUE_TRUE" id="SNMP_TRUTHVALUE_TRUE"> </a><div class="element clickable constant SNMP_TRUTHVALUE_TRUE" data-toggle="collapse" data-target=".SNMP_TRUTHVALUE_TRUE .collapse">
  622. <h2>SNMP_TRUTHVALUE_TRUE</h2>
  623. <pre>SNMP_TRUTHVALUE_TRUE </pre>
  624. <div class="labels"></div>
  625. <div class="row collapse"><div class="detail-description"><p class="long_description"></p></div></div>
  626. </div>
  627. </div>
  628. </div>
  629. </div>
  630. </div>
  631. <div class="row"><footer class="span12">
  632. Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
  633. Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a5</a> and<br>
  634. generated on 2012-06-21T08:52:29+01:00.<br></footer></div>
  635. </div>
  636. </body>
  637. </html>