constr_CHOICE.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 _CONSTR_CHOICE_H_
  6. #define _CONSTR_CHOICE_H_
  7. #include <asn_application.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. typedef struct asn_CHOICE_specifics_s {
  12. /*
  13. * Target structure description.
  14. */
  15. unsigned struct_size; /* Size of the target structure. */
  16. unsigned ctx_offset; /* Offset of the asn_codec_ctx_t member */
  17. unsigned pres_offset; /* Identifier of the present member */
  18. unsigned pres_size; /* Size of the identifier (enum) */
  19. /*
  20. * Tags to members mapping table.
  21. */
  22. const asn_TYPE_tag2member_t *tag2el;
  23. unsigned tag2el_count;
  24. /* Canonical ordering of CHOICE elements, for PER */
  25. const unsigned *to_canonical_order;
  26. const unsigned *from_canonical_order;
  27. /*
  28. * Extensions-related stuff.
  29. */
  30. signed ext_start; /* First member of extensions, or -1 */
  31. } asn_CHOICE_specifics_t;
  32. /*
  33. * A set specialized functions dealing with the CHOICE type.
  34. */
  35. asn_struct_free_f CHOICE_free;
  36. asn_struct_print_f CHOICE_print;
  37. asn_struct_compare_f CHOICE_compare;
  38. asn_constr_check_f CHOICE_constraint;
  39. ber_type_decoder_f CHOICE_decode_ber;
  40. der_type_encoder_f CHOICE_encode_der;
  41. xer_type_decoder_f CHOICE_decode_xer;
  42. xer_type_encoder_f CHOICE_encode_xer;
  43. oer_type_decoder_f CHOICE_decode_oer;
  44. oer_type_encoder_f CHOICE_encode_oer;
  45. per_type_decoder_f CHOICE_decode_uper;
  46. per_type_encoder_f CHOICE_encode_uper;
  47. asn_outmost_tag_f CHOICE_outmost_tag;
  48. asn_random_fill_f CHOICE_random_fill;
  49. extern asn_TYPE_operation_t asn_OP_CHOICE;
  50. /*
  51. * Return the 1-based choice variant presence index.
  52. * Returns 0 in case of error.
  53. */
  54. unsigned CHOICE_variant_get_presence(const asn_TYPE_descriptor_t *td,
  55. const void *structure_ptr);
  56. /*
  57. * Sets or resets the 1-based choice variant presence index.
  58. * In case a previous index is not zero, the currently selected structure
  59. * member is freed and zeroed-out first.
  60. * Returns 0 on success and -1 on error.
  61. */
  62. int CHOICE_variant_set_presence(const asn_TYPE_descriptor_t *td,
  63. void *structure_ptr, unsigned present);
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif /* _CONSTR_CHOICE_H_ */