]> git.stg.codes - stg.git/blob - libs/smux/Counter.c
Fix old-style casts.
[stg.git] / libs / smux / Counter.c
1 /*
2  * Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
3  * From ASN.1 module "RFC1155-SMI"
4  *      found in "RFC1155-SMI.asn1"
5  *      `asn1c -S/mnt/data/software/asn1c/skeletons -fcompound-names -fwide-types`
6  */
7
8 #include "Counter.h"
9
10 int
11 Counter_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
12                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
13         
14         if(!sptr) {
15                 ASN__CTFAIL(app_key, td, sptr,
16                         "%s: value not given (%s:%d)",
17                         td->name, __FILE__, __LINE__);
18                 return -1;
19         }
20         
21         
22         /* Constraint check succeeded */
23         return 0;
24 }
25
26 /*
27  * This type is implemented using NativeInteger,
28  * so here we adjust the DEF accordingly.
29  */
30 static void
31 Counter_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
32         td->free_struct    = asn_DEF_NativeInteger.free_struct;
33         td->print_struct   = asn_DEF_NativeInteger.print_struct;
34         td->check_constraints = asn_DEF_NativeInteger.check_constraints;
35         td->ber_decoder    = asn_DEF_NativeInteger.ber_decoder;
36         td->der_encoder    = asn_DEF_NativeInteger.der_encoder;
37         td->xer_decoder    = asn_DEF_NativeInteger.xer_decoder;
38         td->xer_encoder    = asn_DEF_NativeInteger.xer_encoder;
39         td->uper_decoder   = asn_DEF_NativeInteger.uper_decoder;
40         td->uper_encoder   = asn_DEF_NativeInteger.uper_encoder;
41         if(!td->per_constraints)
42                 td->per_constraints = asn_DEF_NativeInteger.per_constraints;
43         td->elements       = asn_DEF_NativeInteger.elements;
44         td->elements_count = asn_DEF_NativeInteger.elements_count;
45      /* td->specifics      = asn_DEF_NativeInteger.specifics;   // Defined explicitly */
46 }
47
48 void
49 Counter_free(asn_TYPE_descriptor_t *td,
50                 void *struct_ptr, int contents_only) {
51         Counter_1_inherit_TYPE_descriptor(td);
52         td->free_struct(td, struct_ptr, contents_only);
53 }
54
55 int
56 Counter_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
57                 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
58         Counter_1_inherit_TYPE_descriptor(td);
59         return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
60 }
61
62 asn_dec_rval_t
63 Counter_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
64                 void **structure, const void *bufptr, size_t size, int tag_mode) {
65         Counter_1_inherit_TYPE_descriptor(td);
66         return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
67 }
68
69 asn_enc_rval_t
70 Counter_encode_der(asn_TYPE_descriptor_t *td,
71                 void *structure, int tag_mode, ber_tlv_tag_t tag,
72                 asn_app_consume_bytes_f *cb, void *app_key) {
73         Counter_1_inherit_TYPE_descriptor(td);
74         return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
75 }
76
77 asn_dec_rval_t
78 Counter_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
79                 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
80         Counter_1_inherit_TYPE_descriptor(td);
81         return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
82 }
83
84 asn_enc_rval_t
85 Counter_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
86                 int ilevel, enum xer_encoder_flags_e flags,
87                 asn_app_consume_bytes_f *cb, void *app_key) {
88         Counter_1_inherit_TYPE_descriptor(td);
89         return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
90 }
91
92 static const asn_INTEGER_specifics_t asn_SPC_Counter_specs_1 = {
93         0,      0,      0,      0,      0,
94         0,      /* Native long size */
95         1       /* Unsigned representation */
96 };
97 static const ber_tlv_tag_t asn_DEF_Counter_tags_1[] = {
98         (ASN_TAG_CLASS_APPLICATION | (1 << 2)),
99         (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
100 };
101 asn_TYPE_descriptor_t asn_DEF_Counter = {
102         "Counter",
103         "Counter",
104         Counter_free,
105         Counter_print,
106         Counter_constraint,
107         Counter_decode_ber,
108         Counter_encode_der,
109         Counter_decode_xer,
110         Counter_encode_xer,
111         0, 0,   /* No PER support, use "-gen-PER" to enable */
112         0,      /* Use generic outmost tag fetcher */
113         asn_DEF_Counter_tags_1,
114         sizeof(asn_DEF_Counter_tags_1)
115                 /sizeof(asn_DEF_Counter_tags_1[0]) - 1, /* 1 */
116         asn_DEF_Counter_tags_1, /* Same as above */
117         sizeof(asn_DEF_Counter_tags_1)
118                 /sizeof(asn_DEF_Counter_tags_1[0]), /* 2 */
119         0,      /* No PER visible constraints */
120         0, 0,   /* No members */
121         &asn_SPC_Counter_specs_1        /* Additional specs */
122 };
123