eerimoq / asn1tools
1
/**
2
 * The MIT License (MIT)
3
 *
4
 * Copyright (c) 2018-2019 Erik Moqvist
5
 *
6
 * Permission is hereby granted, free of charge, to any person
7
 * obtaining a copy of this software and associated documentation
8
 * files (the "Software"), to deal in the Software without
9
 * restriction, including without limitation the rights to use, copy,
10
 * modify, merge, publish, distribute, sublicense, and/or sell copies
11
 * of the Software, and to permit persons to whom the Software is
12
 * furnished to do so, subject to the following conditions:
13
 *
14
 * The above copyright notice and this permission notice shall be
15
 * included in all copies or substantial portions of the Software.
16
 *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
 * SOFTWARE.
25
 */
26

27
/**
28
 * This file was generated by asn1tools version 0.146.6 Tue Apr 14 16:08:00 2020.
29
 */
30

31
#include <string.h>
32

33
#include "c_source-minus.h"
34

35
struct encoder_t {
36
    uint8_t *buf_p;
37
    ssize_t size;
38
    ssize_t pos;
39
};
40

41
struct decoder_t {
42
    const uint8_t *buf_p;
43
    ssize_t size;
44
    ssize_t pos;
45
};
46

47 0
static void encoder_init(struct encoder_t *self_p,
48
                         uint8_t *buf_p,
49
                         size_t size)
50
{
51 0
    self_p->buf_p = buf_p;
52 0
    self_p->size = (ssize_t)size;
53 0
    self_p->pos = 0;
54
}
55

56 0
static ssize_t encoder_get_result(const struct encoder_t *self_p)
57
{
58 0
    return (self_p->pos);
59
}
60

61 0
static void decoder_init(struct decoder_t *self_p,
62
                         const uint8_t *buf_p,
63
                         size_t size)
64
{
65 0
    self_p->buf_p = buf_p;
66 0
    self_p->size = (ssize_t)size;
67 0
    self_p->pos = 0;
68
}
69

70 0
static ssize_t decoder_get_result(const struct decoder_t *self_p)
71
{
72 0
    return (self_p->pos);
73
}
74

75 0
static void c_source_minus_foo_a_encode_inner(
76
    struct encoder_t *encoder_p,
77
    const struct c_source_minus_foo_a_t *src_p)
78
{
79
    (void)encoder_p;
80
    (void)src_p;
81
}
82

83 0
static void c_source_minus_foo_a_decode_inner(
84
    struct decoder_t *decoder_p,
85
    struct c_source_minus_foo_a_t *dst_p)
86
{
87
    (void)decoder_p;
88
    (void)dst_p;
89
}
90

91 0
ssize_t c_source_minus_foo_a_encode(
92
    uint8_t *dst_p,
93
    size_t size,
94
    const struct c_source_minus_foo_a_t *src_p)
95
{
96
    struct encoder_t encoder;
97

98 0
    encoder_init(&encoder, dst_p, size);
99 0
    c_source_minus_foo_a_encode_inner(&encoder, src_p);
100

101 0
    return (encoder_get_result(&encoder));
102
}
103

104 0
ssize_t c_source_minus_foo_a_decode(
105
    struct c_source_minus_foo_a_t *dst_p,
106
    const uint8_t *src_p,
107
    size_t size)
108
{
109
    struct decoder_t decoder;
110

111 0
    decoder_init(&decoder, src_p, size);
112 0
    c_source_minus_foo_a_decode_inner(&decoder, dst_p);
113

114 0
    return (decoder_get_result(&decoder));
115
}

Read our documentation on viewing source code .

Loading