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



int zx_DEC_ATTR_wsse_BinarySecurityToken(struct zx_ctx* c, struct zx_wsse_BinarySecurityToken_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_EncodingType_ATTR:  x->EncodingType = x->gg.attr; return 1;
    case zx_ValueType_ATTR:  x->ValueType = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_Embedded(struct zx_ctx* c, struct zx_wsse_Embedded_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ValueType_ATTR:  x->ValueType = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_KeyIdentifier(struct zx_ctx* c, struct zx_wsse_KeyIdentifier_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_EncodingType_ATTR:  x->EncodingType = x->gg.attr; return 1;
    case zx_ValueType_ATTR:  x->ValueType = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_Nonce(struct zx_ctx* c, struct zx_wsse_Nonce_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_EncodingType_ATTR:  x->EncodingType = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_Password(struct zx_ctx* c, struct zx_wsse_Password_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Type_ATTR:  x->Type = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_Reference(struct zx_ctx* c, struct zx_wsse_Reference_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_URI_ATTR:  x->URI = x->gg.attr; return 1;
    case zx_ValueType_ATTR:  x->ValueType = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_Security(struct zx_ctx* c, struct zx_wsse_Security_s* x)
{
  switch (x->gg.attr->g.tok) {
    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_wsse_Security(struct zx_ctx* c, struct zx_wsse_Security_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_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;
  case zx_wsse_BinarySecurityToken_ELEM:
    if (!x->BinarySecurityToken)
      x->BinarySecurityToken = (struct zx_wsse_BinarySecurityToken_s*)el;
    return 1;
  case zx_wsse_SecurityTokenReference_ELEM:
    if (!x->SecurityTokenReference)
      x->SecurityTokenReference = (struct zx_wsse_SecurityTokenReference_s*)el;
    return 1;
  case zx_wsu_Timestamp_ELEM:
    if (!x->Timestamp)
      x->Timestamp = (struct zx_wsu_Timestamp_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_SecurityTokenReference(struct zx_ctx* c, struct zx_wsse_SecurityTokenReference_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Usage_ATTR|zx_wsse_NS:  x->Usage = x->gg.attr; return 1;
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_wsse_SecurityTokenReference(struct zx_ctx* c, struct zx_wsse_SecurityTokenReference_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_wsse_KeyIdentifier_ELEM:
    if (!x->KeyIdentifier)
      x->KeyIdentifier = (struct zx_wsse_KeyIdentifier_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_Username(struct zx_ctx* c, struct zx_wsse_Username_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_wsse_UsernameToken(struct zx_ctx* c, struct zx_wsse_UsernameToken_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR|zx_wsu_NS:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_wsse_UsernameToken(struct zx_ctx* c, struct zx_wsse_UsernameToken_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_wsse_Username_ELEM:
    if (!x->Username)
      x->Username = (struct zx_wsse_Username_s*)el;
    return 1;

  default: return 0;
  }
}


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