pike.git / lib / modules / Protocols.pmod / SNMP.pmod / protocol.pike

version» Context lines:

pike.git/lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike:10:   //! 1155-7 : v1   //!   //! 1901-4 : v2/community (Bulk ops aren't implemented!)   //!   //! planned:   //! 2742 : agentX   //!   //! 2570 : v3 description   //!    - // $Id: protocol.pike,v 1.8 2002/12/03 09:41:27 hop Exp $ + // $Id: protocol.pike,v 1.9 2002/12/03 09:48:05 hop Exp $         #include "snmp_globals.h"   #include "snmp_errors.h"      #if 1   // --- ASN.1 hack   class asn1_application_octet_string   {    inherit Standards.ASN1.Types.asn1_octet_string;
pike.git/lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike:162:   inherit Stdio.UDP : snmp;      //:   //: public vars   //:         //:   //: private variables   //: - int remote_port; // = SNMP_DEFAULT_PORT; - string local_host = SNMP_DEFAULT_HOST; - string remote_host; - int request_id = 1; - int next_id = 1; + private int remote_port; // = SNMP_DEFAULT_PORT; + private string local_host = SNMP_DEFAULT_HOST; + private string remote_host; + private int request_id = 1; + private int next_id = 1;      //! SNMP version   //!   //! currently version 1 and 2 are supported.   int snmp_version = SNMP_DEFAULT_VERSION;      //! SNMP community string   //!   //! should be set to the appropriate SNMP community before sending a request.   //!   //! @note   //! Set to "public" by default.   string snmp_community = SNMP_DEFAULT_COMMUNITY;      int snmp_errno = SNMP_SUCCESS;   int ok;      //:   //: msg pool   //: - mapping msgpool = ([]); + private mapping msgpool = ([]);      //:   //: callback support   //: - function con_ok, con_fail; - array extra_args; + private function con_ok, con_fail; + private array extra_args;      //! create a new SNMP protocol object   //!   //! @param rem_port   //! @param rem_addr   //! remote address and UDP port (optional)   //! @param loc_port   //! @param loc_addr   //! local address and UDP port (optional)   //!
pike.git/lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike:280:    if(zero_type(msgpool[msgid]))    return 0;       msg = msgpool[msgid];    msgpool -= ([msgid:msg]);    return(msg);   }         //! read decoded message from pool - mapping readmsg_from_pool(int msgid) { + private mapping readmsg_from_pool(int msgid) {    //: read SNMP response PDU from PDU pool       mapping rv = from_pool((string)msgid);    if(rv)    return(rv);      #define HACK 1   #ifdef HACK    mapping tmpm = readmsg();    to_pool(tmpm);   #endif       return(from_pool((string)msgid));   }          - int writemsg(string rem_addr, int rem_port, object pdu) { + private int writemsg(string rem_addr, int rem_port, object pdu) {    //: send SNMP encoded message and return status    //: OK, in most cases :)       object msg;    string rawd;    int msize;       msg = Standards.ASN1.Types.asn1_sequence(({    Standards.ASN1.Types.asn1_integer(snmp_version-1),    Standards.ASN1.Types.asn1_octet_string(snmp_community),
pike.git/lib/modules/Protocols.pmod/SNMP.pmod/protocol.pike:320:       rawd = msg->get_der();       DWRITE(sprintf("protocol.writemsg: %O\n", rawd));       msize = send(rem_addr, rem_port, rawd);    return(msize = sizeof(rawd) ? SNMP_SUCCESS : SNMP_SEND_ERROR);   }       - int get_req_id() { + private int get_req_id() {    //: returns unicate id       //LOCK    int rv = request_id++;    //UNLOCK    return(rv);   }      //:   //: read_response