-
Notifications
You must be signed in to change notification settings - Fork 7
/
snmp.php
1089 lines (1031 loc) · 39.4 KB
/
snmp.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// Start of snmp v.0.1
/**
* Represents SNMP session.
* @link http://php.net/manual/en/class.snmp.php
*/
class SNMP {
const VERSION_1 = 0;
const VERSION_2c = 1;
const VERSION_2C = 1;
const VERSION_3 = 3;
const ERRNO_NOERROR = 0;
const ERRNO_ANY = 126;
const ERRNO_GENERIC = 2;
const ERRNO_TIMEOUT = 4;
const ERRNO_ERROR_IN_REPLY = 8;
const ERRNO_OID_NOT_INCREASING = 16;
const ERRNO_OID_PARSING_ERROR = 32;
const ERRNO_MULTIPLE_SET_QUERIES = 64;
/**
* (PHP 5 >= 5.4.0)<br/>
* Creates SNMP instance representing session to remote SNMP agent
* @link http://php.net/manual/en/snmp.construct.php
* @param int $version <p>
* SNMP protocol version:
* <b>SNMP::VERSION_1</b>,
* <b>SNMP::VERSION_2C</b>,
* <b>SNMP::VERSION_3</b>.
* </p>
* @param string $hostname <p>
* The SNMP agent. <i>hostname</i> may be suffixed with
* optional SNMP agent port after colon. IPv6 addresses must be enclosed in square
* brackets if used with port. If FQDN is used for <i>hostname</i>
* it will be resolved by php-snmp library, not by Net-SNMP engine. Usage
* of IPv6 addresses when specifying FQDN may be forced by enclosing FQDN
* into square brackets. Here it is some examples:
* <table>
* <tr valign="top"><td>IPv4 with default port</td><td>127.0.0.1</td></tr>
* <tr valign="top"><td>IPv6 with default port</td><td>::1 or [::1]</td></tr>
* <tr valign="top"><td>IPv4 with specific port</td><td>127.0.0.1:1161</td></tr>
* <tr valign="top"><td>IPv6 with specific port</td><td>[::1]:1161</td></tr>
* <tr valign="top"><td>FQDN with default port</td><td>host.domain</td></tr>
* <tr valign="top"><td>FQDN with specific port</td><td>host.domain:1161</td></tr>
* <tr valign="top"><td>FQDN with default port, force usage of IPv6 address</td><td>[host.domain]</td></tr>
* <tr valign="top"><td>FQDN with specific port, force usage of IPv6 address</td><td>[host.domain]:1161</td></tr>
* </table>
* </p>
* @param string $community <p>The purpuse of <i>community</i> is
* SNMP version specific:</p>
* <table>
* <tr valign="top"><td>SNMP::VERSION_1</td><td>SNMP community</td></tr>
* <tr valign="top"><td>SNMP::VERSION_2C</td><td>SNMP community</td></tr>
* <tr valign="top"><td>SNMP::VERSION_3</td><td>SNMPv3 securityName</td></tr>
* </table>
* @param int $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param int $retries [optional] <p>
* The number of retries in case timeout occurs.
* </p>
*/
public function __construct ($version, $hostname, $community, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 5 >= 5.4.0)<br/>
* Close SNMP session
* @link http://php.net/manual/en/snmp.close.php
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function close () {}
/**
* (PHP 5 >= 5.4.0)<br/>
* Configures security-related SNMPv3 session parameters
* @link http://php.net/manual/en/snmp.setsecurity.php
* @param string $sec_level <p>
* the security level (noAuthNoPriv|authNoPriv|authPriv)
* </p>
* @param string $auth_protocol [optional] <p>
* the authentication protocol (MD5 or SHA)
* </p>
* @param string $priv_protocol [optional] <p>
* the privacy protocol (DES or AES)
* </p>
* @param string $contextName [optional] <p>
* the context name
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function setSecurity ($sec_level, $auth_protocol = '
stringauth_passphrase', $priv_protocol = '
stringpriv_passphrase', $contextName = '
stringcontextEngineID') {}
/**
* (PHP 5 >= 5.4.0)<br/>
* Fetch an SNMP object
* @link http://php.net/manual/en/snmp.get.php
* @param mixed $object_id <p>
* The SNMP object (OID) or objects
* </p>
* @param bool $preserve_keys [optional] <p>
* When <i>object_id</i> is a array and
* <i>preserve_keys</i> set to <b>TRUE</b> keys in results
* will be taken exactly as in <i>object_id</i>,
* otherwise SNMP::oid_output_format property is used to determinate
* the form of keys.
* </p>
* @return mixed SNMP objects requested as string or array
* depending on <i>object_id</i> type or <b>FALSE</b> on error.
*/
public function get ($object_id, $preserve_keys = false) {}
/**
* (PHP 5 >= 5.4.0)<br/>
* Fetch an SNMP object which
follows the given object id
* @link http://php.net/manual/en/snmp.getnext.php
* @param mixed $object_id <p>
* The SNMP object (OID) or objects
* </p>
* @return mixed SNMP objects requested as string or array
* depending on <i>object_id</i> type or <b>FALSE</b> on error.
*/
public function getnext ($object_id) {}
/**
* (PHP 5 >= 5.4.0)<br/>
* Fetch SNMP object subtree
* @link http://php.net/manual/en/snmp.walk.php
* @param string $object_id <p>
* Root of subtree to be fetched
* </p>
* @param bool $suffix_as_key [optional] <p>
* By default full OID notation is used for keys in output array.
* If set to <b>TRUE</b> subtree prefix will be removed from keys leaving only suffix of object_id.
* </p>
* @param int $max_repetitions [optional] <p>
* This specifies the maximum number of iterations over the repeating variables.
* The default is to use this value from SNMP object.
* </p>
* @param int $non_repeaters [optional] <p>
* This specifies the number of supplied variables that should not be iterated over.
* The default is to use this value from SNMP object.
* </p>
* @return array an associative array of the SNMP object ids and their values on success or <b>FALSE</b> on error.
* When a SNMP error occures <b>SNMP::getErrno</b> and
* <b>SNMP::getError</b> can be used for retrieving error
* number (specific to SNMP extension, see class constants) and error message
* respectively.
*/
public function walk ($object_id, $suffix_as_key = false, $max_repetitions = null, $non_repeaters = null) {}
/**
* (PHP 5 >= 5.4.0)<br/>
* Set the value of an SNMP object
* @link http://php.net/manual/en/snmp.set.php
* @param mixed $object_id <p>
* The SNMP object id
* </p>
* <p>
* When count of OIDs in object_id array is greater than
* max_oids object property set method will have to use multiple queries
* to perform requested value updates. In this case type and value checks
* are made per-chunk so second or subsequent requests may fail due to
* wrong type or value for OID requested. To mark this a warning is
* raised when count of OIDs in object_id array is greater than max_oids.
* </p>
* @param mixed $type The MIB defines the type of each object id. It has to be specified as a single character from the below list.
* </p>
* types
* <tr valign="top"><td>=</td><td>The type is taken from the MIB</td></tr>
* <tr valign="top"><td>i</td><td>INTEGER</td> </tr>
* <tr valign="top"><td>u</td><td>INTEGER</td></tr>
* <tr valign="top"><td>s</td><td>STRING</td></tr>
* <tr valign="top"><td>x</td><td>HEX STRING</td></tr>
* <tr valign="top"><td>d</td><td>DECIMAL STRING</td></tr>
* <tr valign="top"><td>n</td><td>NULLOBJ</td></tr>
* <tr valign="top"><td>o</td><td>OBJID</td></tr>
* <tr valign="top"><td>t</td><td>TIMETICKS</td></tr>
* <tr valign="top"><td>a</td><td>IPADDRESS</td></tr>
* <tr valign="top"><td>b</td><td>BITS</td></tr>
* </table>
* If <b>OPAQUE_SPECIAL_TYPES</b> was defined while compiling the SNMP library, the following are also valid:
* </p>
* types
* <tr valign="top"><td>U</td><td>unsigned int64</td></tr>
* <tr valign="top"><td>I</td><td>signed int64</td></tr>
* <tr valign="top"><td>F</td><td>float</td></tr>
* <tr valign="top"><td>D</td><td>double</td></tr>
* </table>
* Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and
* the 'u' unsigned type is also used for handling Gauge32 values.
* </p>
* If the MIB-Files are loaded by into the MIB Tree with "snmp_read_mib" or by specifying it in the libsnmp config, '=' may be used as
* the <i>type</i> parameter for all object ids as the type can then be automatically read from the MIB.
* </p>
* Note that there are two ways to set a variable of the type BITS like e.g.
* "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}":
* </p>
* Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8.
* Using type "x" and a hex number but without(!) the usual "0x" prefix.
* See examples section for more details.
* </p>
* @param mixed $value <p>
* The new value.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function set ($object_id, $type, $value) {}
/**
* (PHP 5 >= 5.4.0)<br/>
* Get last error code
* @link http://php.net/manual/en/snmp.geterrno.php
* @return int one of SNMP error code values described in constants chapter.
*/
public function getErrno () {}
/**
* (PHP 5 >= 5.4.0)<br/>
* Get last error message
* @link http://php.net/manual/en/snmp.geterror.php
* @return string String describing error from last SNMP request.
*/
public function getError () {}
}
/**
* Represents an error raised by SNMP. You should not throw a
* <b>SNMPException</b> from your own code.
* See Exceptions for more
* information about Exceptions in PHP.
* @link http://php.net/manual/en/class.snmpexception.php
*/
class SNMPException extends RuntimeException {
protected $message;
protected $code;
protected $file;
protected $line;
/**
* (PHP 5 >= 5.1.0)<br/>
* Clone the exception
* @link http://php.net/manual/en/exception.clone.php
* @return void No value is returned.
*/
final private function __clone () {}
/**
* (PHP 5 >= 5.1.0)<br/>
* Construct the exception
* @link http://php.net/manual/en/exception.construct.php
* @param string $message [optional] <p>
* The Exception message to throw.
* </p>
* @param int $code [optional] <p>
* The Exception code.
* </p>
* @param Exception $previous [optional] <p>
* The previous exception used for the exception chaining.
* </p>
*/
public function __construct ($message = "", $code = 0, Exception $previous = null) {}
/**
* (PHP 5 >= 5.1.0)<br/>
* Gets the Exception message
* @link http://php.net/manual/en/exception.getmessage.php
* @return string the Exception message as a string.
*/
final public function getMessage () {}
/**
* (PHP 5 >= 5.1.0)<br/>
* Gets the Exception code
* @link http://php.net/manual/en/exception.getcode.php
* @return mixed the exception code as integer in
* <b>Exception</b> but possibly as other type in
* <b>Exception</b> descendants (for example as
* string in <b>PDOException</b>).
*/
final public function getCode () {}
/**
* (PHP 5 >= 5.1.0)<br/>
* Gets the file in which the exception occurred
* @link http://php.net/manual/en/exception.getfile.php
* @return string the filename in which the exception was created.
*/
final public function getFile () {}
/**
* (PHP 5 >= 5.1.0)<br/>
* Gets the line in which the exception occurred
* @link http://php.net/manual/en/exception.getline.php
* @return int the line number where the exception was created.
*/
final public function getLine () {}
/**
* (PHP 5 >= 5.1.0)<br/>
* Gets the stack trace
* @link http://php.net/manual/en/exception.gettrace.php
* @return array the Exception stack trace as an array.
*/
final public function getTrace () {}
/**
* (PHP 5 >= 5.3.0)<br/>
* Returns previous Exception
* @link http://php.net/manual/en/exception.getprevious.php
* @return Exception the previous <b>Exception</b> if available
* or <b>NULL</b> otherwise.
*/
final public function getPrevious () {}
/**
* (PHP 5 >= 5.1.0)<br/>
* Gets the stack trace as a string
* @link http://php.net/manual/en/exception.gettraceasstring.php
* @return string the Exception stack trace as a string.
*/
final public function getTraceAsString () {}
/**
* (PHP 5 >= 5.1.0)<br/>
* String representation of the exception
* @link http://php.net/manual/en/exception.tostring.php
* @return string the string representation of the exception.
*/
public function __toString () {}
}
/**
* (PHP 4, PHP 5)<br/>
* Fetch an SNMP object
* @link http://php.net/manual/en/function.snmpget.php
* @param string $hostname <p>
* The SNMP agent.
* </p>
* @param string $community <p>
* The read community.
* </p>
* @param string $object_id <p>
* The SNMP object.
* </p>
* @param int $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param int $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return string SNMP object value on success or <b>FALSE</b> on error.
*/
function snmpget ($hostname, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 5)<br/>
* Fetch the SNMP object which follows the given object id
* @link http://php.net/manual/en/function.snmpgetnext.php
* @param string $host <p>The hostname of the SNMP agent (server).</p>
* @param string $community <p>The read community.</p>
* @param string $object_id <p>The SNMP object id which precedes the wanted one.</p>
* @param int $timeout [optional] <p>The number of microseconds until the first timeout.</p>
* @param int $retries [optional] <p>The number of times to retry if timeouts occur.</p>
* @return string SNMP object value on success or <b>FALSE</b> on error.
* In case of an error, an E_WARNING message is shown.
*/
function snmpgetnext ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4, PHP 5)<br/>
* Fetch all the SNMP objects from an agent
* @link http://php.net/manual/en/function.snmpwalk.php
* @param string $hostname <p>
* The SNMP agent (server).
* </p>
* @param string $community <p>
* The read community.
* </p>
* @param string $object_id <p>
* If <b>NULL</b>, <i>object_id</i> is taken as the root of
* the SNMP objects tree and all objects under that tree are returned as
* an array.
* </p>
* <p>
* If <i>object_id</i> is specified, all the SNMP objects
* below that <i>object_id</i> are returned.
* </p>
* @param int $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param int $retries [optional] <p>The number of times to retry if timeouts occur.</p>
* @return array an array of SNMP object values starting from the
* <i>object_id</i> as root or <b>FALSE</b> on error.
*/
function snmpwalk ($hostname, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4, PHP 5)<br/>
* Return all objects including their respective object ID within the specified one
* @link http://php.net/manual/en/function.snmprealwalk.php
* @param string $host <p>The hostname of the SNMP agent (server).</p>
* @param string $community <p>The read community.</p>
* @param string $object_id <p>The SNMP object id which precedes the wanted one.</p>
* @param int $timeout [optional] <p>The number of microseconds until the first timeout.</p>
* @param int $retries [optional] <p>The number of times to retry if timeouts occur.</p>
* @return array an associative array of the SNMP object ids and their values on success or <b>FALSE</b> on error.
* In case of an error, an E_WARNING message is shown.
*/
function snmprealwalk ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4, PHP 5)<br/>
* Query for a tree of information about a network entity
* @link http://php.net/manual/en/function.snmpwalkoid.php
* @param string $hostname <p>
* The SNMP agent.
* </p>
* @param string $community <p>
* The read community.
* </p>
* @param string $object_id <p>
* If <b>NULL</b>, <i>object_id</i> is taken as the root of
* the SNMP objects tree and all objects under that tree are returned as
* an array.
* </p>
* <p>
* If <i>object_id</i> is specified, all the SNMP objects
* below that <i>object_id</i> are returned.
* </p>
* @param int $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param int $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return array an associative array with object ids and their respective
* object value starting from the <i>object_id</i>
* as root or <b>FALSE</b> on error.
*/
function snmpwalkoid ($hostname, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4, PHP 5)<br/>
* Set the value of an SNMP object
* @link http://php.net/manual/en/function.snmpset.php
* @param string $host <p>
* The hostname of the SNMP agent (server).
* </p>
* @param string $community <p>
* The write community.
* </p>
* @param string $object_id <p>
* The SNMP object id.
* </p>
* @param string $type The MIB defines the type of each object id. It has to be specified as a single character from the below list.
* </p>
* types
* <tr valign="top"><td>=</td><td>The type is taken from the MIB</td></tr>
* <tr valign="top"><td>i</td><td>INTEGER</td> </tr>
* <tr valign="top"><td>u</td><td>INTEGER</td></tr>
* <tr valign="top"><td>s</td><td>STRING</td></tr>
* <tr valign="top"><td>x</td><td>HEX STRING</td></tr>
* <tr valign="top"><td>d</td><td>DECIMAL STRING</td></tr>
* <tr valign="top"><td>n</td><td>NULLOBJ</td></tr>
* <tr valign="top"><td>o</td><td>OBJID</td></tr>
* <tr valign="top"><td>t</td><td>TIMETICKS</td></tr>
* <tr valign="top"><td>a</td><td>IPADDRESS</td></tr>
* <tr valign="top"><td>b</td><td>BITS</td></tr>
* </table>
* If <b>OPAQUE_SPECIAL_TYPES</b> was defined while compiling the SNMP library, the following are also valid:
* </p>
* types
* <tr valign="top"><td>U</td><td>unsigned int64</td></tr>
* <tr valign="top"><td>I</td><td>signed int64</td></tr>
* <tr valign="top"><td>F</td><td>float</td></tr>
* <tr valign="top"><td>D</td><td>double</td></tr>
* </table>
* Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and
* the 'u' unsigned type is also used for handling Gauge32 values.
* </p>
* If the MIB-Files are loaded by into the MIB Tree with "snmp_read_mib" or by specifying it in the libsnmp config, '=' may be used as
* the <i>type</i> parameter for all object ids as the type can then be automatically read from the MIB.
* </p>
* Note that there are two ways to set a variable of the type BITS like e.g.
* "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}":
* </p>
* Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8.
* Using type "x" and a hex number but without(!) the usual "0x" prefix.
* See examples section for more details.
* </p>
* @param mixed $value <p>
* The new value.
* </p>
* @param int $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param int $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
* </p>
* <p>
* If the SNMP host rejects the data type, an E_WARNING message like "Warning: Error in packet. Reason: (badValue) The value given has the wrong type or length." is shown.
* If an unknown or invalid OID is specified the warning probably reads "Could not add variable".
*/
function snmpset ($host, $community, $object_id, $type, $value, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4, PHP 5)<br/>
* Fetches the current value of the UCD library's quick_print setting
* @link http://php.net/manual/en/function.snmp-get-quick-print.php
* @param $d
* @return bool <b>TRUE</b> if quick_print is on, <b>FALSE</b> otherwise.
*/
function snmp_get_quick_print ($d) {}
/**
* (PHP 4, PHP 5)<br/>
* Set the value of <i>quick_print</i> within the UCD SNMP library
* @link http://php.net/manual/en/function.snmp-set-quick-print.php
* @param bool $quick_print
* @return bool No value is returned.
*/
function snmp_set_quick_print ($quick_print) {}
/**
* (PHP 4 >= 4.3.0, PHP 5)<br/>
* Return all values that are enums with their enum value instead of the raw integer
* @link http://php.net/manual/en/function.snmp-set-enum-print.php
* @param int $enum_print <p>
* As the value is interpreted as boolean by the Net-SNMP library, it can only be "0" or "1".
* </p>
* @return bool
*/
function snmp_set_enum_print ($enum_print) {}
/**
* (PHP 5 >= 5.2.0)<br/>
* Set the OID output format
* @link http://php.net/manual/en/function.snmp-set-oid-output-format.php
* @param int $oid_format [optional] <table>
* OID .1.3.6.1.2.1.1.3.0 representation for various <i>oid_format</i> values
* <tr valign="top"><td><b>SNMP_OID_OUTPUT_FULL</b></td><td>.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.sysUpTimeInstance</td></tr>
* <tr valign="top"><td><b>SNMP_OID_OUTPUT_NUMERIC</b></td><td>.1.3.6.1.2.1.1.3.0</td> </tr>
* </table>
* <p>Begining from PHP 5.4.0 four additional constants available:
* <table>
* <tr valign="top"><td><b>SNMP_OID_OUTPUT_MODULE</b></td><td>DISMAN-EVENT-MIB::sysUpTimeInstance</td></tr>
* <tr valign="top"><td><b>SNMP_OID_OUTPUT_SUFFIX</b></td><td>sysUpTimeInstance</td></tr>
* <tr valign="top"><td><b>SNMP_OID_OUTPUT_UCD</b></td><td>system.sysUpTime.sysUpTimeInstance</td></tr>
* <tr valign="top"><td><b>SNMP_OID_OUTPUT_NONE</b></td><td>Undefined</td></tr>
* </table>
* </p>
* @return bool No value is returned.
*/
function snmp_set_oid_output_format ($oid_format = 'SNMP_OID_OUTPUT_MODULE') {}
/**
* (PHP 4 >= 4.3.0, PHP 5)<br/>
* Set the OID output format
* @link http://php.net/manual/en/function.snmp-set-oid-numeric-print.php
* @param int $oid_format
* @return void
*/
function snmp_set_oid_numeric_print ($oid_format) {}
/**
* (PHP 5 >= 5.2.0)<br/>
* Fetch an SNMP object
* @link http://php.net/manual/en/function.snmp2-get.php
* @param string $host <p>
* The SNMP agent.
* </p>
* @param string $community <p>
* The read community.
* </p>
* @param string $object_id <p>
* The SNMP object.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return string SNMP object value on success or <b>FALSE</b> on error.
*/
function snmp2_get ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP >= 5.2.0)<br/>
* Fetch the SNMP object which follows the given object id
* @link http://php.net/manual/en/function.snmp2-getnext.php
* @param string $host <p>
* The hostname of the SNMP agent (server).
* </p>
* @param string $community <p>
* The read community.
* </p>
* @param string $object_id <p>
* The SNMP object id which precedes the wanted one.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return string SNMP object value on success or <b>FALSE</b> on error.
* In case of an error, an E_WARNING message is shown.
*/
function snmp2_getnext ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP >= 5.2.0)<br/>
* Fetch all the SNMP objects from an agent
* @link http://php.net/manual/en/function.snmp2-walk.php
* @param string $host <p>
* The SNMP agent (server).
* </p>
* @param string $community <p>
* The read community.
* </p>
* @param string $object_id <p>
* If <b>NULL</b>, <i>object_id</i> is taken as the root of
* the SNMP objects tree and all objects under that tree are returned as
* an array.
* </p>
* <p>
* If <i>object_id</i> is specified, all the SNMP objects
* below that <i>object_id</i> are returned.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return array an array of SNMP object values starting from the
* <i>object_id</i> as root or <b>FALSE</b> on error.
*/
function snmp2_walk ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP >= 5.2.0)<br/>
* Return all objects including their respective object ID within the specified one
* @link http://php.net/manual/en/function.snmp2-real-walk.php
* @param string $host <p>
* The hostname of the SNMP agent (server).
* </p>
* @param string $community <p>
* The read community.
* </p>
* @param string $object_id <p>
* The SNMP object id which precedes the wanted one.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return array an associative array of the SNMP object ids and their values on success or <b>FALSE</b> on error.
* In case of an error, an E_WARNING message is shown.
*/
function snmp2_real_walk ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP >= 5.2.0)<br/>
* Set the value of an SNMP object
* @link http://php.net/manual/en/function.snmp2-set.php
* @param string $host <p>
* The hostname of the SNMP agent (server).
* </p>
* @param string $community <p>
* The write community.
* </p>
* @param string $object_id <p>
* The SNMP object id.
* </p>
* @param string $type The MIB defines the type of each object id. It has to be specified as a single character from the below list.
* </p>
* types
* <tr valign="top"><td>=</td><td>The type is taken from the MIB</td></tr>
* <tr valign="top"><td>i</td><td>INTEGER</td> </tr>
* <tr valign="top"><td>u</td><td>INTEGER</td></tr>
* <tr valign="top"><td>s</td><td>STRING</td></tr>
* <tr valign="top"><td>x</td><td>HEX STRING</td></tr>
* <tr valign="top"><td>d</td><td>DECIMAL STRING</td></tr>
* <tr valign="top"><td>n</td><td>NULLOBJ</td></tr>
* <tr valign="top"><td>o</td><td>OBJID</td></tr>
* <tr valign="top"><td>t</td><td>TIMETICKS</td></tr>
* <tr valign="top"><td>a</td><td>IPADDRESS</td></tr>
* <tr valign="top"><td>b</td><td>BITS</td></tr>
* </table>
* If <b>OPAQUE_SPECIAL_TYPES</b> was defined while compiling the SNMP library, the following are also valid:
* </p>
* types
* <tr valign="top"><td>U</td><td>unsigned int64</td></tr>
* <tr valign="top"><td>I</td><td>signed int64</td></tr>
* <tr valign="top"><td>F</td><td>float</td></tr>
* <tr valign="top"><td>D</td><td>double</td></tr>
* </table>
* Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and
* the 'u' unsigned type is also used for handling Gauge32 values.
* </p>
* If the MIB-Files are loaded by into the MIB Tree with "snmp_read_mib" or by specifying it in the libsnmp config, '=' may be used as
* the <i>type</i> parameter for all object ids as the type can then be automatically read from the MIB.
* </p>
* Note that there are two ways to set a variable of the type BITS like e.g.
* "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}":
* </p>
* Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8.
* Using type "x" and a hex number but without(!) the usual "0x" prefix.
* See examples section for more details.
* </p>
* @param string $value <p>
* The new value.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
* </p>
* <p>
* If the SNMP host rejects the data type, an E_WARNING message like "Warning: Error in packet. Reason: (badValue) The value given has the wrong type or length." is shown.
* If an unknown or invalid OID is specified the warning probably reads "Could not add variable".
*/
function snmp2_set ($host, $community, $object_id, $type, $value, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4, PHP 5)<br/>
* Fetch an SNMP object
* @link http://php.net/manual/en/function.snmp3-get.php
* @param string $host <p>
* The hostname of the SNMP agent (server).
* </p>
* @param string $sec_name <p>
* the security name, usually some kind of username
* </p>
* @param string $sec_level <p>
* the security level (noAuthNoPriv|authNoPriv|authPriv)
* </p>
* @param string $auth_protocol <p>
* the authentication protocol (MD5 or SHA)
* </p>
* @param string $auth_passphrase <p>
* the authentication pass phrase
* </p>
* @param string $priv_protocol <p>
* the privacy protocol (DES or AES)
* </p>
* @param string $priv_passphrase <p>
* the privacy pass phrase
* </p>
* @param string $object_id <p>
* The SNMP object id.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return string SNMP object value on success or <b>FALSE</b> on error.
*/
function snmp3_get ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 5)<br/>
* Fetch the SNMP object which follows the given object id
* @link http://php.net/manual/en/function.snmp3-getnext.php
* @param string $host <p>
* The hostname of the
* SNMP agent (server).
* </p>
* @param string $sec_name <p>
* the security name, usually some kind of username
* </p>
* @param string $sec_level <p>
* the security level (noAuthNoPriv|authNoPriv|authPriv)
* </p>
* @param string $auth_protocol <p>
* the authentication protocol (MD5 or SHA)
* </p>
* @param string $auth_passphrase <p>
* the authentication pass phrase
* </p>
* @param string $priv_protocol <p>
* the privacy protocol (DES or AES)
* </p>
* @param string $priv_passphrase <p>
* the privacy pass phrase
* </p>
* @param string $object_id <p>
* The SNMP object id.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return string SNMP object value on success or <b>FALSE</b> on error.
* In case of an error, an E_WARNING message is shown.
*/
function snmp3_getnext ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4, PHP 5)<br/>
* Fetch all the SNMP objects from an agent
* @link http://php.net/manual/en/function.snmp3-walk.php
* @param string $host <p>
* The hostname of the SNMP agent (server).
* </p>
* @param string $sec_name <p>
* the security name, usually some kind of username
* </p>
* @param string $sec_level <p>
* the security level (noAuthNoPriv|authNoPriv|authPriv)
* </p>
* @param string $auth_protocol <p>
* the authentication protocol (MD5 or SHA)
* </p>
* @param string $auth_passphrase <p>
* the authentication pass phrase
* </p>
* @param string $priv_protocol <p>
* the privacy protocol (DES or AES)
* </p>
* @param string $priv_passphrase <p>
* the privacy pass phrase
* </p>
* @param string $object_id <p>
* If <b>NULL</b>, <i>object_id</i> is taken as the root of
* the SNMP objects tree and all objects under that tree are returned as
* an array.
* </p>
* <p>
* If <i>object_id</i> is specified, all the SNMP objects
* below that <i>object_id</i> are returned.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return array an array of SNMP object values starting from the
* <i>object_id</i> as root or <b>FALSE</b> on error.
*/
function snmp3_walk ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4, PHP 5)<br/>
* Return all objects including their respective object ID within the specified one
* @link http://php.net/manual/en/function.snmp3-real-walk.php
* @param string $host <p>
* The hostname of the
* SNMP agent (server).
* </p>
* @param string $sec_name <p>
* the security name, usually some kind of username
* </p>
* @param string $sec_level <p>
* the security level (noAuthNoPriv|authNoPriv|authPriv)
* </p>
* @param string $auth_protocol <p>
* the authentication protocol (MD5 or SHA)
* </p>
* @param string $auth_passphrase <p>
* the authentication pass phrase
* </p>
* @param string $priv_protocol <p>
* the privacy protocol (DES or AES)
* </p>
* @param string $priv_passphrase <p>
* the privacy pass phrase
* </p>
* @param string $object_id <p>
* The SNMP object id.
* </p>
* @param string $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param string $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return array an associative array of the
* SNMP object ids and their values on success or <b>FALSE</b> on error.
* In case of an error, an E_WARNING message is shown.
*/
function snmp3_real_walk ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $timeout = null, $retries = null) {}
/**
* (PHP 4, PHP 5)<br/>
* Set the value of an SNMP object
* @link http://php.net/manual/en/function.snmp3-set.php
* @param string $host <p>
* The hostname of the SNMP agent (server).
* </p>
* @param string $sec_name <p>
* the security name, usually some kind of username
* </p>
* @param string $sec_level <p>
* the security level (noAuthNoPriv|authNoPriv|authPriv)
* </p>
* @param string $auth_protocol <p>
* the authentication protocol (MD5 or SHA)
* </p>
* @param string $auth_passphrase <p>
* the authentication pass phrase
* </p>
* @param string $priv_protocol <p>
* the privacy protocol (DES or AES)
* </p>
* @param string $priv_passphrase <p>
* the privacy pass phrase
* </p>
* @param string $object_id <p>
* The SNMP object id.
* </p>
* @param string $type The MIB defines the type of each object id. It has to be specified as a single character from the below list.
* </p>
* types
* <tr valign="top"><td>=</td><td>The type is taken from the MIB</td></tr>
* <tr valign="top"><td>i</td><td>INTEGER</td> </tr>
* <tr valign="top"><td>u</td><td>INTEGER</td></tr>
* <tr valign="top"><td>s</td><td>STRING</td></tr>
* <tr valign="top"><td>x</td><td>HEX STRING</td></tr>
* <tr valign="top"><td>d</td><td>DECIMAL STRING</td></tr>
* <tr valign="top"><td>n</td><td>NULLOBJ</td></tr>
* <tr valign="top"><td>o</td><td>OBJID</td></tr>
* <tr valign="top"><td>t</td><td>TIMETICKS</td></tr>
* <tr valign="top"><td>a</td><td>IPADDRESS</td></tr>
* <tr valign="top"><td>b</td><td>BITS</td></tr>
* </table>
* If <b>OPAQUE_SPECIAL_TYPES</b> was defined while compiling the SNMP library, the following are also valid:
* </p>
* types
* <tr valign="top"><td>U</td><td>unsigned int64</td></tr>
* <tr valign="top"><td>I</td><td>signed int64</td></tr>
* <tr valign="top"><td>F</td><td>float</td></tr>
* <tr valign="top"><td>D</td><td>double</td></tr>
* </table>
* Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and
* the 'u' unsigned type is also used for handling Gauge32 values.
* </p>
* If the MIB-Files are loaded by into the MIB Tree with "snmp_read_mib" or by specifying it in the libsnmp config, '=' may be used as
* the <i>type</i> parameter for all object ids as the type can then be automatically read from the MIB.
* </p>
* Note that there are two ways to set a variable of the type BITS like e.g.
* "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}":
* </p>
* Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8.
* Using type "x" and a hex number but without(!) the usual "0x" prefix.
* See examples section for more details.
* </p>
* @param string $value <p>
* The new value
* </p>
* @param int $timeout [optional] <p>
* The number of microseconds until the first timeout.
* </p>
* @param int $retries [optional] <p>
* The number of times to retry if timeouts occur.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
* </p>
* <p>
* If the SNMP host rejects the data type, an E_WARNING message like "Warning: Error in packet. Reason: (badValue) The value given has the wrong type or length." is shown.
* If an unknown or invalid OID is specified the warning probably reads "Could not add variable".
*/
function snmp3_set ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $type, $value, $timeout = 1000000, $retries = 5) {}
/**
* (PHP 4 >= 4.3.3, PHP 5)<br/>
* Specify the method how the SNMP values will be returned
* @link http://php.net/manual/en/function.snmp-set-valueretrieval.php
* @param int $method <table>
* types
* <tr valign="top">
* <td>SNMP_VALUE_LIBRARY</td>
* <td>The return values will be as returned by the Net-SNMP library.</td>
* </tr>
* <tr valign="top">
* <td>SNMP_VALUE_PLAIN</td>