1 /* c/zx-xac-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-xac-data.h"
36 #define TPF zx_
37 #include "zx_ext_pt.h"
38 
39 
40 
zx_DEC_ATTR_xac_Action(struct zx_ctx * c,struct zx_xac_Action_s * x)41 int zx_DEC_ATTR_xac_Action(struct zx_ctx* c, struct zx_xac_Action_s* x)
42 {
43   switch (x->gg.attr->g.tok) {
44 
45   default: return 0;
46   }
47 }
48 
zx_DEC_ELEM_xac_Action(struct zx_ctx * c,struct zx_xac_Action_s * x)49 int zx_DEC_ELEM_xac_Action(struct zx_ctx* c, struct zx_xac_Action_s* x)
50 {
51   struct zx_elem_s* el = x->gg.kids;
52   switch (el->g.tok) {
53   case zx_xac_Attribute_ELEM:
54     if (!x->Attribute)
55       x->Attribute = (struct zx_xac_Attribute_s*)el;
56     return 1;
57 
58   default: return 0;
59   }
60 }
61 
62 
63 
64 
zx_DEC_ATTR_xac_Attribute(struct zx_ctx * c,struct zx_xac_Attribute_s * x)65 int zx_DEC_ATTR_xac_Attribute(struct zx_ctx* c, struct zx_xac_Attribute_s* x)
66 {
67   switch (x->gg.attr->g.tok) {
68     case zx_AttributeId_ATTR:  x->AttributeId = x->gg.attr; return 1;
69     case zx_DataType_ATTR:  x->DataType = x->gg.attr; return 1;
70     case zx_Issuer_ATTR:  x->Issuer = x->gg.attr; return 1;
71 
72   default: return 0;
73   }
74 }
75 
zx_DEC_ELEM_xac_Attribute(struct zx_ctx * c,struct zx_xac_Attribute_s * x)76 int zx_DEC_ELEM_xac_Attribute(struct zx_ctx* c, struct zx_xac_Attribute_s* x)
77 {
78   struct zx_elem_s* el = x->gg.kids;
79   switch (el->g.tok) {
80   case zx_xac_AttributeValue_ELEM:
81     if (!x->AttributeValue)
82       x->AttributeValue = el;
83     return 1;
84 
85   default: return 0;
86   }
87 }
88 
89 
90 
91 
zx_DEC_ATTR_xac_Environment(struct zx_ctx * c,struct zx_xac_Environment_s * x)92 int zx_DEC_ATTR_xac_Environment(struct zx_ctx* c, struct zx_xac_Environment_s* x)
93 {
94   switch (x->gg.attr->g.tok) {
95 
96   default: return 0;
97   }
98 }
99 
zx_DEC_ELEM_xac_Environment(struct zx_ctx * c,struct zx_xac_Environment_s * x)100 int zx_DEC_ELEM_xac_Environment(struct zx_ctx* c, struct zx_xac_Environment_s* x)
101 {
102   struct zx_elem_s* el = x->gg.kids;
103   switch (el->g.tok) {
104   case zx_xac_Attribute_ELEM:
105     if (!x->Attribute)
106       x->Attribute = (struct zx_xac_Attribute_s*)el;
107     return 1;
108 
109   default: return 0;
110   }
111 }
112 
113 
114 
115 
zx_DEC_ATTR_xac_MissingAttributeDetail(struct zx_ctx * c,struct zx_xac_MissingAttributeDetail_s * x)116 int zx_DEC_ATTR_xac_MissingAttributeDetail(struct zx_ctx* c, struct zx_xac_MissingAttributeDetail_s* x)
117 {
118   switch (x->gg.attr->g.tok) {
119     case zx_AttributeId_ATTR:  x->AttributeId = x->gg.attr; return 1;
120     case zx_DataType_ATTR:  x->DataType = x->gg.attr; return 1;
121     case zx_Issuer_ATTR:  x->Issuer = x->gg.attr; return 1;
122 
123   default: return 0;
124   }
125 }
126 
zx_DEC_ELEM_xac_MissingAttributeDetail(struct zx_ctx * c,struct zx_xac_MissingAttributeDetail_s * x)127 int zx_DEC_ELEM_xac_MissingAttributeDetail(struct zx_ctx* c, struct zx_xac_MissingAttributeDetail_s* x)
128 {
129   struct zx_elem_s* el = x->gg.kids;
130   switch (el->g.tok) {
131   case zx_xac_AttributeValue_ELEM:
132     if (!x->AttributeValue)
133       x->AttributeValue = el;
134     return 1;
135 
136   default: return 0;
137   }
138 }
139 
140 
141 
142 
zx_DEC_ATTR_xac_Request(struct zx_ctx * c,struct zx_xac_Request_s * x)143 int zx_DEC_ATTR_xac_Request(struct zx_ctx* c, struct zx_xac_Request_s* x)
144 {
145   switch (x->gg.attr->g.tok) {
146 
147   default: return 0;
148   }
149 }
150 
zx_DEC_ELEM_xac_Request(struct zx_ctx * c,struct zx_xac_Request_s * x)151 int zx_DEC_ELEM_xac_Request(struct zx_ctx* c, struct zx_xac_Request_s* x)
152 {
153   struct zx_elem_s* el = x->gg.kids;
154   switch (el->g.tok) {
155   case zx_xac_Subject_ELEM:
156     if (!x->Subject)
157       x->Subject = (struct zx_xac_Subject_s*)el;
158     return 1;
159   case zx_xac_Resource_ELEM:
160     if (!x->Resource)
161       x->Resource = (struct zx_xac_Resource_s*)el;
162     return 1;
163   case zx_xac_Action_ELEM:
164     if (!x->Action)
165       x->Action = (struct zx_xac_Action_s*)el;
166     return 1;
167   case zx_xac_Environment_ELEM:
168     if (!x->Environment)
169       x->Environment = (struct zx_xac_Environment_s*)el;
170     return 1;
171 
172   default: return 0;
173   }
174 }
175 
176 
177 
178 
zx_DEC_ATTR_xac_Resource(struct zx_ctx * c,struct zx_xac_Resource_s * x)179 int zx_DEC_ATTR_xac_Resource(struct zx_ctx* c, struct zx_xac_Resource_s* x)
180 {
181   switch (x->gg.attr->g.tok) {
182 
183   default: return 0;
184   }
185 }
186 
zx_DEC_ELEM_xac_Resource(struct zx_ctx * c,struct zx_xac_Resource_s * x)187 int zx_DEC_ELEM_xac_Resource(struct zx_ctx* c, struct zx_xac_Resource_s* x)
188 {
189   struct zx_elem_s* el = x->gg.kids;
190   switch (el->g.tok) {
191   case zx_xac_ResourceContent_ELEM:
192     if (!x->ResourceContent)
193       x->ResourceContent = (struct zx_xac_ResourceContent_s*)el;
194     return 1;
195   case zx_xac_Attribute_ELEM:
196     if (!x->Attribute)
197       x->Attribute = (struct zx_xac_Attribute_s*)el;
198     return 1;
199 
200   default: return 0;
201   }
202 }
203 
204 
205 
206 
zx_DEC_ATTR_xac_ResourceContent(struct zx_ctx * c,struct zx_xac_ResourceContent_s * x)207 int zx_DEC_ATTR_xac_ResourceContent(struct zx_ctx* c, struct zx_xac_ResourceContent_s* x)
208 {
209   switch (x->gg.attr->g.tok) {
210 
211   default: return 0;
212   }
213 }
214 
zx_DEC_ELEM_xac_ResourceContent(struct zx_ctx * c,struct zx_xac_ResourceContent_s * x)215 int zx_DEC_ELEM_xac_ResourceContent(struct zx_ctx* c, struct zx_xac_ResourceContent_s* x)
216 {
217   struct zx_elem_s* el = x->gg.kids;
218   switch (el->g.tok) {
219 
220   default: return 0;
221   }
222 }
223 
224 
225 
226 
zx_DEC_ATTR_xac_Response(struct zx_ctx * c,struct zx_xac_Response_s * x)227 int zx_DEC_ATTR_xac_Response(struct zx_ctx* c, struct zx_xac_Response_s* x)
228 {
229   switch (x->gg.attr->g.tok) {
230 
231   default: return 0;
232   }
233 }
234 
zx_DEC_ELEM_xac_Response(struct zx_ctx * c,struct zx_xac_Response_s * x)235 int zx_DEC_ELEM_xac_Response(struct zx_ctx* c, struct zx_xac_Response_s* x)
236 {
237   struct zx_elem_s* el = x->gg.kids;
238   switch (el->g.tok) {
239   case zx_xac_Result_ELEM:
240     if (!x->Result)
241       x->Result = (struct zx_xac_Result_s*)el;
242     return 1;
243 
244   default: return 0;
245   }
246 }
247 
248 
249 
250 
zx_DEC_ATTR_xac_Result(struct zx_ctx * c,struct zx_xac_Result_s * x)251 int zx_DEC_ATTR_xac_Result(struct zx_ctx* c, struct zx_xac_Result_s* x)
252 {
253   switch (x->gg.attr->g.tok) {
254     case zx_ResourceId_ATTR:  x->ResourceId = x->gg.attr; return 1;
255 
256   default: return 0;
257   }
258 }
259 
zx_DEC_ELEM_xac_Result(struct zx_ctx * c,struct zx_xac_Result_s * x)260 int zx_DEC_ELEM_xac_Result(struct zx_ctx* c, struct zx_xac_Result_s* x)
261 {
262   struct zx_elem_s* el = x->gg.kids;
263   switch (el->g.tok) {
264   case zx_xac_Decision_ELEM:
265     if (!x->Decision)
266       x->Decision = el;
267     return 1;
268   case zx_xac_Status_ELEM:
269     if (!x->Status)
270       x->Status = (struct zx_xac_Status_s*)el;
271     return 1;
272   case zx_xa_Obligations_ELEM:
273     if (!x->Obligations)
274       x->Obligations = (struct zx_xa_Obligations_s*)el;
275     return 1;
276 
277   default: return 0;
278   }
279 }
280 
281 
282 
283 
zx_DEC_ATTR_xac_Status(struct zx_ctx * c,struct zx_xac_Status_s * x)284 int zx_DEC_ATTR_xac_Status(struct zx_ctx* c, struct zx_xac_Status_s* x)
285 {
286   switch (x->gg.attr->g.tok) {
287 
288   default: return 0;
289   }
290 }
291 
zx_DEC_ELEM_xac_Status(struct zx_ctx * c,struct zx_xac_Status_s * x)292 int zx_DEC_ELEM_xac_Status(struct zx_ctx* c, struct zx_xac_Status_s* x)
293 {
294   struct zx_elem_s* el = x->gg.kids;
295   switch (el->g.tok) {
296   case zx_xac_StatusCode_ELEM:
297     if (!x->StatusCode)
298       x->StatusCode = (struct zx_xac_StatusCode_s*)el;
299     return 1;
300   case zx_xac_StatusMessage_ELEM:
301     if (!x->StatusMessage)
302       x->StatusMessage = el;
303     return 1;
304   case zx_xac_StatusDetail_ELEM:
305     if (!x->StatusDetail)
306       x->StatusDetail = (struct zx_xac_StatusDetail_s*)el;
307     return 1;
308 
309   default: return 0;
310   }
311 }
312 
313 
314 
315 
zx_DEC_ATTR_xac_StatusCode(struct zx_ctx * c,struct zx_xac_StatusCode_s * x)316 int zx_DEC_ATTR_xac_StatusCode(struct zx_ctx* c, struct zx_xac_StatusCode_s* x)
317 {
318   switch (x->gg.attr->g.tok) {
319     case zx_Value_ATTR:  x->Value = x->gg.attr; return 1;
320 
321   default: return 0;
322   }
323 }
324 
zx_DEC_ELEM_xac_StatusCode(struct zx_ctx * c,struct zx_xac_StatusCode_s * x)325 int zx_DEC_ELEM_xac_StatusCode(struct zx_ctx* c, struct zx_xac_StatusCode_s* x)
326 {
327   struct zx_elem_s* el = x->gg.kids;
328   switch (el->g.tok) {
329   case zx_xac_StatusCode_ELEM:
330     if (!x->StatusCode)
331       x->StatusCode = (struct zx_xac_StatusCode_s*)el;
332     return 1;
333 
334   default: return 0;
335   }
336 }
337 
338 
339 
340 
zx_DEC_ATTR_xac_StatusDetail(struct zx_ctx * c,struct zx_xac_StatusDetail_s * x)341 int zx_DEC_ATTR_xac_StatusDetail(struct zx_ctx* c, struct zx_xac_StatusDetail_s* x)
342 {
343   switch (x->gg.attr->g.tok) {
344 
345   default: return 0;
346   }
347 }
348 
zx_DEC_ELEM_xac_StatusDetail(struct zx_ctx * c,struct zx_xac_StatusDetail_s * x)349 int zx_DEC_ELEM_xac_StatusDetail(struct zx_ctx* c, struct zx_xac_StatusDetail_s* x)
350 {
351   struct zx_elem_s* el = x->gg.kids;
352   switch (el->g.tok) {
353 
354   default: return 0;
355   }
356 }
357 
358 
359 
360 
zx_DEC_ATTR_xac_Subject(struct zx_ctx * c,struct zx_xac_Subject_s * x)361 int zx_DEC_ATTR_xac_Subject(struct zx_ctx* c, struct zx_xac_Subject_s* x)
362 {
363   switch (x->gg.attr->g.tok) {
364     case zx_SubjectCategory_ATTR:  x->SubjectCategory = x->gg.attr; return 1;
365 
366   default: return 0;
367   }
368 }
369 
zx_DEC_ELEM_xac_Subject(struct zx_ctx * c,struct zx_xac_Subject_s * x)370 int zx_DEC_ELEM_xac_Subject(struct zx_ctx* c, struct zx_xac_Subject_s* x)
371 {
372   struct zx_elem_s* el = x->gg.kids;
373   switch (el->g.tok) {
374   case zx_xac_Attribute_ELEM:
375     if (!x->Attribute)
376       x->Attribute = (struct zx_xac_Attribute_s*)el;
377     return 1;
378 
379   default: return 0;
380   }
381 }
382 
383 
384 /* EOF -- c/zx-xac-dec.c */
385