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