1 #ifndef ASN1FIX_CRANGE_H
2 #define ASN1FIX_CRANGE_H
4 typedef struct asn1cnst_edge_s {
5 enum asn1cnst_range_edge {
10 int lineno; /* Line where the corresponding token was found */
11 asn1c_integer_t value; /* Value when type is ARE_VALUE */
14 typedef struct asn1cnst_range_s {
15 asn1cnst_edge_t left; /* MIN from (MIN..10) */
16 asn1cnst_edge_t right; /* 10 from (MIN..10) */
18 enum asn1cnst_range_narrowing {
19 /* Sorted from softest to strictest narrowing */
23 } narrowing; /* Constrained to a known narrow type */
25 /* If range is split in parts, these are the parts */
26 struct asn1cnst_range_s **elements;
30 int empty_constraint; /* If yes, too bad. */
31 int extensible; /* Extension marker (...) is in effect. */
33 int incompatible; /* Constraint incompatible with argument */
34 int not_OER_visible; /* Contains not OER-visible components */
35 int not_PER_visible; /* Contains not PER-visible components */
39 * Compute the constraint range with variable visibility restrictions.
41 * (expr_type) must have the type of the top-level parent ASN.1 type.
42 * (required_type) must be one of ACT_EL_RANGE, ACT_CT_SIZE or ACT_CT_FROM.
43 * (minmax) and (expectation_met) should be 0.
45 * EINVAL: Mandatory arguments missing.
46 * ENOMEM: Memory allocation failure.
47 * EPERM: Invalid constraint reference.
51 CPR_strict_OER_visibility = 0x01,
52 CPR_strict_PER_visibility = 0x02,
53 CPR_simulate_fbless_SIZE = 0x04,
55 asn1cnst_range_t *asn1constraint_compute_OER_range(const char *dbg_name,
56 asn1p_expr_type_e expr_type,
57 const asn1p_constraint_t *ct,
58 enum asn1p_constraint_type_e required_type,
59 const asn1cnst_range_t *minmax,
62 asn1cnst_range_t *asn1constraint_compute_PER_range(const char *dbg_name,
63 asn1p_expr_type_e expr_type,
64 const asn1p_constraint_t *ct,
65 enum asn1p_constraint_type_e required_type,
66 const asn1cnst_range_t *minmax,
69 /* Base implementation */
70 asn1cnst_range_t *asn1constraint_compute_constraint_range(const char *dbg_name,
71 asn1p_expr_type_e expr_type,
72 const asn1p_constraint_t *ct,
73 enum asn1p_constraint_type_e required_type,
74 const asn1cnst_range_t *minmax,
78 void asn1constraint_range_free(asn1cnst_range_t *);
81 * Check that a specific constraint is compatible
82 * with the given expression type.
84 int asn1constraint_compatible(asn1p_expr_type_e expr_type,
85 enum asn1p_constraint_type_e constr_type, int fbless_SIZE);
88 * Fetch a default alphabet for this type.
90 asn1cnst_range_t *asn1constraint_default_alphabet(asn1p_expr_type_e expr_type);
92 #endif /* ASN1FIX_CRANGE_H */