OCTET_STRING.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
5 #ifndef _OCTET_STRING_H_
6 #define _OCTET_STRING_H_
7 
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef struct OCTET_STRING {
15  uint8_t *buf; /* Buffer with consecutive OCTET_STRING bits */
16  size_t size; /* Size of the buffer */
17 
18  asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
20 
23 
25 
26 #if !defined(ASN_DISABLE_PRINT_SUPPORT)
29 #endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */
30 
33 
34 #define OCTET_STRING_constraint asn_generic_no_constraint
35 
36 #if !defined(ASN_DISABLE_BER_SUPPORT)
37 ber_type_decoder_f OCTET_STRING_decode_ber;
38 der_type_encoder_f OCTET_STRING_encode_der;
39 #endif /* !defined(ASN_DISABLE_BER_SUPPORT) */
40 
41 #if !defined(ASN_DISABLE_XER_SUPPORT)
42 xer_type_decoder_f OCTET_STRING_decode_xer_hex; /* Hexadecimal */
43 xer_type_decoder_f OCTET_STRING_decode_xer_binary; /* 01010111010 */
44 xer_type_decoder_f OCTET_STRING_decode_xer_utf8; /* ASCII/UTF-8 */
45 xer_type_encoder_f OCTET_STRING_encode_xer;
46 xer_type_encoder_f OCTET_STRING_encode_xer_utf8;
47 #endif /* !defined(ASN_DISABLE_XER_SUPPORT) */
48 
49 #if !defined(ASN_DISABLE_JER_SUPPORT)
54 #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */
55 
56 #if !defined(ASN_DISABLE_OER_SUPPORT)
57 oer_type_decoder_f OCTET_STRING_decode_oer;
58 oer_type_encoder_f OCTET_STRING_encode_oer;
59 #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
60 
61 #if !defined(ASN_DISABLE_UPER_SUPPORT)
64 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */
65 #if !defined(ASN_DISABLE_APER_SUPPORT)
68 #endif /* !defined(ASN_DISABLE_APER_SUPPORT) */
69 
70 #if !defined(ASN_DISABLE_RFILL_SUPPORT)
72 #endif /* !defined(ASN_DISABLE_RFILL_SUPPORT) */
73 
74 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
76  asn_per_data_t *po,
77  uint8_t *buf,
78  size_t units,
79  unsigned int bpc,
80  unsigned int unit_bits,
81  long lb,
82  long ub,
83  const asn_per_constraints_t *pc);
84 
86  asn_per_outp_t *po,
87  const uint8_t *buf,
88  size_t units,
89  unsigned int bpc,
90  unsigned int unit_bits,
91  long lb,
92  long ub,
93  const asn_per_constraints_t *pc);
94 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
95 /******************************
96  * Handy conversion routines. *
97  ******************************/
98 
99 /*
100  * This function clears the previous value of the OCTET STRING (if any)
101  * and then allocates a new memory with the specified content (str/size).
102  * If size = -1, the size of the original string will be determined
103  * using strlen(str).
104  * If str equals to NULL, the function will silently clear the
105  * current contents of the OCTET STRING.
106  * Returns 0 if it was possible to perform operation, -1 otherwise.
107  */
108 int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size);
109 
110 /* Handy conversion from the C string into the OCTET STRING. */
111 #define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1)
112 
113 /*
114  * Allocate and fill the new OCTET STRING and return a pointer to the newly
115  * allocated object. NULL is permitted in str: the function will just allocate
116  * empty OCTET STRING.
117  */
119  const char *str, int size);
120 
121 /****************************
122  * Internally useful stuff. *
123  ****************************/
124 
126  /*
127  * Target structure description.
128  */
129  unsigned struct_size; /* Size of the structure */
130  unsigned ctx_offset; /* Offset of the asn_struct_ctx_t member */
131 
133  ASN_OSUBV_ANY, /* The open type (ANY) */
134  ASN_OSUBV_BIT, /* BIT STRING */
135  ASN_OSUBV_STR, /* String types, not {BMP,Universal}String */
136  ASN_OSUBV_U16, /* 16-bit character (BMPString) */
137  ASN_OSUBV_U32 /* 32-bit character (UniversalString) */
140 
142 
145  size_t max_length);
146 
147 #if !defined(ASN_DISABLE_BER_SUPPORT)
148 struct _stack_el {
149  ber_tlv_len_t left; /* What's left to read (or -1) */
150  ber_tlv_len_t got; /* What was actually processed */
151  unsigned cont_level; /* Depth of subcontainment */
152  int want_nulls; /* Want null "end of content" octets? */
153  int bits_chopped; /* Flag in BIT STRING mode */
154  ber_tlv_tag_t tag; /* For debugging purposes */
155  struct _stack_el *prev;
156  struct _stack_el *next;
157 };
158 struct _stack {
159  struct _stack_el *tail;
161 };
162 #endif /* !defined(ASN_DISABLE_BER_SUPPORT) */
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif /* _OCTET_STRING_H_ */
asn_bit_outp_s
Definition: asn_bit_data.h:56
asn_struct_ctx_s
Definition: constr_TYPE.h:29
per_type_decoder_f
asn_dec_rval_t() per_type_decoder_f(const asn_codec_ctx_t *opt_codec_ctx, const struct asn_TYPE_descriptor_s *type_descriptor, const asn_per_constraints_t *constraints, void **struct_ptr, asn_per_data_t *per_data)
Definition: per_decoder.h:20
OCTET_STRING_decode_xer_binary
xer_type_decoder_f OCTET_STRING_decode_xer_binary
Definition: OCTET_STRING.h:43
asn_TYPE_operation_s
Definition: constr_TYPE.h:184
asn_struct_print_f
int() asn_struct_print_f(const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, int level, asn_app_consume_bytes_f *callback, void *app_key)
Definition: constr_TYPE.h:129
OCTET_STRING_free
asn_struct_free_f OCTET_STRING_free
Definition: OCTET_STRING.h:24
asn_OP_OCTET_STRING
asn_TYPE_operation_t asn_OP_OCTET_STRING
Definition: OCTET_STRING.c:21
_stack_el::tag
ber_tlv_tag_t tag
Definition: OCTET_STRING.h:154
asn_random_fill_f
asn_random_fill_result_t() asn_random_fill_f(const struct asn_TYPE_descriptor_s *td, void **struct_ptr, const struct asn_encoding_constraints_s *memb_constraints, size_t max_length)
Definition: asn_random_fill.h:32
ber_tlv_tag_t
unsigned ber_tlv_tag_t
Definition: ber_tlv_tag.h:18
_stack_el::bits_chopped
int bits_chopped
Definition: OCTET_STRING.h:153
_stack_el::next
struct _stack_el * next
Definition: OCTET_STRING.h:156
asn_struct_compare_f
int() asn_struct_compare_f(const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_A, const void *struct_B)
Definition: constr_TYPE.h:141
OCTET_STRING_encode_der
der_type_encoder_f OCTET_STRING_encode_der
Definition: OCTET_STRING.h:38
asn_OCTET_STRING_specifics_s::ASN_OSUBV_STR
@ ASN_OSUBV_STR
Definition: OCTET_STRING.h:137
OCTET_STRING_encode_jer
jer_type_encoder_f OCTET_STRING_encode_jer
Definition: OCTET_STRING.h:52
_stack_el
Definition: OCTET_STRING.h:148
asn_OCTET_STRING_specifics_s::struct_size
unsigned struct_size
Definition: OCTET_STRING.h:131
OCTET_STRING::_asn_ctx
asn_struct_ctx_t _asn_ctx
Definition: OCTET_STRING.h:18
OCTET_STRING_decode_oer
oer_type_decoder_f OCTET_STRING_decode_oer
Definition: OCTET_STRING.h:57
OCTET_STRING::buf
uint8_t * buf
Definition: OCTET_STRING.h:15
OCTET_STRING_decode_jer_hex
jer_type_decoder_f OCTET_STRING_decode_jer_hex
Definition: OCTET_STRING.h:50
asn_OCTET_STRING_specifics_s::ctx_offset
unsigned ctx_offset
Definition: OCTET_STRING.h:132
asn_OCTET_STRING_specifics_s
Definition: OCTET_STRING.h:125
asn_SPC_OCTET_STRING_specs
asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs
Definition: OCTET_STRING.c:16
OCTET_STRING_encode_aper
per_type_encoder_f OCTET_STRING_encode_aper
Definition: OCTET_STRING.h:67
asn_bit_data_s
Definition: asn_bit_data.h:17
ber_tlv_len_t
ssize_t ber_tlv_len_t
Definition: ber_tlv_length.h:12
asn_OCTET_STRING_specifics_s::ASN_OSUBV_U16
@ ASN_OSUBV_U16
Definition: OCTET_STRING.h:138
_stack_el::got
ber_tlv_len_t got
Definition: OCTET_STRING.h:150
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
jer_type_encoder_f
asn_enc_rval_t() jer_type_encoder_f(const struct asn_TYPE_descriptor_s *type_descriptor, const asn_jer_constraints_t *constraints, const void *struct_ptr, int ilevel, enum jer_encoder_flags_e jer_flags, asn_app_consume_bytes_f *consume_bytes_cb, void *app_key)
Definition: jer_encoder.h:73
_stack_el::cont_level
unsigned cont_level
Definition: OCTET_STRING.h:151
_stack::cur_ptr
struct _stack_el * cur_ptr
Definition: OCTET_STRING.h:160
asn_OCTET_STRING_specifics_s::subvariant
enum asn_OCTET_STRING_specifics_s::asn_OS_Subvariant subvariant
OCTET_STRING_encode_xer_utf8
xer_type_encoder_f OCTET_STRING_encode_xer_utf8
Definition: OCTET_STRING.h:46
jer_type_decoder_f
asn_dec_rval_t() jer_type_decoder_f(const asn_codec_ctx_t *opt_codec_ctx, const struct asn_TYPE_descriptor_s *type_descriptor, const asn_jer_constraints_t *constraints, void **struct_ptr, const void *buf_ptr, size_t size)
Definition: jer_decoder.h:32
OCTET_STRING_per_put_characters
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)
Definition: OCTET_STRING.c:359
asn_DEF_OCTET_STRING
asn_TYPE_descriptor_t asn_DEF_OCTET_STRING
Definition: OCTET_STRING.c:79
per_type_encoder_f
asn_enc_rval_t() per_type_encoder_f(const struct asn_TYPE_descriptor_s *type_descriptor, const asn_per_constraints_t *constraints, const void *struct_ptr, asn_per_outp_t *per_output)
Definition: per_encoder.h:20
OCTET_STRING_new_fromBuf
OCTET_STRING_t * OCTET_STRING_new_fromBuf(const asn_TYPE_descriptor_t *td, const char *str, int size)
Definition: OCTET_STRING.c:201
_stack::tail
struct _stack_el * tail
Definition: OCTET_STRING.h:159
OCTET_STRING_fromBuf
int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size)
Definition: OCTET_STRING.c:164
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_random_length_constrained
size_t OCTET_STRING_random_length_constrained(const asn_TYPE_descriptor_t *, const asn_encoding_constraints_t *, size_t max_length)
Definition: OCTET_STRING_rfill.c:146
asn_OCTET_STRING_specifics_t
struct asn_OCTET_STRING_specifics_s asn_OCTET_STRING_specifics_t
asn_encoding_constraints_s
Definition: constr_TYPE.h:208
OCTET_STRING
Definition: OCTET_STRING.h:14
OCTET_STRING_encode_oer
oer_type_encoder_f OCTET_STRING_encode_oer
Definition: OCTET_STRING.h:58
_stack_el::want_nulls
int want_nulls
Definition: OCTET_STRING.h:152
OCTET_STRING_print
asn_struct_print_f OCTET_STRING_print
Definition: OCTET_STRING.h:27
_stack
Definition: OCTET_STRING.h:158
_stack_el::left
ber_tlv_len_t left
Definition: OCTET_STRING.h:149
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
asn_OCTET_STRING_specifics_s::ASN_OSUBV_BIT
@ ASN_OSUBV_BIT
Definition: OCTET_STRING.h:136
OCTET_STRING_encode_xer
xer_type_encoder_f OCTET_STRING_encode_xer
Definition: OCTET_STRING.h:45
OCTET_STRING_copy
asn_struct_copy_f OCTET_STRING_copy
Definition: OCTET_STRING.h:32
_stack_el::prev
struct _stack_el * prev
Definition: OCTET_STRING.h:155
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_application.h
OCTET_STRING_decode_xer_hex
xer_type_decoder_f OCTET_STRING_decode_xer_hex
Definition: OCTET_STRING.h:42
asn_per_constraints_s
Definition: per_support.h:30
OCTET_STRING_per_get_characters
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)
Definition: OCTET_STRING.c:295
asn_OCTET_STRING_specifics_s::ASN_OSUBV_ANY
@ ASN_OSUBV_ANY
Definition: OCTET_STRING.h:135
asn_OCTET_STRING_specifics_s::asn_OS_Subvariant
asn_OS_Subvariant
Definition: OCTET_STRING.h:134
asn_struct_copy_f
int() asn_struct_copy_f(const struct asn_TYPE_descriptor_s *type_descriptor, void **struct_A, const void *struct_B)
Definition: constr_TYPE.h:150
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
asn_struct_free_f
void() asn_struct_free_f(const struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, enum asn_struct_free_method)
Definition: constr_TYPE.h:95
OCTET_STRING_t
struct OCTET_STRING OCTET_STRING_t
asn_OCTET_STRING_specifics_s::ASN_OSUBV_U32
@ ASN_OSUBV_U32
Definition: OCTET_STRING.h:139
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_cpm_ts_coding
Author(s): Jean-Pierre Busch , Guido Küppers , Lennart Reiher
autogenerated on Sun May 18 2025 02:22:38