Initialize Tizen 2.3
[external/libtasn1.git] / doc / texi / asn1_read_value.texi
1 @subheading asn1_read_value
2 @anchor{asn1_read_value}
3 @deftypefun {asn1_retCode} {asn1_read_value} (ASN1_TYPE @var{root}, const char * @var{name}, void * @var{ivalue}, int * @var{len})
4 @var{root}: pointer to a structure.
5
6 @var{name}: the name of the element inside a structure that you want to read.
7
8 @var{ivalue}: vector that will contain the element's content, must be a
9 pointer to memory cells already allocated.
10
11 @var{len}: number of bytes of *value: value[0]..value[len-1]. Initialy
12 holds the sizeof value.
13
14 Returns the value of one element inside a structure.
15
16 If an element is OPTIONAL and the function "read_value" returns
17 @code{ASN1_ELEMENT_NOT_FOUND}, it means that this element wasn't present
18 in the der encoding that created the structure.  The first element
19 of a SEQUENCE_OF or SET_OF is named "?1". The second one "?2" and
20 so on.
21
22 @strong{INTEGER:} VALUE will contain a two's complement form integer.
23
24 integer=-1  -> value[0]=0xFF , len=1.
25 integer=1   -> value[0]=0x01 , len=1.
26
27 @strong{ENUMERATED:} As INTEGER (but only with not negative numbers).
28
29 @strong{BOOLEAN:} VALUE will be the null terminated string "TRUE" or
30 "FALSE" and LEN=5 or LEN=6.
31
32 @strong{OBJECT IDENTIFIER:} VALUE will be a null terminated string with
33 each number separated by a dot (i.e. "1.2.3.543.1").
34
35 LEN = strlen(VALUE)+1
36
37 @strong{UTCTime:} VALUE will be a null terminated string in one of these
38 formats: "YYMMDDhhmmss+hh'mm'" or "YYMMDDhhmmss-hh'mm'".
39 LEN=strlen(VALUE)+1.
40
41 @strong{GeneralizedTime:} VALUE will be a null terminated string in the
42 same format used to set the value.
43
44 @strong{OCTET STRING:} VALUE will contain the octet string and LEN will be
45 the number of octets.
46
47 @strong{GeneralString:} VALUE will contain the generalstring and LEN will
48 be the number of octets.
49
50 @strong{BIT STRING:} VALUE will contain the bit string organized by bytes
51 and LEN will be the number of bits.
52
53 @strong{CHOICE:} If NAME indicates a choice type, VALUE will specify the
54 alternative selected.
55
56 @strong{ANY:} If NAME indicates an any type, VALUE will indicate the DER
57 encoding of the structure actually used.
58
59 @strong{Returns:} @end deftypefun
60