Roxen.git / server / etc / modules / SNMP.pmod

version» Context lines:

Roxen.git/server/etc/modules/SNMP.pmod:1:   //   // SNMP helper stuff.   // - // $Id: SNMP.pmod,v 1.13 2010/11/25 14:06:03 grubba Exp $ + // $Id$   //   // 2007-08-29 Henrik Grubbström   //      // Some OIDs      //! iso.organizations.dod.internet   constant INTERNET_OID = ({ 1, 3, 6, 1 });      //! iso.organizations.dod.internet.private.enterprises.roxenis
Roxen.git/server/etc/modules/SNMP.pmod:21:    string doc)   {   }      class Updateable(function(:mixed) fun)   {    void update_value()    {    if (fun) {    mixed val = fun(); -  if ( - #if __VERSION__ < 7.6 -  intp(val) - #else -  0 - #endif -  ) { -  this_object()->value = Gmp.mpz(val); -  } else { -  this_object()->value = val; +  if (undefinedp (val)) { +  werror("SNMP: Got undefined value from callback %O.\n" +  "%s\n", +  fun, describe_backtrace(backtrace()));    } -  +  this_object()->init (val);    this_object()->der = UNDEFINED;    }    }   }      class OwnerInfo   {    Configuration conf;    RoxenModule module;   }      // ASN1 datatypes.      class app_integer   { -  inherit Standards.ASN1.Types.asn1_integer : integer; +  inherit Standards.ASN1.Types.Integer : integer;    inherit Documentation : doc;    inherit Updateable : update;    inherit OwnerInfo : owner_info; -  constant cls = 1; +     constant type_name = "APPLICATION INTEGER"; -  constant tag = 0; +  int cls = 1; +  int tag = 0;    protected void create(int|function(:int) val, string|void name,    string|void doc_string)    {    if (intp(val)) {    update::create(UNDEFINED);    integer::create(val);    } else {    update::create(val);    integer::create(0);    }
Roxen.git/server/etc/modules/SNMP.pmod:77:    {    switch(t) {    case 's': return (string)value;    default: return sprintf("%s[%d][%d](%O)", type_name, cls, tag, value);    }    }   }      class app_octet_string   { -  inherit Standards.ASN1.Types.asn1_octet_string : octet_string; +  inherit Standards.ASN1.Types.OctetString : octet_string;    inherit Documentation : doc;    inherit Updateable : update;    inherit OwnerInfo : owner_info; -  constant cls = 1; +     constant type_name = "APPLICATION OCTET_STRING"; -  constant tag = 0; +  int cls = 1; +  int tag = 0;    protected void create(string|function(:string) val, string|void name,    string|void doc_string)    {    if (stringp(val)) {    update::create(UNDEFINED);    octet_string::create(val);    } else {    update::create(val);    octet_string::create("");    }
Roxen.git/server/etc/modules/SNMP.pmod:107:    {    switch(t) {    case 's': return (string)value;    default: return sprintf("%s[%d][%d](%O)", type_name, cls, tag, value);    }    }   }      class OID   { -  inherit Standards.ASN1.Types.asn1_identifier : identifier; +  inherit Standards.ASN1.Types.Identifier : identifier;    inherit Documentation : doc;    inherit OwnerInfo : owner_info;    constant type_name = "OID";    protected void create(array(int) oid, string|void name,    string|void doc_string)    {    identifier::create(@oid);    doc::create(name, doc_string);    }    protected string _sprintf(int t)
Roxen.git/server/etc/modules/SNMP.pmod:130:    case 's': return ((array(string))id) * ".";    default: return sprintf("%s[%d][%d](%O)",    type_name, cls, tag,    ((array(string))id) * ".");    }    }   }      class Integer   { -  inherit Standards.ASN1.Types.asn1_integer : integer; +  inherit Standards.ASN1.Types.Integer : integer;    inherit Documentation : doc;    inherit Updateable : update;    inherit OwnerInfo : owner_info;    constant type_name = "INTEGER";    protected void create(int|function(:int) val, string|void name,    string|void doc_string)    {    if (intp(val)) {    update::create(UNDEFINED);    integer::create(val);
Roxen.git/server/etc/modules/SNMP.pmod:159:    switch(t) {    case 'd':    case 's': return (string)value;    default: return sprintf("%s[%d][%d](%O)", type_name, cls, tag, value);    }    }   }      class String   { -  inherit Standards.ASN1.Types.asn1_octet_string : octet_string; +  inherit Standards.ASN1.Types.OctetString : octet_string;    inherit Documentation : doc;    inherit Updateable : update;    inherit OwnerInfo : owner_info;    constant type_name = "STRING";    protected void create(string|function(:string) val, string|void name,    string|void doc_string)    {    if (stringp(val)) {    update::create(UNDEFINED);    octet_string::create(val);
Roxen.git/server/etc/modules/SNMP.pmod:189:    case 's': return (string)value;    default: return sprintf("%s[%d][%d](%O)",    type_name, cls, tag, (string)value);    }    }   }      class Counter   {    inherit app_integer; -  constant tag = 1; +  int tag = 1;    constant type_name = "COUNTER";   }      class Gauge   {    inherit app_integer; -  constant tag = 2; +  int tag = 2;    constant type_name = "GAUGE";   }      //! One tick is 1/100 seconds.   class Tick   {    inherit app_integer; -  constant tag = 3; +  int tag = 3;    constant type_name = "TICK";    protected string _sprintf(int t)    {    if (t == 's') {    return Roxen.short_date((int)(time(1) - value/100));    }    return ::_sprintf(t);    }   }      class Opaque   {    inherit app_octet_string; -  constant tag = 4; +  int tag = 4;    constant type_name = "OPAQUE";    protected string _sprintf(int t)    {    if (t == 's') return "";    return ::_sprintf(t);    }   }      class Counter64   {    inherit app_integer; -  constant tag = 6; +  int tag = 6;    constant type_name = "COUNTER64";   }    -  + class ContextOctetString + { +  inherit Standards.ASN1.Types.OctetString; +  +  int cls = 2; +  constant type_name = "CONTEXT OCTET STRING"; +  +  protected void create(int tag, string(8bit) val) +  { +  this_program::tag = tag; +  ::create(val); +  } + } +  + class ContextSequence + { +  inherit Standards.ASN1.Types.Sequence; +  +  int cls = 2; +  constant type_name = "CONTEXT SEQUENCE"; +  +  protected void create(int tag, array arg) +  { +  this_program::tag = tag; +  ::create(arg); +  } + } +    //! No such object marker. - Protocols.LDAP.ldap_privates.asn1_context_octet_string NO_SUCH_OBJECT = -  Protocols.LDAP.ldap_privates.asn1_context_octet_string(0, ""); + ContextOctetString NO_SUCH_OBJECT = ContextOctetString(0, "");      //! No such instance marker. - Protocols.LDAP.ldap_privates.asn1_context_octet_string NO_SUCH_INSTANCE = -  Protocols.LDAP.ldap_privates.asn1_context_octet_string(1, ""); + ContextOctetString NO_SUCH_INSTANCE = ContextOctetString(1, "");      //! End of MIB marker. - Protocols.LDAP.ldap_privates.asn1_context_octet_string END_OF_MIB = -  Protocols.LDAP.ldap_privates.asn1_context_octet_string(2, ""); + ContextOctetString END_OF_MIB = ContextOctetString(2, "");      //! The NULL counter.   Counter NULL_COUNTER = Counter(0);         class SimpleMIB   {    inherit ADT.Trie;       protected void init(array(int) oid,