Branch: Tag:

1999-02-19

1999-02-19 14:33:09 by Niels Möller <nisse@lysator.liu.se>

Added classes asn1_boolean and asn1_enumerated.

Rev: lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:1.4

189:    }   }    - #if 0 -  +    // FIXME: What is the DER-encoding of TRUE??? -  + // According to Jan Petrous, the LDAP spec says that 0xff is right.      class asn1_boolean   {
203: Inside #if 0
      object init(int x) { value = x; return this_object(); }    -  string der_encode() {} -  object decode_primitive() {} -  string debug_string +  string der_encode() { return build_der(value ? "\377" : "\0"); } +  object decode_primitive(string contents)    { -  +  if (strlen(contents) != 1) +  { +  WERROR("asn1_boolean->decode_primitive: Bad length.\n"); +  return 0; +  } +  record_der(contents); +  value = contents[0]; +  return this_object(); +  } +  string debug_string() +  {    return value ? "TRUE" : "FALSE";    }   } - #endif +       // All integers are represented as bignums, for simplicity   class asn1_integer
261:    }      } + class asn1_enumerated + { +  inherit asn1_integer; +  constant tag = 10; +  constant type_name ="ENUMERATED"; + }      class asn1_bit_string   {