/* c/zx-sp11-dec.c - WARNING: This file was auto generated by xsd2sg.pl. DO NOT EDIT!
 * $Id$ */
/* Code generation design Copyright (c) 2006 Sampo Kellomaki (sampo@iki.fi),
 * All Rights Reserved. NO WARRANTY. See file COPYING for terms and conditions
 * of use. Some aspects of code generation were driven by schema
 * descriptions that were used as input and may be subject to their own copyright.
 * Code generation uses a template, whose copyright statement follows. */

/** dec-templ.c  -  XML decoder template, used in code generation
 ** Copyright (c) 2010 Sampo Kellomaki (sampo@iki.fi), All Rights Reserved.
 ** Copyright (c) 2006-2007 Symlabs (symlabs@symlabs.com), All Rights Reserved.
 ** Author: Sampo Kellomaki (sampo@iki.fi)
 ** This is confidential unpublished proprietary source code of the author.
 ** NO WARRANTY, not even implied warranties. Contains trade secrets.
 ** Distribution prohibited unless authorized in writing.
 ** Licensed under Apache License 2.0, see file COPYING.
 ** Id: dec-templ.c,v 1.30 2008-10-04 23:42:14 sampo Exp $
 **
 ** 28.5.2006, created, Sampo Kellomaki (sampo@iki.fi)
 ** 8.8.2006,  reworked namespace handling --Sampo
 ** 12.8.2006, added special scanning of xmlns to avoid backtracking elem recognition --Sampo
 ** 23.9.2006, added collection of WO information --Sampo
 ** 21.6.2007, improved handling of undeclared namespace prefixes --Sampo
 ** 27.10.2010, CSE refactoring, re-engineered namespace handling --Sampo
 ** 21.11.2010, re-engineered to extract most code to zx_DEC_elem, leaving just switches --Sampo
 **
 ** N.B: This template is meant to be processed by pd/xsd2sg.pl. Beware
 ** of special markers that xsd2sg.pl expects to find and understand.
 **/

#include "errmac.h"
#include "zx.h"
#include "c/zx-const.h"
#include "c/zx-data.h"
#include "c/zx-sp11-data.h"
#define TPF zx_
#include "zx_ext_pt.h"



int zx_DEC_ATTR_sp11_AttributeQuery(struct zx_ctx* c, struct zx_sp11_AttributeQuery_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Resource_ATTR:  x->Resource = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_AttributeQuery(struct zx_ctx* c, struct zx_sp11_AttributeQuery_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_sa11_Subject_s*)el;
    return 1;
  case zx_sa11_AttributeDesignator_ELEM:
    if (!x->AttributeDesignator)
      x->AttributeDesignator = (struct zx_sa11_AttributeDesignator_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sp11_AuthenticationQuery(struct zx_ctx* c, struct zx_sp11_AuthenticationQuery_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AuthenticationMethod_ATTR:  x->AuthenticationMethod = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_AuthenticationQuery(struct zx_ctx* c, struct zx_sp11_AuthenticationQuery_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_sa11_Subject_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sp11_AuthorizationDecisionQuery(struct zx_ctx* c, struct zx_sp11_AuthorizationDecisionQuery_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Resource_ATTR:  x->Resource = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_AuthorizationDecisionQuery(struct zx_ctx* c, struct zx_sp11_AuthorizationDecisionQuery_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_sa11_Subject_s*)el;
    return 1;
  case zx_sa11_Action_ELEM:
    if (!x->Action)
      x->Action = (struct zx_sa11_Action_s*)el;
    return 1;
  case zx_sa11_Evidence_ELEM:
    if (!x->Evidence)
      x->Evidence = (struct zx_sa11_Evidence_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sp11_Request(struct zx_ctx* c, struct zx_sp11_Request_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_IssueInstant_ATTR:  x->IssueInstant = x->gg.attr; return 1;
    case zx_MajorVersion_ATTR:  x->MajorVersion = x->gg.attr; return 1;
    case zx_MinorVersion_ATTR:  x->MinorVersion = x->gg.attr; return 1;
    case zx_RequestID_ATTR:  x->RequestID = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_Request(struct zx_ctx* c, struct zx_sp11_Request_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sp11_RespondWith_ELEM:
    if (!x->RespondWith)
      x->RespondWith = el;
    return 1;
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_sp11_Query_ELEM:
    if (!x->Query)
      x->Query = el;
    return 1;
  case zx_sp11_SubjectQuery_ELEM:
    if (!x->SubjectQuery)
      x->SubjectQuery = (struct zx_sp11_SubjectQuery_s*)el;
    return 1;
  case zx_sp11_AuthenticationQuery_ELEM:
    if (!x->AuthenticationQuery)
      x->AuthenticationQuery = (struct zx_sp11_AuthenticationQuery_s*)el;
    return 1;
  case zx_sp11_AttributeQuery_ELEM:
    if (!x->AttributeQuery)
      x->AttributeQuery = (struct zx_sp11_AttributeQuery_s*)el;
    return 1;
  case zx_sp11_AuthorizationDecisionQuery_ELEM:
    if (!x->AuthorizationDecisionQuery)
      x->AuthorizationDecisionQuery = (struct zx_sp11_AuthorizationDecisionQuery_s*)el;
    return 1;
  case zx_sa11_AssertionIDReference_ELEM:
    if (!x->AssertionIDReference)
      x->AssertionIDReference = el;
    return 1;
  case zx_sp11_AssertionArtifact_ELEM:
    if (!x->AssertionArtifact)
      x->AssertionArtifact = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sp11_Response(struct zx_ctx* c, struct zx_sp11_Response_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_InResponseTo_ATTR:  x->InResponseTo = x->gg.attr; return 1;
    case zx_IssueInstant_ATTR:  x->IssueInstant = x->gg.attr; return 1;
    case zx_MajorVersion_ATTR:  x->MajorVersion = x->gg.attr; return 1;
    case zx_MinorVersion_ATTR:  x->MinorVersion = x->gg.attr; return 1;
    case zx_Recipient_ATTR:  x->Recipient = x->gg.attr; return 1;
    case zx_ResponseID_ATTR:  x->ResponseID = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_Response(struct zx_ctx* c, struct zx_sp11_Response_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_sp11_Status_ELEM:
    if (!x->Status)
      x->Status = (struct zx_sp11_Status_s*)el;
    return 1;
  case zx_sa11_Assertion_ELEM:
    if (!x->Assertion)
      x->Assertion = (struct zx_sa11_Assertion_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sp11_Status(struct zx_ctx* c, struct zx_sp11_Status_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_Status(struct zx_ctx* c, struct zx_sp11_Status_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sp11_StatusCode_ELEM:
    if (!x->StatusCode)
      x->StatusCode = (struct zx_sp11_StatusCode_s*)el;
    return 1;
  case zx_sp11_StatusMessage_ELEM:
    if (!x->StatusMessage)
      x->StatusMessage = el;
    return 1;
  case zx_sp11_StatusDetail_ELEM:
    if (!x->StatusDetail)
      x->StatusDetail = (struct zx_sp11_StatusDetail_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sp11_StatusCode(struct zx_ctx* c, struct zx_sp11_StatusCode_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Value_ATTR:  x->Value = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_StatusCode(struct zx_ctx* c, struct zx_sp11_StatusCode_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sp11_StatusCode_ELEM:
    if (!x->StatusCode)
      x->StatusCode = (struct zx_sp11_StatusCode_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sp11_StatusDetail(struct zx_ctx* c, struct zx_sp11_StatusDetail_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_StatusDetail(struct zx_ctx* c, struct zx_sp11_StatusDetail_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {

  default: return 0;
  }
}




int zx_DEC_ATTR_sp11_SubjectQuery(struct zx_ctx* c, struct zx_sp11_SubjectQuery_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_sp11_SubjectQuery(struct zx_ctx* c, struct zx_sp11_SubjectQuery_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_sa11_Subject_s*)el;
    return 1;

  default: return 0;
  }
}


/* EOF -- c/zx-sp11-dec.c */
