1 /* c/zx-sp11-dec.c - WARNING: This file was auto generated by xsd2sg.pl. DO NOT EDIT!
2 * $Id$ */
3 /* Code generation design Copyright (c) 2006 Sampo Kellomaki (sampo@iki.fi),
4 * All Rights Reserved. NO WARRANTY. See file COPYING for terms and conditions
5 * of use. Some aspects of code generation were driven by schema
6 * descriptions that were used as input and may be subject to their own copyright.
7 * Code generation uses a template, whose copyright statement follows. */
8
9 /** dec-templ.c - XML decoder template, used in code generation
10 ** Copyright (c) 2010 Sampo Kellomaki (sampo@iki.fi), All Rights Reserved.
11 ** Copyright (c) 2006-2007 Symlabs (symlabs@symlabs.com), All Rights Reserved.
12 ** Author: Sampo Kellomaki (sampo@iki.fi)
13 ** This is confidential unpublished proprietary source code of the author.
14 ** NO WARRANTY, not even implied warranties. Contains trade secrets.
15 ** Distribution prohibited unless authorized in writing.
16 ** Licensed under Apache License 2.0, see file COPYING.
17 ** Id: dec-templ.c,v 1.30 2008-10-04 23:42:14 sampo Exp $
18 **
19 ** 28.5.2006, created, Sampo Kellomaki (sampo@iki.fi)
20 ** 8.8.2006, reworked namespace handling --Sampo
21 ** 12.8.2006, added special scanning of xmlns to avoid backtracking elem recognition --Sampo
22 ** 23.9.2006, added collection of WO information --Sampo
23 ** 21.6.2007, improved handling of undeclared namespace prefixes --Sampo
24 ** 27.10.2010, CSE refactoring, re-engineered namespace handling --Sampo
25 ** 21.11.2010, re-engineered to extract most code to zx_DEC_elem, leaving just switches --Sampo
26 **
27 ** N.B: This template is meant to be processed by pd/xsd2sg.pl. Beware
28 ** of special markers that xsd2sg.pl expects to find and understand.
29 **/
30
31 #include "errmac.h"
32 #include "zx.h"
33 #include "c/zx-const.h"
34 #include "c/zx-data.h"
35 #include "c/zx-sp11-data.h"
36 #define TPF zx_
37 #include "zx_ext_pt.h"
38
39
40
zx_DEC_ATTR_sp11_AttributeQuery(struct zx_ctx * c,struct zx_sp11_AttributeQuery_s * x)41 int zx_DEC_ATTR_sp11_AttributeQuery(struct zx_ctx* c, struct zx_sp11_AttributeQuery_s* x)
42 {
43 switch (x->gg.attr->g.tok) {
44 case zx_Resource_ATTR: x->Resource = x->gg.attr; return 1;
45
46 default: return 0;
47 }
48 }
49
zx_DEC_ELEM_sp11_AttributeQuery(struct zx_ctx * c,struct zx_sp11_AttributeQuery_s * x)50 int zx_DEC_ELEM_sp11_AttributeQuery(struct zx_ctx* c, struct zx_sp11_AttributeQuery_s* x)
51 {
52 struct zx_elem_s* el = x->gg.kids;
53 switch (el->g.tok) {
54 case zx_sa11_Subject_ELEM:
55 if (!x->Subject)
56 x->Subject = (struct zx_sa11_Subject_s*)el;
57 return 1;
58 case zx_sa11_AttributeDesignator_ELEM:
59 if (!x->AttributeDesignator)
60 x->AttributeDesignator = (struct zx_sa11_AttributeDesignator_s*)el;
61 return 1;
62
63 default: return 0;
64 }
65 }
66
67
68
69
zx_DEC_ATTR_sp11_AuthenticationQuery(struct zx_ctx * c,struct zx_sp11_AuthenticationQuery_s * x)70 int zx_DEC_ATTR_sp11_AuthenticationQuery(struct zx_ctx* c, struct zx_sp11_AuthenticationQuery_s* x)
71 {
72 switch (x->gg.attr->g.tok) {
73 case zx_AuthenticationMethod_ATTR: x->AuthenticationMethod = x->gg.attr; return 1;
74
75 default: return 0;
76 }
77 }
78
zx_DEC_ELEM_sp11_AuthenticationQuery(struct zx_ctx * c,struct zx_sp11_AuthenticationQuery_s * x)79 int zx_DEC_ELEM_sp11_AuthenticationQuery(struct zx_ctx* c, struct zx_sp11_AuthenticationQuery_s* x)
80 {
81 struct zx_elem_s* el = x->gg.kids;
82 switch (el->g.tok) {
83 case zx_sa11_Subject_ELEM:
84 if (!x->Subject)
85 x->Subject = (struct zx_sa11_Subject_s*)el;
86 return 1;
87
88 default: return 0;
89 }
90 }
91
92
93
94
zx_DEC_ATTR_sp11_AuthorizationDecisionQuery(struct zx_ctx * c,struct zx_sp11_AuthorizationDecisionQuery_s * x)95 int zx_DEC_ATTR_sp11_AuthorizationDecisionQuery(struct zx_ctx* c, struct zx_sp11_AuthorizationDecisionQuery_s* x)
96 {
97 switch (x->gg.attr->g.tok) {
98 case zx_Resource_ATTR: x->Resource = x->gg.attr; return 1;
99
100 default: return 0;
101 }
102 }
103
zx_DEC_ELEM_sp11_AuthorizationDecisionQuery(struct zx_ctx * c,struct zx_sp11_AuthorizationDecisionQuery_s * x)104 int zx_DEC_ELEM_sp11_AuthorizationDecisionQuery(struct zx_ctx* c, struct zx_sp11_AuthorizationDecisionQuery_s* x)
105 {
106 struct zx_elem_s* el = x->gg.kids;
107 switch (el->g.tok) {
108 case zx_sa11_Subject_ELEM:
109 if (!x->Subject)
110 x->Subject = (struct zx_sa11_Subject_s*)el;
111 return 1;
112 case zx_sa11_Action_ELEM:
113 if (!x->Action)
114 x->Action = (struct zx_sa11_Action_s*)el;
115 return 1;
116 case zx_sa11_Evidence_ELEM:
117 if (!x->Evidence)
118 x->Evidence = (struct zx_sa11_Evidence_s*)el;
119 return 1;
120
121 default: return 0;
122 }
123 }
124
125
126
127
zx_DEC_ATTR_sp11_Request(struct zx_ctx * c,struct zx_sp11_Request_s * x)128 int zx_DEC_ATTR_sp11_Request(struct zx_ctx* c, struct zx_sp11_Request_s* x)
129 {
130 switch (x->gg.attr->g.tok) {
131 case zx_IssueInstant_ATTR: x->IssueInstant = x->gg.attr; return 1;
132 case zx_MajorVersion_ATTR: x->MajorVersion = x->gg.attr; return 1;
133 case zx_MinorVersion_ATTR: x->MinorVersion = x->gg.attr; return 1;
134 case zx_RequestID_ATTR: x->RequestID = x->gg.attr; return 1;
135
136 default: return 0;
137 }
138 }
139
zx_DEC_ELEM_sp11_Request(struct zx_ctx * c,struct zx_sp11_Request_s * x)140 int zx_DEC_ELEM_sp11_Request(struct zx_ctx* c, struct zx_sp11_Request_s* x)
141 {
142 struct zx_elem_s* el = x->gg.kids;
143 switch (el->g.tok) {
144 case zx_sp11_RespondWith_ELEM:
145 if (!x->RespondWith)
146 x->RespondWith = el;
147 return 1;
148 case zx_ds_Signature_ELEM:
149 if (!x->Signature)
150 x->Signature = (struct zx_ds_Signature_s*)el;
151 return 1;
152 case zx_sp11_Query_ELEM:
153 if (!x->Query)
154 x->Query = el;
155 return 1;
156 case zx_sp11_SubjectQuery_ELEM:
157 if (!x->SubjectQuery)
158 x->SubjectQuery = (struct zx_sp11_SubjectQuery_s*)el;
159 return 1;
160 case zx_sp11_AuthenticationQuery_ELEM:
161 if (!x->AuthenticationQuery)
162 x->AuthenticationQuery = (struct zx_sp11_AuthenticationQuery_s*)el;
163 return 1;
164 case zx_sp11_AttributeQuery_ELEM:
165 if (!x->AttributeQuery)
166 x->AttributeQuery = (struct zx_sp11_AttributeQuery_s*)el;
167 return 1;
168 case zx_sp11_AuthorizationDecisionQuery_ELEM:
169 if (!x->AuthorizationDecisionQuery)
170 x->AuthorizationDecisionQuery = (struct zx_sp11_AuthorizationDecisionQuery_s*)el;
171 return 1;
172 case zx_sa11_AssertionIDReference_ELEM:
173 if (!x->AssertionIDReference)
174 x->AssertionIDReference = el;
175 return 1;
176 case zx_sp11_AssertionArtifact_ELEM:
177 if (!x->AssertionArtifact)
178 x->AssertionArtifact = el;
179 return 1;
180
181 default: return 0;
182 }
183 }
184
185
186
187
zx_DEC_ATTR_sp11_Response(struct zx_ctx * c,struct zx_sp11_Response_s * x)188 int zx_DEC_ATTR_sp11_Response(struct zx_ctx* c, struct zx_sp11_Response_s* x)
189 {
190 switch (x->gg.attr->g.tok) {
191 case zx_InResponseTo_ATTR: x->InResponseTo = x->gg.attr; return 1;
192 case zx_IssueInstant_ATTR: x->IssueInstant = x->gg.attr; return 1;
193 case zx_MajorVersion_ATTR: x->MajorVersion = x->gg.attr; return 1;
194 case zx_MinorVersion_ATTR: x->MinorVersion = x->gg.attr; return 1;
195 case zx_Recipient_ATTR: x->Recipient = x->gg.attr; return 1;
196 case zx_ResponseID_ATTR: x->ResponseID = x->gg.attr; return 1;
197
198 default: return 0;
199 }
200 }
201
zx_DEC_ELEM_sp11_Response(struct zx_ctx * c,struct zx_sp11_Response_s * x)202 int zx_DEC_ELEM_sp11_Response(struct zx_ctx* c, struct zx_sp11_Response_s* x)
203 {
204 struct zx_elem_s* el = x->gg.kids;
205 switch (el->g.tok) {
206 case zx_ds_Signature_ELEM:
207 if (!x->Signature)
208 x->Signature = (struct zx_ds_Signature_s*)el;
209 return 1;
210 case zx_sp11_Status_ELEM:
211 if (!x->Status)
212 x->Status = (struct zx_sp11_Status_s*)el;
213 return 1;
214 case zx_sa11_Assertion_ELEM:
215 if (!x->Assertion)
216 x->Assertion = (struct zx_sa11_Assertion_s*)el;
217 return 1;
218
219 default: return 0;
220 }
221 }
222
223
224
225
zx_DEC_ATTR_sp11_Status(struct zx_ctx * c,struct zx_sp11_Status_s * x)226 int zx_DEC_ATTR_sp11_Status(struct zx_ctx* c, struct zx_sp11_Status_s* x)
227 {
228 switch (x->gg.attr->g.tok) {
229
230 default: return 0;
231 }
232 }
233
zx_DEC_ELEM_sp11_Status(struct zx_ctx * c,struct zx_sp11_Status_s * x)234 int zx_DEC_ELEM_sp11_Status(struct zx_ctx* c, struct zx_sp11_Status_s* x)
235 {
236 struct zx_elem_s* el = x->gg.kids;
237 switch (el->g.tok) {
238 case zx_sp11_StatusCode_ELEM:
239 if (!x->StatusCode)
240 x->StatusCode = (struct zx_sp11_StatusCode_s*)el;
241 return 1;
242 case zx_sp11_StatusMessage_ELEM:
243 if (!x->StatusMessage)
244 x->StatusMessage = el;
245 return 1;
246 case zx_sp11_StatusDetail_ELEM:
247 if (!x->StatusDetail)
248 x->StatusDetail = (struct zx_sp11_StatusDetail_s*)el;
249 return 1;
250
251 default: return 0;
252 }
253 }
254
255
256
257
zx_DEC_ATTR_sp11_StatusCode(struct zx_ctx * c,struct zx_sp11_StatusCode_s * x)258 int zx_DEC_ATTR_sp11_StatusCode(struct zx_ctx* c, struct zx_sp11_StatusCode_s* x)
259 {
260 switch (x->gg.attr->g.tok) {
261 case zx_Value_ATTR: x->Value = x->gg.attr; return 1;
262
263 default: return 0;
264 }
265 }
266
zx_DEC_ELEM_sp11_StatusCode(struct zx_ctx * c,struct zx_sp11_StatusCode_s * x)267 int zx_DEC_ELEM_sp11_StatusCode(struct zx_ctx* c, struct zx_sp11_StatusCode_s* x)
268 {
269 struct zx_elem_s* el = x->gg.kids;
270 switch (el->g.tok) {
271 case zx_sp11_StatusCode_ELEM:
272 if (!x->StatusCode)
273 x->StatusCode = (struct zx_sp11_StatusCode_s*)el;
274 return 1;
275
276 default: return 0;
277 }
278 }
279
280
281
282
zx_DEC_ATTR_sp11_StatusDetail(struct zx_ctx * c,struct zx_sp11_StatusDetail_s * x)283 int zx_DEC_ATTR_sp11_StatusDetail(struct zx_ctx* c, struct zx_sp11_StatusDetail_s* x)
284 {
285 switch (x->gg.attr->g.tok) {
286
287 default: return 0;
288 }
289 }
290
zx_DEC_ELEM_sp11_StatusDetail(struct zx_ctx * c,struct zx_sp11_StatusDetail_s * x)291 int zx_DEC_ELEM_sp11_StatusDetail(struct zx_ctx* c, struct zx_sp11_StatusDetail_s* x)
292 {
293 struct zx_elem_s* el = x->gg.kids;
294 switch (el->g.tok) {
295
296 default: return 0;
297 }
298 }
299
300
301
302
zx_DEC_ATTR_sp11_SubjectQuery(struct zx_ctx * c,struct zx_sp11_SubjectQuery_s * x)303 int zx_DEC_ATTR_sp11_SubjectQuery(struct zx_ctx* c, struct zx_sp11_SubjectQuery_s* x)
304 {
305 switch (x->gg.attr->g.tok) {
306
307 default: return 0;
308 }
309 }
310
zx_DEC_ELEM_sp11_SubjectQuery(struct zx_ctx * c,struct zx_sp11_SubjectQuery_s * x)311 int zx_DEC_ELEM_sp11_SubjectQuery(struct zx_ctx* c, struct zx_sp11_SubjectQuery_s* x)
312 {
313 struct zx_elem_s* el = x->gg.kids;
314 switch (el->g.tok) {
315 case zx_sa11_Subject_ELEM:
316 if (!x->Subject)
317 x->Subject = (struct zx_sa11_Subject_s*)el;
318 return 1;
319
320 default: return 0;
321 }
322 }
323
324
325 /* EOF -- c/zx-sp11-dec.c */
326