~ubuntu-branches/ubuntu/wily/freerdp/wily-proposed

« back to all changes in this revision

Viewing changes to asn1/NULL.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt, Jeremy Bicha, Jean-Louis Dupond, Martin Pitt
  • Date: 2012-01-31 10:02:14 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120131100214-jaok3uwvni7sqxth
Tags: 1.0.0-0git1
Upload current Debian packaging git to get this rolling for precise.

[ Jeremy Bicha ]
* New upstream release. Closes: #647498.
* Updated symbols and bumped soname
* debian/control:
  - Added new build dependencies
  - Bump Standards-Version to 3.9.2
* debian/source/format: Set to 3.0 (quilt)
* debian/rules: Turn on strict symbols checking
* debian/watch: Watch github

[ Jean-Louis Dupond ]
* debian/control: Updated homepage
* debian/copyright: Reflect upstream switch to the Apache license

[ Martin Pitt ]
* debian/libfreerdp0.symbols: Fix version number, should
  be 1.0~beta5, not 1.0-beta5.
* debian/control: Add libavcodec-dev build dependency, upstream build system
  checks for that. Thanks Jean-Louis Dupond!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*-
2
 
 * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
3
 
 * Redistribution and modifications are permitted subject to BSD license.
4
 
 */
5
 
#include <asn_internal.h>
6
 
#include <asn_codecs_prim.h>
7
 
#include <NULL.h>
8
 
#include <BOOLEAN.h>    /* Implemented in terms of BOOLEAN type */
9
 
 
10
 
/*
11
 
 * NULL basic type description.
12
 
 */
13
 
static ber_tlv_tag_t asn_DEF_NULL_tags[] = {
14
 
        (ASN_TAG_CLASS_UNIVERSAL | (5 << 2))
15
 
};
16
 
asn_TYPE_descriptor_t asn_DEF_NULL = {
17
 
        "NULL",
18
 
        "NULL",
19
 
        BOOLEAN_free,
20
 
        NULL_print,
21
 
        asn_generic_no_constraint,
22
 
        BOOLEAN_decode_ber,     /* Implemented in terms of BOOLEAN */
23
 
        NULL_encode_der,        /* Special handling of DER encoding */
24
 
        NULL_decode_xer,
25
 
        NULL_encode_xer,
26
 
        NULL_decode_uper,       /* Unaligned PER decoder */
27
 
        NULL_encode_uper,       /* Unaligned PER encoder */
28
 
        0, /* Use generic outmost tag fetcher */
29
 
        asn_DEF_NULL_tags,
30
 
        sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]),
31
 
        asn_DEF_NULL_tags,      /* Same as above */
32
 
        sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]),
33
 
        0,      /* No PER visible constraints */
34
 
        0, 0,   /* No members */
35
 
        0       /* No specifics */
36
 
};
37
 
 
38
 
asn_enc_rval_t
39
 
NULL_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
40
 
        int tag_mode, ber_tlv_tag_t tag,
41
 
        asn_app_consume_bytes_f *cb, void *app_key) {
42
 
        asn_enc_rval_t erval;
43
 
 
44
 
        erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key);
45
 
        if(erval.encoded == -1) {
46
 
                erval.failed_type = td;
47
 
                erval.structure_ptr = ptr;
48
 
        }
49
 
 
50
 
        _ASN_ENCODED_OK(erval);
51
 
}
52
 
 
53
 
asn_enc_rval_t
54
 
NULL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
55
 
        int ilevel, enum xer_encoder_flags_e flags,
56
 
                asn_app_consume_bytes_f *cb, void *app_key) {
57
 
        asn_enc_rval_t er;
58
 
 
59
 
        (void)td;
60
 
        (void)sptr;
61
 
        (void)ilevel;
62
 
        (void)flags;
63
 
        (void)cb;
64
 
        (void)app_key;
65
 
 
66
 
        /* XMLNullValue is empty */
67
 
        er.encoded = 0;
68
 
        _ASN_ENCODED_OK(er);
69
 
}
70
 
 
71
 
 
72
 
static enum xer_pbd_rval
73
 
NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
74
 
        (void)td;
75
 
        (void)sptr;
76
 
 
77
 
        if(xer_is_whitespace(chunk_buf, chunk_size))
78
 
                return XPBD_BODY_CONSUMED;
79
 
        else
80
 
                return XPBD_BROKEN_ENCODING;
81
 
}
82
 
 
83
 
asn_dec_rval_t
84
 
NULL_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
85
 
        asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
86
 
                const void *buf_ptr, size_t size) {
87
 
 
88
 
        return xer_decode_primitive(opt_codec_ctx, td,
89
 
                sptr, sizeof(NULL_t), opt_mname, buf_ptr, size,
90
 
                NULL__xer_body_decode);
91
 
}
92
 
 
93
 
int
94
 
NULL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
95
 
        asn_app_consume_bytes_f *cb, void *app_key) {
96
 
 
97
 
        (void)td;       /* Unused argument */
98
 
        (void)ilevel;   /* Unused argument */
99
 
 
100
 
        if(sptr) {
101
 
                return (cb("<present>", 9, app_key) < 0) ? -1 : 0;
102
 
        } else {
103
 
                return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
104
 
        }
105
 
}
106
 
 
107
 
asn_dec_rval_t
108
 
NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
109
 
        asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
110
 
        asn_dec_rval_t rv;
111
 
 
112
 
        (void)opt_codec_ctx;
113
 
        (void)td;
114
 
        (void)constraints;
115
 
        (void)pd;
116
 
 
117
 
        if(!*sptr) {
118
 
                *sptr = MALLOC(sizeof(NULL_t));
119
 
                if(*sptr) {
120
 
                        *(NULL_t *)*sptr = 0;
121
 
                } else {
122
 
                        _ASN_DECODE_FAILED;
123
 
                }
124
 
        }
125
 
 
126
 
        /*
127
 
         * NULL type does not have content octets.
128
 
         */
129
 
 
130
 
        rv.code = RC_OK;
131
 
        rv.consumed = 0;
132
 
        return rv;
133
 
}
134
 
 
135
 
asn_enc_rval_t
136
 
NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
137
 
                void *sptr, asn_per_outp_t *po) {
138
 
        asn_enc_rval_t er;
139
 
 
140
 
        (void)td;
141
 
        (void)constraints;
142
 
        (void)sptr;
143
 
        (void)po;
144
 
 
145
 
        er.encoded = 0;
146
 
        _ASN_ENCODED_OK(er);
147
 
}