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.8 2007/10/29 14:10:18 grubba Exp $ + // $Id: SNMP.pmod,v 1.9 2007/11/03 14:20:03 grubba Exp $   //   // 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:37:    ) {    this_object()->value = Gmp.mpz(val);    } else {    this_object()->value = val;    }    this_object()->der = UNDEFINED;    }    }   }    + class OwnerInfo + { +  Configuration conf; +  RoxenModule module; + } +    // ASN1 datatypes.      class app_integer   {    inherit Standards.ASN1.Types.asn1_integer : integer;    inherit Documentation : doc;    inherit Updateable : update; -  +  inherit OwnerInfo : owner_info;    constant cls = 1;    constant type_name = "APPLICATION INTEGER";    constant tag = 0;    static 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);
Roxen.git/server/etc/modules/SNMP.pmod:72:    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 Documentation : doc;    inherit Updateable : update; +  inherit OwnerInfo : owner_info;    constant cls = 1;    constant type_name = "APPLICATION OCTET_STRING";    constant tag = 0;    static 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);
Roxen.git/server/etc/modules/SNMP.pmod:99:    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 Documentation : doc; +  inherit OwnerInfo : owner_info;    constant type_name = "OID";    static void create(array(int) oid, string|void name, string|void doc_string)    {    identifier::create(@oid);    doc::create(name, doc_string);    }    static string _sprintf(int t)    {    switch(t) {    case 's': return ((array(string))id) * ".";
Roxen.git/server/etc/modules/SNMP.pmod:121:    ((array(string))id) * ".");    }    }   }      class Integer   {    inherit Standards.ASN1.Types.asn1_integer : integer;    inherit Documentation : doc;    inherit Updateable : update; +  inherit OwnerInfo : owner_info;    constant type_name = "INTEGER";    static 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:148:    default: return sprintf("%s[%d][%d](%O)", type_name, cls, tag, value);    }    }   }      class String   {    inherit Standards.ASN1.Types.asn1_octet_string : octet_string;    inherit Documentation : doc;    inherit Updateable : update; +  inherit OwnerInfo : owner_info;    constant type_name = "STRING";    static 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:260:       Standards.ASN1.Types.Object lookup(array(int) key)    {    function|Standards.ASN1.Types.Object res = ::lookup(key);    if (zero_type(res)) return UNDEFINED;    if (functionp(res)) return res();    return res;    }   }    + void set_owner(ADT.Trie mib, Configuration conf, RoxenModule|void module) + { +  array(int) oid = mib->first(); +  while (oid) { +  Standards.ASN1.Types.Object o = mib->lookup(oid); +  catch { +  o->conf = conf; +  if (module) { +  o->module = module; +  } +  }; +  oid = mib->next(oid); +  } + } +  + void remove_owned(ADT.Trie mib, Configuration conf, RoxenModule|void module) + { +  array(int) oid = mib->first(); +  while(oid) { +  Standards.ASN1.Types.Object o = mib->lookup(oid); +  if (objectp(o) && (o->conf == conf) && +  (!module || (o->module == module))) { +  mib->remove(oid); +  } +  oid = mib->next(oid); +  } + } +    #if 0 // Not ready for production yet.      class Describer(string symbol)   {   }      class IndexDescriber   {    inherit Describer;    constant is_index = "int";