VisibleString.c
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2003, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
7 
8 /*
9  * VisibleString basic type description.
10  */
12  (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/
13  (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
14 };
15 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
17  { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */
18  { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */
19  0, 0
20 };
21 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
24 #if !defined(ASN_DISABLE_PRINT_SUPPORT)
25  OCTET_STRING_print_utf8, /* ASCII subset */
26 #else
27  0,
28 #endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */
31 #if !defined(ASN_DISABLE_BER_SUPPORT)
32  OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
34 #else
35  0,
36  0,
37 #endif /* !defined(ASN_DISABLE_BER_SUPPORT) */
38 #if !defined(ASN_DISABLE_XER_SUPPORT)
41 #else
42  0,
43  0,
44 #endif /* !defined(ASN_DISABLE_XER_SUPPORT) */
45 #if !defined(ASN_DISABLE_JER_SUPPORT)
48 #else
49  0,
50  0,
51 #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */
52 #if !defined(ASN_DISABLE_OER_SUPPORT)
55 #else
56  0,
57  0,
58 #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
59 #if !defined(ASN_DISABLE_UPER_SUPPORT)
62 #else
63  0,
64  0,
65 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */
66 #if !defined(ASN_DISABLE_APER_SUPPORT)
69 #else
70  0,
71  0,
72 #endif /* !defined(ASN_DISABLE_APER_SUPPORT) */
73 #if !defined(ASN_DISABLE_RFILL_SUPPORT)
75 #else
76  0,
77 #endif /* !defined(ASN_DISABLE_RFILL_SUPPORT) */
78  0 /* Use generic outmost tag fetcher */
79 };
81  "VisibleString",
82  "VisibleString",
86  / sizeof(asn_DEF_VisibleString_tags[0]) - 1,
89  / sizeof(asn_DEF_VisibleString_tags[0]),
90  {
91 #if !defined(ASN_DISABLE_OER_SUPPORT)
92  0,
93 #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
94 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
96 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
97 #if !defined(ASN_DISABLE_JER_SUPPORT)
98  0,
99 #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */
101  },
102  0, 0, /* No members */
103  0 /* No specifics */
104 };
105 
106 int
108  asn_app_constraint_failed_f *ctfailcb, void *app_key) {
109  const VisibleString_t *st = (const VisibleString_t *)sptr;
110 
111  if(st && st->buf) {
112  uint8_t *buf = st->buf;
113  uint8_t *end = buf + st->size;
114 
115  /*
116  * Check the alphabet of the VisibleString.
117  * ISO646, ISOReg#6
118  * The alphabet is a subset of ASCII between the space
119  * and "~" (tilde).
120  */
121  for(; buf < end; buf++) {
122  if(*buf < 0x20 || *buf > 0x7e) {
123  ASN__CTFAIL(app_key, td, sptr,
124  "%s: value byte %ld (%d) "
125  "not in VisibleString alphabet (%s:%d)",
126  td->name,
127  (long)((buf - st->buf) + 1),
128  *buf,
129  __FILE__, __LINE__);
130  return -1;
131  }
132  }
133  } else {
134  ASN__CTFAIL(app_key, td, sptr,
135  "%s: value not given (%s:%d)",
136  td->name, __FILE__, __LINE__);
137  return -1;
138  }
139 
140  return 0;
141 }
asn_DEF_VisibleString
asn_TYPE_descriptor_t asn_DEF_VisibleString
Definition: VisibleString.c:80
asn_TYPE_operation_s
Definition: constr_TYPE.h:184
OCTET_STRING_free
asn_struct_free_f OCTET_STRING_free
Definition: OCTET_STRING.h:24
asn_app_constraint_failed_f
void() asn_app_constraint_failed_f(void *application_specific_key, const struct asn_TYPE_descriptor_s *type_descriptor_which_failed, const void *structure_which_failed_ptr, const char *error_message_format,...) CC_PRINTFLIKE(4
Definition: asn_application.h:167
ber_tlv_tag_t
unsigned ber_tlv_tag_t
Definition: ber_tlv_tag.h:18
OCTET_STRING_encode_der
der_type_encoder_f OCTET_STRING_encode_der
Definition: OCTET_STRING.h:38
ASN_TAG_CLASS_UNIVERSAL
@ ASN_TAG_CLASS_UNIVERSAL
Definition: ber_tlv_tag.h:13
asn_TYPE_descriptor_s::name
const char * name
Definition: constr_TYPE.h:225
OCTET_STRING_decode_oer
oer_type_decoder_f OCTET_STRING_decode_oer
Definition: OCTET_STRING.h:57
asn_DEF_VisibleString_constraints
static asn_per_constraints_t asn_DEF_VisibleString_constraints
Definition: VisibleString.c:16
OCTET_STRING::buf
uint8_t * buf
Definition: OCTET_STRING.h:15
OCTET_STRING_encode_aper
per_type_encoder_f OCTET_STRING_encode_aper
Definition: OCTET_STRING.h:67
VisibleString_constraint
int VisibleString_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key)
Definition: VisibleString.c:107
asn_OP_VisibleString
asn_TYPE_operation_t asn_OP_VisibleString
Definition: VisibleString.c:22
asn_TYPE_descriptor_s
Definition: constr_TYPE.h:224
OCTET_STRING_decode_aper
per_type_decoder_f OCTET_STRING_decode_aper
Definition: OCTET_STRING.h:66
OCTET_STRING_encode_xer_utf8
xer_type_encoder_f OCTET_STRING_encode_xer_utf8
Definition: OCTET_STRING.h:46
asn_DEF_VisibleString_tags
static const ber_tlv_tag_t asn_DEF_VisibleString_tags[]
Definition: VisibleString.c:11
OCTET_STRING_print_utf8
asn_struct_print_f OCTET_STRING_print_utf8
Definition: OCTET_STRING.h:28
OCTET_STRING_random_fill
asn_random_fill_f OCTET_STRING_random_fill
Definition: OCTET_STRING.h:71
OCTET_STRING
Definition: OCTET_STRING.h:14
OCTET_STRING_encode_oer
oer_type_encoder_f OCTET_STRING_encode_oer
Definition: OCTET_STRING.h:58
asn_internal.h
ASN__CTFAIL
#define ASN__CTFAIL
Definition: constraints.h:57
VisibleString.h
OCTET_STRING_decode_ber
ber_type_decoder_f OCTET_STRING_decode_ber
Definition: OCTET_STRING.h:37
OCTET_STRING_decode_uper
per_type_decoder_f OCTET_STRING_decode_uper
Definition: OCTET_STRING.h:62
OCTET_STRING_copy
asn_struct_copy_f OCTET_STRING_copy
Definition: OCTET_STRING.h:32
OCTET_STRING_decode_xer_utf8
xer_type_decoder_f OCTET_STRING_decode_xer_utf8
Definition: OCTET_STRING.h:44
OCTET_STRING_decode_jer_utf8
jer_type_decoder_f OCTET_STRING_decode_jer_utf8
Definition: OCTET_STRING.h:51
asn_per_constraints_s
Definition: per_support.h:30
OCTET_STRING_encode_uper
per_type_encoder_f OCTET_STRING_encode_uper
Definition: OCTET_STRING.h:63
OCTET_STRING_encode_jer_utf8
jer_type_encoder_f OCTET_STRING_encode_jer_utf8
Definition: OCTET_STRING.h:53
OCTET_STRING_compare
asn_struct_compare_f OCTET_STRING_compare
Definition: OCTET_STRING.h:31
OCTET_STRING::size
size_t size
Definition: OCTET_STRING.h:16


etsi_its_spatem_ts_coding
Author(s): Jean-Pierre Busch , Guido Küppers , Lennart Reiher
autogenerated on Sun May 18 2025 02:29:29