jer_encoder.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
5 #ifndef _JER_ENCODER_H_
6 #define _JER_ENCODER_H_
7 
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 struct asn_TYPE_descriptor_s; /* Forward declaration */
16 
17 /*
18  * Flags used by the jer_encode() and (*jer_type_encoder_f), defined below
19  */
21  /* Mode of encoding */
22  JER_F = 0x01, /* JER (pretty-printing) */
23  JER_F_MINIFIED = 0x02, /* JER (minified) */
24 };
25 
26 /*
27  * The JER encoder of any type. May be invoked by the application.
28  * Produces JER output.
29  */
30 asn_enc_rval_t jer_encode(const struct asn_TYPE_descriptor_s *type_descriptor,
31  const void *struct_ptr, /* Structure to be encoded */
32  enum jer_encoder_flags_e jer_flags,
33  asn_app_consume_bytes_f *consume_bytes_cb,
34  void *app_key /* Arbitrary callback argument */
35 );
36 
37 /*
38  * The variant of the above function which dumps the JER
39  * output into the chosen file pointer.
40  * RETURN VALUES:
41  * 0: The structure is printed.
42  * -1: Problem printing the structure.
43  * WARNING: No sensible errno value is returned.
44  */
45 int jer_fprint(FILE *stream, const struct asn_TYPE_descriptor_s *td,
46  const void *struct_ptr);
47 
48 /*
49  * A helper function that uses JER encoding/decoding to verify that:
50  * - Both structures encode into the same JER.
51  * - Both resulting JER byte streams can be decoded back.
52  * - Both decoded structures encode into the same JER (round-trip).
53  * All of this verifies equivalence between structures and a round-trip.
54  * ARGUMENTS:
55  * (opt_debug_stream) - If specified, prints ongoing details.
56  */
58  JEQ_SUCCESS, /* The only completely positive return value */
59  JEQ_FAILURE, /* General failure */
60  JEQ_ENCODE1_FAILED, /* First structure JER encoding failed */
61  JEQ_ENCODE2_FAILED, /* Second structure JER encoding failed */
62  JEQ_DIFFERENT, /* Structures encoded into different JER */
63  JEQ_DECODE_FAILED, /* Decode of the JER data failed */
64  JEQ_ROUND_TRIP_FAILED /* Bad round-trip */
65 };
67  const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct1,
68  const void *struct2, FILE *opt_debug_stream);
69 
70 /*
71  * Type of the generic JER encoder.
72  */
74  const struct asn_TYPE_descriptor_s *type_descriptor,
75  const asn_jer_constraints_t *constraints,
76  const void *struct_ptr, /* Structure to be encoded */
77  int ilevel, /* Level of indentation */
78  enum jer_encoder_flags_e jer_flags,
79  asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
80  void *app_key /* Arbitrary callback argument */
81 );
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif /* _JER_ENCODER_H_ */
jer_support.h
JEQ_DIFFERENT
@ JEQ_DIFFERENT
Definition: jer_encoder.h:62
asn_jer_constraints_s
Definition: jer_support.h:18
jer_fprint
int jer_fprint(FILE *stream, const struct asn_TYPE_descriptor_s *td, const void *struct_ptr)
asn_enc_rval_s
Definition: asn_codecs.h:41
jer_encoder_flags_e
jer_encoder_flags_e
Definition: jer_encoder.h:20
JER_F
@ JER_F
Definition: jer_encoder.h:22
JER_F_MINIFIED
@ JER_F_MINIFIED
Definition: jer_encoder.h:23
JEQ_ENCODE1_FAILED
@ JEQ_ENCODE1_FAILED
Definition: jer_encoder.h:60
JEQ_SUCCESS
@ JEQ_SUCCESS
Definition: jer_encoder.h:58
JEQ_ENCODE2_FAILED
@ JEQ_ENCODE2_FAILED
Definition: jer_encoder.h:61
jer_equivalent
enum jer_equivalence_e jer_equivalent(const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct1, const void *struct2, FILE *opt_debug_stream)
asn_TYPE_descriptor_s
Definition: constr_TYPE.h:224
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
JEQ_ROUND_TRIP_FAILED
@ JEQ_ROUND_TRIP_FAILED
Definition: jer_encoder.h:64
JEQ_FAILURE
@ JEQ_FAILURE
Definition: jer_encoder.h:59
jer_encode
asn_enc_rval_t jer_encode(const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, enum jer_encoder_flags_e jer_flags, asn_app_consume_bytes_f *consume_bytes_cb, void *app_key)
asn_enc_rval_t
struct asn_enc_rval_s asn_enc_rval_t
asn_app_consume_bytes_f
int() asn_app_consume_bytes_f(const void *buffer, size_t size, void *application_specific_key)
Definition: asn_application.h:124
asn_application.h
jer_equivalence_e
jer_equivalence_e
Definition: jer_encoder.h:57
JEQ_DECODE_FAILED
@ JEQ_DECODE_FAILED
Definition: jer_encoder.h:63


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