Don't conditionalize prototypes; delete macros supporting it. (Maybe overdone;
[krb5.git] / src / lib / krb5 / asn.1 / asn1_k_decode.h
1 /*
2  * src/lib/krb5/asn.1/asn1_k_decode.h
3  * 
4  * Copyright 1994 by the Massachusetts Institute of Technology.
5  * All Rights Reserved.
6  *
7  * Export of this software from the United States of America may
8  *   require a specific license from the United States Government.
9  *   It is the responsibility of any person or organization contemplating
10  *   export to obtain such a license before exporting.
11  * 
12  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13  * distribute this software and its documentation for any purpose and
14  * without fee is hereby granted, provided that the above copyright
15  * notice appear in all copies and that both that copyright notice and
16  * this permission notice appear in supporting documentation, and that
17  * the name of M.I.T. not be used in advertising or publicity pertaining
18  * to distribution of the software without specific, written prior
19  * permission.  Furthermore if you modify this software you must label
20  * your software as modified software and not distribute it in such a
21  * fashion that it might be confused with the original M.I.T. software.
22  * M.I.T. makes no representations about the suitability of
23  * this software for any purpose.  It is provided "as is" without express
24  * or implied warranty.
25  */
26
27 #ifndef __ASN1_DECODE_KRB5_H__
28 #define __ASN1_DECODE_KRB5_H__
29
30 #include "k5-int.h"
31 #include "krbasn1.h"
32 #include "asn1buf.h"
33
34 /* asn1_error_code asn1_decode_scalar_type(asn1buf *buf, krb5_scalar *val); */
35 /* requires  *buf is allocated, *buf's current position points to the
36               beginning of an encoding (<id> <len> <contents>),
37               *val is allocated
38    effects   Decodes the encoding in *buf, returning the result in *val.
39              Returns ASN1_BAD_ID if the encoded id does not
40               indicate the proper type.
41              Returns ASN1_OVERRUN if the encoded length exceeds
42               the bounds of *buf */
43
44
45 /* asn1_error_code asn1_decode_structure_type(asn1buf *buf,
46                                               krb5_structure *val); */
47 /* requires  *buf is allocated, *buf's current position points to the
48               beginning of an encoding (<id> <len> <contents>),
49               *val is allocated
50              Assumes that *val is a freshly-allocated structure (i.e.
51               does not attempt to clean up or free *val).
52    effects   Decodes the encoding in *buf, returning the result in *val.
53              Returns ASN1_BAD_ID if the encoded id does not
54               indicate the proper type.
55              Returns ASN1_OVERRUN if the encoded length exceeds
56               the bounds of *buf */
57
58 /* asn1_error_code asn1_decode_array_type(asn1buf *buf, krb5_scalar ***val); */
59 /* requires  *buf is allocated, *buf's current position points to the
60               beginning of an encoding (<id> <len> <contents>)
61              Assumes that *val is empty (i.e. does not attempt to
62               clean up or free *val).
63    effects   Decodes the encoding in *buf, returning the result in *val.
64              Returns ASN1_BAD_ID if the encoded id does not
65               indicate the proper type.
66              Returns ASN1_OVERRUN if the encoded length exceeds
67               the bounds of *buf */
68
69 /* scalars */
70 asn1_error_code asn1_decode_int
71         (asn1buf *buf, int *val);
72 asn1_error_code asn1_decode_int32
73         (asn1buf *buf, krb5_int32 *val);
74 asn1_error_code asn1_decode_kvno
75         (asn1buf *buf, krb5_kvno *val);
76 asn1_error_code asn1_decode_enctype
77         (asn1buf *buf, krb5_enctype *val);
78 asn1_error_code asn1_decode_msgtype
79         (asn1buf *buf, krb5_msgtype *val);
80 asn1_error_code asn1_decode_cksumtype
81         (asn1buf *buf, krb5_cksumtype *val);
82 asn1_error_code asn1_decode_octet
83         (asn1buf *buf, krb5_octet *val);
84 asn1_error_code asn1_decode_addrtype
85         (asn1buf *buf, krb5_addrtype *val);
86 asn1_error_code asn1_decode_authdatatype
87         (asn1buf *buf, krb5_authdatatype *val);
88 asn1_error_code asn1_decode_ui_2
89         (asn1buf *buf, krb5_ui_2 *val);
90 asn1_error_code asn1_decode_ui_4
91         (asn1buf *buf, krb5_ui_4 *val);
92 asn1_error_code asn1_decode_kerberos_time
93         (asn1buf *buf, krb5_timestamp *val);
94 asn1_error_code asn1_decode_sam_flags
95         (asn1buf *buf, krb5_flags *val);
96
97 /* structures */
98 asn1_error_code asn1_decode_realm
99         (asn1buf *buf, krb5_principal *val);
100 asn1_error_code asn1_decode_principal_name
101         (asn1buf *buf, krb5_principal *val);
102 asn1_error_code asn1_decode_checksum
103         (asn1buf *buf, krb5_checksum *val);
104 asn1_error_code asn1_decode_encryption_key
105         (asn1buf *buf, krb5_keyblock *val);
106 asn1_error_code asn1_decode_encrypted_data
107         (asn1buf *buf, krb5_enc_data *val);
108 asn1_error_code asn1_decode_ticket_flags
109         (asn1buf *buf, krb5_flags *val);
110 asn1_error_code asn1_decode_transited_encoding
111         (asn1buf *buf, krb5_transited *val);
112 asn1_error_code asn1_decode_enc_kdc_rep_part
113         (asn1buf *buf, krb5_enc_kdc_rep_part *val);
114 asn1_error_code asn1_decode_krb5_flags
115         (asn1buf *buf, krb5_flags *val);
116 asn1_error_code asn1_decode_ap_options
117         (asn1buf *buf, krb5_flags *val);
118 asn1_error_code asn1_decode_kdc_options
119         (asn1buf *buf, krb5_flags *val);
120 asn1_error_code asn1_decode_ticket
121         (asn1buf *buf, krb5_ticket *val);
122 asn1_error_code asn1_decode_kdc_req
123         (asn1buf *buf, krb5_kdc_req *val);
124 asn1_error_code asn1_decode_kdc_req_body
125         (asn1buf *buf, krb5_kdc_req *val);
126 asn1_error_code asn1_decode_krb_safe_body
127         (asn1buf *buf, krb5_safe *val);
128 asn1_error_code asn1_decode_host_address
129         (asn1buf *buf, krb5_address *val);
130 asn1_error_code asn1_decode_kdc_rep
131         (asn1buf *buf, krb5_kdc_rep *val);
132 asn1_error_code asn1_decode_last_req_entry
133         (asn1buf *buf, krb5_last_req_entry *val);
134 asn1_error_code asn1_decode_authdata_elt
135         (asn1buf *buf, krb5_authdata *val);
136 asn1_error_code asn1_decode_krb_cred_info
137         (asn1buf *buf, krb5_cred_info *val);
138 asn1_error_code asn1_decode_pa_data
139         (asn1buf *buf, krb5_pa_data *val);
140 asn1_error_code asn1_decode_passwdsequence
141         (asn1buf *buf, passwd_phrase_element *val);
142 asn1_error_code asn1_decode_etype_info_entry
143         (asn1buf *buf, krb5_etype_info_entry *val);
144 asn1_error_code asn1_decode_sam_challenge
145         (asn1buf *buf, krb5_sam_challenge *val);
146 asn1_error_code asn1_decode_enc_sam_key
147         (asn1buf *buf, krb5_sam_key *val);
148 asn1_error_code asn1_decode_enc_sam_response_enc
149         (asn1buf *buf, krb5_enc_sam_response_enc *val);
150 asn1_error_code asn1_decode_sam_response
151         (asn1buf *buf, krb5_sam_response *val);
152 asn1_error_code asn1_decode_predicted_sam_response
153         (asn1buf *buf, krb5_predicted_sam_response *val);
154
155 /* arrays */
156 asn1_error_code asn1_decode_authorization_data
157         (asn1buf *buf, krb5_authdata ***val);
158 asn1_error_code asn1_decode_host_addresses
159         (asn1buf *buf, krb5_address ***val);
160 asn1_error_code asn1_decode_sequence_of_ticket
161         (asn1buf *buf, krb5_ticket ***val);
162 asn1_error_code asn1_decode_sequence_of_krb_cred_info
163         (asn1buf *buf, krb5_cred_info ***val);
164 asn1_error_code asn1_decode_sequence_of_pa_data
165         (asn1buf *buf, krb5_pa_data ***val);
166 asn1_error_code asn1_decode_last_req
167         (asn1buf *buf, krb5_last_req_entry ***val);
168
169 asn1_error_code asn1_decode_sequence_of_enctype
170         (asn1buf *buf, int *num, krb5_enctype **val);
171
172 asn1_error_code asn1_decode_sequence_of_passwdsequence
173         (asn1buf *buf, passwd_phrase_element ***val);
174
175 asn1_error_code asn1_decode_etype_info
176         (asn1buf *buf, krb5_etype_info_entry ***val);
177
178
179 #endif