]> git.stg.codes - stg.git/blob - libs/smux/IpAddress.c
Build and test in both Debug and Release mode.
[stg.git] / libs / smux / IpAddress.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 "IpAddress.h"
9
10 int
11 IpAddress_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
12                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
13         const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
14         size_t size;
15         
16         if(!sptr) {
17                 ASN__CTFAIL(app_key, td, sptr,
18                         "%s: value not given (%s:%d)",
19                         td->name, __FILE__, __LINE__);
20                 return -1;
21         }
22         
23         size = st->size;
24         
25         if((size == 4)) {
26                 /* Constraint check succeeded */
27                 return 0;
28         } else {
29                 ASN__CTFAIL(app_key, td, sptr,
30                         "%s: constraint failed (%s:%d)",
31                         td->name, __FILE__, __LINE__);
32                 return -1;
33         }
34 }
35
36 /*
37  * This type is implemented using OCTET_STRING,
38  * so here we adjust the DEF accordingly.
39  */
40 static void
41 IpAddress_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
42         td->free_struct    = asn_DEF_OCTET_STRING.free_struct;
43         td->print_struct   = asn_DEF_OCTET_STRING.print_struct;
44         td->check_constraints = asn_DEF_OCTET_STRING.check_constraints;
45         td->ber_decoder    = asn_DEF_OCTET_STRING.ber_decoder;
46         td->der_encoder    = asn_DEF_OCTET_STRING.der_encoder;
47         td->xer_decoder    = asn_DEF_OCTET_STRING.xer_decoder;
48         td->xer_encoder    = asn_DEF_OCTET_STRING.xer_encoder;
49         td->uper_decoder   = asn_DEF_OCTET_STRING.uper_decoder;
50         td->uper_encoder   = asn_DEF_OCTET_STRING.uper_encoder;
51         if(!td->per_constraints)
52                 td->per_constraints = asn_DEF_OCTET_STRING.per_constraints;
53         td->elements       = asn_DEF_OCTET_STRING.elements;
54         td->elements_count = asn_DEF_OCTET_STRING.elements_count;
55         td->specifics      = asn_DEF_OCTET_STRING.specifics;
56 }
57
58 void
59 IpAddress_free(asn_TYPE_descriptor_t *td,
60                 void *struct_ptr, int contents_only) {
61         IpAddress_1_inherit_TYPE_descriptor(td);
62         td->free_struct(td, struct_ptr, contents_only);
63 }
64
65 int
66 IpAddress_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
67                 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
68         IpAddress_1_inherit_TYPE_descriptor(td);
69         return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
70 }
71
72 asn_dec_rval_t
73 IpAddress_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
74                 void **structure, const void *bufptr, size_t size, int tag_mode) {
75         IpAddress_1_inherit_TYPE_descriptor(td);
76         return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
77 }
78
79 asn_enc_rval_t
80 IpAddress_encode_der(asn_TYPE_descriptor_t *td,
81                 void *structure, int tag_mode, ber_tlv_tag_t tag,
82                 asn_app_consume_bytes_f *cb, void *app_key) {
83         IpAddress_1_inherit_TYPE_descriptor(td);
84         return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
85 }
86
87 asn_dec_rval_t
88 IpAddress_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
89                 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
90         IpAddress_1_inherit_TYPE_descriptor(td);
91         return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
92 }
93
94 asn_enc_rval_t
95 IpAddress_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
96                 int ilevel, enum xer_encoder_flags_e flags,
97                 asn_app_consume_bytes_f *cb, void *app_key) {
98         IpAddress_1_inherit_TYPE_descriptor(td);
99         return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
100 }
101
102 static const ber_tlv_tag_t asn_DEF_IpAddress_tags_1[] = {
103         (ASN_TAG_CLASS_APPLICATION | (0 << 2)),
104         (ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
105 };
106 asn_TYPE_descriptor_t asn_DEF_IpAddress = {
107         "IpAddress",
108         "IpAddress",
109         IpAddress_free,
110         IpAddress_print,
111         IpAddress_constraint,
112         IpAddress_decode_ber,
113         IpAddress_encode_der,
114         IpAddress_decode_xer,
115         IpAddress_encode_xer,
116         0, 0,   /* No PER support, use "-gen-PER" to enable */
117         0,      /* Use generic outmost tag fetcher */
118         asn_DEF_IpAddress_tags_1,
119         sizeof(asn_DEF_IpAddress_tags_1)
120                 /sizeof(asn_DEF_IpAddress_tags_1[0]) - 1, /* 1 */
121         asn_DEF_IpAddress_tags_1,       /* Same as above */
122         sizeof(asn_DEF_IpAddress_tags_1)
123                 /sizeof(asn_DEF_IpAddress_tags_1[0]), /* 2 */
124         0,      /* No PER visible constraints */
125         0, 0,   /* No members */
126         0       /* No specifics */
127 };
128