/src/open5gs/lib/asn1c/common/NULL_aper.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. |
3 | | * All rights reserved. |
4 | | * Redistribution and modifications are permitted subject to BSD license. |
5 | | */ |
6 | | #include <asn_internal.h> |
7 | | #include <NULL.h> |
8 | | |
9 | | asn_dec_rval_t |
10 | | NULL_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, |
11 | | const asn_TYPE_descriptor_t *td, |
12 | 115 | const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { |
13 | 115 | asn_dec_rval_t rv = {RC_OK, 0}; |
14 | | |
15 | 115 | (void)opt_codec_ctx; |
16 | 115 | (void)td; |
17 | 115 | (void)constraints; |
18 | 115 | (void)pd; |
19 | | |
20 | 115 | if(!*sptr) { |
21 | 0 | *sptr = MALLOC(sizeof(NULL_t)); |
22 | 0 | if(*sptr) { |
23 | 0 | *(NULL_t *)*sptr = 0; |
24 | 0 | } else { |
25 | 0 | ASN__DECODE_FAILED; |
26 | 0 | } |
27 | 0 | } |
28 | | |
29 | | /* |
30 | | * NULL type does not have content octets but has to align |
31 | | */ |
32 | | |
33 | 115 | if (aper_get_align(pd) < 0) |
34 | 0 | ASN__DECODE_FAILED; |
35 | | |
36 | 115 | rv.code = RC_OK; |
37 | 115 | rv.consumed = 0; |
38 | 115 | return rv; |
39 | 115 | } |
40 | | |
41 | | |
42 | | asn_enc_rval_t |
43 | | NULL_encode_aper(const asn_TYPE_descriptor_t *td, |
44 | | const asn_per_constraints_t *constraints, |
45 | 0 | const void *sptr, asn_per_outp_t *po) { |
46 | 0 | asn_enc_rval_t er = {0,0,0}; |
47 | |
|
48 | 0 | (void)td; |
49 | 0 | (void)constraints; |
50 | 0 | (void)sptr; |
51 | 0 | (void)po; |
52 | |
|
53 | 0 | if (aper_put_align(po) < 0) |
54 | 0 | ASN__ENCODE_FAILED; |
55 | | |
56 | 0 | er.encoded = 0; |
57 | 0 | ASN__ENCODED_OK(er); |
58 | 0 | } |