constraints.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 ASN1_CONSTRAINTS_VALIDATOR_H
6 #define ASN1_CONSTRAINTS_VALIDATOR_H
7 
8 #include <etsi_its_spatem_ts_coding/asn_system.h> /* Platform-dependent types */
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 struct asn_TYPE_descriptor_s; /* Forward declaration */
16 
17 /*
18  * Validate the structure according to the ASN.1 constraints.
19  * If errbuf and errlen are given, they shall be pointing to the appropriate
20  * buffer space and its length before calling this function. Alternatively,
21  * they could be passed as NULL's. If constraints validation fails,
22  * errlen will contain the actual number of bytes taken from the errbuf
23  * to encode an error message (properly 0-terminated).
24  *
25  * RETURN VALUES:
26  * This function returns 0 in case all ASN.1 constraints are met
27  * and -1 if one or more constraints were failed.
28  */
30  const struct asn_TYPE_descriptor_s *type_descriptor,
31  const void *struct_ptr, /* Target language's structure */
32  char *errbuf, /* Returned error description */
33  size_t *errlen /* Length of the error description */
34 );
35 
36 
37 /*
38  * Generic type for constraint checking callback,
39  * associated with every type descriptor.
40  */
41 typedef int(asn_constr_check_f)(
42  const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr,
43  asn_app_constraint_failed_f *optional_callback, /* Log the error */
44  void *optional_app_key /* Opaque key passed to a callback */
45 );
46 
47 /*******************************
48  * INTERNALLY USEFUL FUNCTIONS *
49  *******************************/
50 
51 asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */
53 
54 /*
55  * Invoke the callback with a complete error message.
56  */
57 #define ASN__CTFAIL if(ctfailcb) ctfailcb
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif /* ASN1_CONSTRAINTS_VALIDATOR_H */
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
asn_TYPE_descriptor_s
Definition: constr_TYPE.h:224
asn_generic_no_constraint
asn_constr_check_f asn_generic_no_constraint
Definition: constraints.h:51
asn_system.h
asn_constr_check_f
int() asn_constr_check_f(const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *optional_callback, void *optional_app_key)
Definition: constraints.h:41
asn_application.h
asn_generic_unknown_constraint
asn_constr_check_f asn_generic_unknown_constraint
Definition: constraints.h:52
asn_check_constraints
int asn_check_constraints(const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, char *errbuf, size_t *errlen)


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