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

version» Context lines:

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\n%s\n", +  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.Integer : integer;    inherit Documentation : doc;    inherit Updateable : update;    inherit OwnerInfo : owner_info;    constant type_name = "APPLICATION INTEGER"; - #if __VERSION__ < 8.0 -  constant cls = 1; -  constant tag = 0; - #else +     int cls = 1;    int tag = 0; - #endif +     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:87:    }   }      class app_octet_string   {    inherit Standards.ASN1.Types.OctetString : octet_string;    inherit Documentation : doc;    inherit Updateable : update;    inherit OwnerInfo : owner_info;    constant type_name = "APPLICATION OCTET_STRING"; - #if __VERSION__ < 8.0 -  constant cls = 1; -  constant tag = 0; - #else +     int cls = 1;    int tag = 0; - #endif +     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:199:    case 's': return (string)value;    default: return sprintf("%s[%d][%d](%O)",    type_name, cls, tag, (string)value);    }    }   }      class Counter   {    inherit app_integer; - #if __VERSION__ < 8.0 -  constant tag = 1; - #else +     int tag = 1; - #endif +     constant type_name = "COUNTER";   }      class Gauge   {    inherit app_integer; - #if __VERSION__ < 8.0 -  constant tag = 2; - #else +     int tag = 2; - #endif +     constant type_name = "GAUGE";   }      //! One tick is 1/100 seconds.   class Tick   {    inherit app_integer; - #if __VERSION__ < 8.0 -  constant tag = 3; - #else +     int tag = 3; - #endif +     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; - #if __VERSION__ < 8.0 -  constant tag = 4; - #else +     int tag = 4; - #endif +     constant type_name = "OPAQUE";    protected string _sprintf(int t)    {    if (t == 's') return "";    return ::_sprintf(t);    }   }      class Counter64   {    inherit app_integer; - #if __VERSION__ < 8.0 -  constant tag = 6; - #else +     int tag = 6; - #endif +     constant type_name = "COUNTER64";   }    - #if __VERSION__ < 8.0 - constant ContextOctetString = -  Protocols.LDAP.ldap_privates.asn1_context_octet_string; - constant ContextSequence = -  Protocols.LDAP.ldap_privates.asn1_context_sequence; - #else +    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;
Roxen.git/server/etc/modules/SNMP.pmod:297:       int cls = 2;    constant type_name = "CONTEXT SEQUENCE";       protected void create(int tag, array arg)    {    this_program::tag = tag;    ::create(arg);    }   } - #endif +       //! No such object marker.   ContextOctetString NO_SUCH_OBJECT = ContextOctetString(0, "");      //! No such instance marker.   ContextOctetString NO_SUCH_INSTANCE = ContextOctetString(1, "");      //! End of MIB marker.   ContextOctetString END_OF_MIB = ContextOctetString(2, "");