/* c/zx-b-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-b-data.h"
#define TPF zx_
#include "zx_ext_pt.h"



int zx_DEC_ATTR_b_ApplicationEPR(struct zx_ctx* c, struct zx_b_ApplicationEPR_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_notOnOrAfter_ATTR:  x->notOnOrAfter = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_b_ApplicationEPR(struct zx_ctx* c, struct zx_b_ApplicationEPR_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_a_Address_ELEM:
    if (!x->Address)
      x->Address = (struct zx_a_Address_s*)el;
    return 1;
  case zx_a_ReferenceParameters_ELEM:
    if (!x->ReferenceParameters)
      x->ReferenceParameters = (struct zx_a_ReferenceParameters_s*)el;
    return 1;
  case zx_a_Metadata_ELEM:
    if (!x->Metadata)
      x->Metadata = (struct zx_a_Metadata_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_b_Consent(struct zx_ctx* c, struct zx_b_Consent_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_timestamp_ATTR:  x->timestamp = x->gg.attr; return 1;
    case zx_uri_ATTR:  x->uri = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_b_CredentialsContext(struct zx_ctx* c, struct zx_b_CredentialsContext_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_b_CredentialsContext(struct zx_ctx* c, struct zx_b_CredentialsContext_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sp_RequestedAuthnContext_ELEM:
    if (!x->RequestedAuthnContext)
      x->RequestedAuthnContext = (struct zx_sp_RequestedAuthnContext_s*)el;
    return 1;
  case zx_b_SecurityMechID_ELEM:
    if (!x->SecurityMechID)
      x->SecurityMechID = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_b_EndpointUpdate(struct zx_ctx* c, struct zx_b_EndpointUpdate_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_notOnOrAfter_ATTR:  x->notOnOrAfter = x->gg.attr; return 1;
    case zx_updateType_ATTR:  x->updateType = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_b_EndpointUpdate(struct zx_ctx* c, struct zx_b_EndpointUpdate_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_a_Address_ELEM:
    if (!x->Address)
      x->Address = (struct zx_a_Address_s*)el;
    return 1;
  case zx_a_ReferenceParameters_ELEM:
    if (!x->ReferenceParameters)
      x->ReferenceParameters = (struct zx_a_ReferenceParameters_s*)el;
    return 1;
  case zx_a_Metadata_ELEM:
    if (!x->Metadata)
      x->Metadata = (struct zx_a_Metadata_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_b_Framework(struct zx_ctx* c, struct zx_b_Framework_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_version_ATTR:  x->version = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_b_InteractionService(struct zx_ctx* c, struct zx_b_InteractionService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_notOnOrAfter_ATTR:  x->notOnOrAfter = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_b_InteractionService(struct zx_ctx* c, struct zx_b_InteractionService_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_a_Address_ELEM:
    if (!x->Address)
      x->Address = (struct zx_a_Address_s*)el;
    return 1;
  case zx_a_ReferenceParameters_ELEM:
    if (!x->ReferenceParameters)
      x->ReferenceParameters = (struct zx_a_ReferenceParameters_s*)el;
    return 1;
  case zx_a_Metadata_ELEM:
    if (!x->Metadata)
      x->Metadata = (struct zx_a_Metadata_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_b_ProcessingContext(struct zx_ctx* c, struct zx_b_ProcessingContext_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_b_RedirectRequest(struct zx_ctx* c, struct zx_b_RedirectRequest_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_redirectURL_ATTR:  x->redirectURL = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_b_Sender(struct zx_ctx* c, struct zx_b_Sender_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_affiliationID_ATTR:  x->affiliationID = x->gg.attr; return 1;
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_providerID_ATTR:  x->providerID = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_b_TargetIdentity(struct zx_ctx* c, struct zx_b_TargetIdentity_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_b_TargetIdentity(struct zx_ctx* c, struct zx_b_TargetIdentity_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa_Assertion_ELEM:
    if (!x->Assertion)
      x->Assertion = (struct zx_sa_Assertion_s*)el;
    return 1;
  case zx_sa_EncryptedAssertion_ELEM:
    if (!x->EncryptedAssertion)
      x->EncryptedAssertion = (struct zx_sa_EncryptedAssertion_s*)el;
    return 1;
  case zx_sa11_Assertion_ELEM:
    if (!x->sa11_Assertion)
      x->sa11_Assertion = (struct zx_sa11_Assertion_s*)el;
    return 1;
  case zx_ff12_Assertion_ELEM:
    if (!x->ff12_Assertion)
      x->ff12_Assertion = (struct zx_ff12_Assertion_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_b_Timeout(struct zx_ctx* c, struct zx_b_Timeout_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_maxProcessingTime_ATTR:  x->maxProcessingTime = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_b_UsageDirective(struct zx_ctx* c, struct zx_b_UsageDirective_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_ref_ATTR:  x->ref = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_b_UsageDirective(struct zx_ctx* c, struct zx_b_UsageDirective_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xa_Obligation_ELEM:
    if (!x->Obligation)
      x->Obligation = (struct zx_xa_Obligation_s*)el;
    return 1;
  case zx_tas3sol_Dict_ELEM:
    if (!x->Dict)
      x->Dict = (struct zx_tas3sol_Dict_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_b_UserInteraction(struct zx_ctx* c, struct zx_b_UserInteraction_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_interact_ATTR:  x->interact = x->gg.attr; return 1;
    case zx_language_ATTR:  x->language = x->gg.attr; return 1;
    case zx_maxInteractTime_ATTR:  x->maxInteractTime = x->gg.attr; return 1;
    case zx_redirect_ATTR:  x->redirect = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;
    case zx_actor_ATTR|zx_e_NS:  x->actor = x->gg.attr; return 1;
    case zx_mustUnderstand_ATTR|zx_e_NS:  x->mustUnderstand = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_b_UserInteraction(struct zx_ctx* c, struct zx_b_UserInteraction_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_b_InteractionService_ELEM:
    if (!x->InteractionService)
      x->InteractionService = (struct zx_b_InteractionService_s*)el;
    return 1;

  default: return 0;
  }
}


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