Go to the documentation of this file.
23 #if !defined(ASN_DISABLE_PRINT_SUPPORT)
30 #if !defined(ASN_DISABLE_BER_SUPPORT)
37 #if !defined(ASN_DISABLE_XER_SUPPORT)
44 #if !defined(ASN_DISABLE_JER_SUPPORT)
51 #if !defined(ASN_DISABLE_OER_SUPPORT)
58 #if !defined(ASN_DISABLE_UPER_SUPPORT)
65 #if !defined(ASN_DISABLE_APER_SUPPORT)
72 #if !defined(ASN_DISABLE_RFILL_SUPPORT)
90 #if !defined(ASN_DISABLE_OER_SUPPORT)
93 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
96 #if !defined(ASN_DISABLE_JER_SUPPORT)
113 ASN_DEBUG(
"Freeing %s as OCTET STRING", td->
name);
120 #if !defined(ASN_DISABLE_BER_SUPPORT)
167 if(st == 0 || (str == 0 && len)) {
191 memcpy(buf, str, len);
192 ((uint8_t *)buf)[len] =
'\0';
194 st->
buf = (uint8_t *)buf;
229 assert(!specs || specs->
subvariant != ASN_OSUBV_BIT);
233 int ret = memcmp(a->
buf, b->
buf, common_prefix_size);
244 return ret < 0 ? -1 : 1;
246 }
else if(!a && !b) {
281 void *buf =
MALLOC(b->size + 1);
283 memcpy(buf, b->buf, b->size);
284 ((uint8_t *)buf)[b->size] =
'\0';
287 a->buf = (uint8_t *)buf;
293 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
296 size_t units,
unsigned int bpc,
unsigned int unit_bits,
298 uint8_t *end = buf + units * bpc;
300 ASN_DEBUG(
"Expanding %d characters into (%ld..%ld):%d",
301 (
int)units, lb, ub, unit_bits);
304 if((
unsigned long)ub <= ((
unsigned long)2 << (unit_bits - 1))) {
312 for(; buf < end; buf += bpc) {
315 if(code < 0)
return -1;
318 ASN_DEBUG(
"Code %d (0x%02x) is"
319 " not in map (%ld..%ld)",
324 case 1: *buf = value;
break;
325 case 2: buf[0] = value >> 8; buf[1] = value;
break;
326 case 4: buf[0] = value >> 24; buf[1] = value >> 16;
327 buf[2] = value >> 8; buf[3] = value;
break;
334 if(lb == 0 && (unit_bits == 8 * bpc)) {
338 for(; buf < end; buf += bpc) {
340 int32_t ch = code + lb;
341 if(code < 0)
return -1;
343 ASN_DEBUG(
"Code %d is out of range (%ld..%ld)",
348 case 1: *buf = ch;
break;
349 case 2: buf[0] = ch >> 8; buf[1] = ch;
break;
350 case 4: buf[0] = ch >> 24; buf[1] = ch >> 16;
351 buf[2] = ch >> 8; buf[3] = ch;
break;
360 size_t units,
unsigned int bpc,
unsigned int unit_bits,
362 const uint8_t *end = buf + units * bpc;
364 ASN_DEBUG(
"Squeezing %d characters into (%ld..%ld):%d (%d bpc)",
365 (
int)units, lb, ub, unit_bits, bpc);
368 if((
unsigned long)ub <= ((
unsigned long)2 << (unit_bits - 1))) {
372 for(; buf < end; buf += bpc) {
376 case 1: value = *(
const uint8_t *)buf;
break;
377 case 2: value = (buf[0] << 8) | buf[1];
break;
378 case 4: value = (buf[0] << 24) | (buf[1] << 16)
379 | (buf[2] << 8) | buf[3];
break;
384 ASN_DEBUG(
"Character %d (0x%02x) is"
385 " not in map (%ld..%ld)",
395 if(lb == 0 && (unit_bits == 8 * bpc)) {
399 for(ub -= lb; buf < end; buf += bpc) {
404 value = *(
const uint8_t *)buf;
407 value = (buf[0] << 8) | buf[1];
410 value = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
416 if(ch < 0 || ch > ub) {
417 ASN_DEBUG(
"Character %d (0x%02x) is out of range (%ld..%ld)", *buf,
int OCTET_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const void *bptr)
int OCTET_STRING_copy(const asn_TYPE_descriptor_t *td, void **aptr, const void *bptr)
der_type_encoder_f OCTET_STRING_encode_der
@ ASN_TAG_CLASS_UNIVERSAL
jer_type_encoder_f OCTET_STRING_encode_jer
#define CALLOC(nmemb, size)
#define per_get_few_bits(data, bits)
@ ASFM_FREE_UNDERLYING_AND_RESET
oer_type_decoder_f OCTET_STRING_decode_oer
asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs
jer_type_decoder_f OCTET_STRING_decode_jer_hex
per_type_encoder_f OCTET_STRING_encode_aper
per_type_decoder_f OCTET_STRING_decode_aper
OCTET_STRING_t * OCTET_STRING_new_fromBuf(const asn_TYPE_descriptor_t *td, const char *str, int len)
static const ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[]
enum asn_OCTET_STRING_specifics_s::asn_OS_Subvariant subvariant
asn_constr_check_f asn_generic_no_constraint
#define per_put_many_bits(out, src, nbits)
asn_random_fill_f OCTET_STRING_random_fill
int OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, size_t units, unsigned int bpc, unsigned int unit_bits, long lb, long ub, const asn_per_constraints_t *pc)
#define per_get_many_bits(data, dst, align, bits)
oer_type_encoder_f OCTET_STRING_encode_oer
asn_struct_print_f OCTET_STRING_print
ber_type_decoder_f OCTET_STRING_decode_ber
void OCTET_STRING_free(const asn_TYPE_descriptor_t *td, void *sptr, enum asn_struct_free_method method)
per_type_decoder_f OCTET_STRING_decode_uper
xer_type_encoder_f OCTET_STRING_encode_xer
asn_TYPE_descriptor_t asn_DEF_OCTET_STRING
xer_type_decoder_f OCTET_STRING_decode_xer_hex
asn_TYPE_operation_t asn_OP_OCTET_STRING
int(* code2value)(unsigned int code)
int OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, size_t units, unsigned int bpc, unsigned int unit_bits, long lb, long ub, const asn_per_constraints_t *pc)
per_type_encoder_f OCTET_STRING_encode_uper
struct OCTET_STRING OCTET_STRING_t
int(* value2code)(unsigned int value)
#define per_put_few_bits(out, bits, obits)
int OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len)
etsi_its_spatem_ts_coding
Author(s): Jean-Pierre Busch
, Guido Küppers , Lennart Reiher
autogenerated on Sun May 18 2025 02:29:28