home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl502b.zip / ext / DPI / t1.pl < prev    next >
Text File  |  1996-02-23  |  647b  |  27 lines

  1. use DPI;
  2.  
  3. DPI::DPIdebug(2);
  4.  
  5. $h = DPI::DPIconnect_to_agent_TCP("r0124", "public");
  6. ;; print "connect: $h\n";
  7.  
  8. $data = pack("L", 11223344);
  9. $values = DPI::mkDPIset(0, "1.3.6.1.4.1.2.2.1.5.", "1.0", SNMP_TYPE_Integer32, $data);
  10. ;; print "values: $values\n";
  11.  
  12. $packet = DPI::mkDPItrap(6, 1, $values);
  13. ;; print "trap: ", hexdump($packet), "\n";
  14.  
  15. $rc = DPI::DPIsend_packet_to_agent($h, $packet);
  16. ;; print "send: $rc\n";
  17.  
  18. DPI::DPIdisconnect_from_agent($h);
  19.  
  20. exit 0;
  21.  
  22. #############################################################################
  23. sub hexdump
  24. {
  25.     return join(".", map(sprintf("%02X", $_), split(//, $_[0])));
  26. }
  27.