aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/asn1_SUITE_data/BitStr.py
blob: 1d5bc21fda4a6be4edd468b7ff3488eda86cced7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
BitStr DEFINITIONS ::=
BEGIN

-- F.2.5.1	
-- Use a bit string type to model binary data whose format and 
-- length are unspecified, 
-- or specified elsewhere, and whose length in bits is not necessarily 
-- a multiple of eight.
--	EXAMPLE

G3FacsimilePage ::= BIT STRING
--  a sequence of bits conforming to Recommendation T.4.
	
image G3FacsimilePage ::= '100110100100001110110'B
trailer BIT STRING ::= '0123456789ABCDEF'H
body1 G3FacsimilePage ::= '1101'B
body2 G3FacsimilePage ::= '1101000'B

-- F.2.5.2	
-- Use a bit string type with a size constraint to model the 
-- values of a fixed sized bit field.
-- EXAMPLE

BitField ::= BIT STRING (SIZE (12))
map1 BitField ::= '100110100100'B
map2 BitField ::= '9A4'H
map3 BitField ::= '1001101001'B	--  Illegal - violates size constraint

-- F.2.5.3	
-- Use a bit string type to model the values of a bit map, an 
-- ordered collection of logical variables 
-- indicating whether a particular condition holds for each of a 
-- correspondingly ordered collection of objects.

DaysOfTheWeek ::=	BIT STRING {
			sunday(0), monday (1), tuesday(2),
			wednesday(3), thursday(4), friday(5),
			saturday(6) } (SIZE (0..7))

sunnyDaysLastWeek1 DaysOfTheWeek ::= {sunday, monday, wednesday}
sunnyDaysLastWeek2 DaysOfTheWeek ::= '1101'B
sunnyDaysLastWeek3 DaysOfTheWeek ::= '1101000'B
sunnyDaysLastWeek4 DaysOfTheWeek ::= '11010000'B --  Illegal - violates size constraint

-- F.2.5.5	
-- Use a bit string type with named bits to model the values of a 
-- collection of related logical variables.
-- EXAMPLE

PersonalStatus ::= BIT STRING
		{married(0), employed(1), veteran(2), collegeGraduate(3)}

billClinton PersonalStatus ::= {married, employed, collegeGraduate}
hillaryClinton PersonalStatus ::= '110100'B

END