~ubuntu-branches/ubuntu/utopic/lasso/utopic-proposed

« back to all changes in this revision

Viewing changes to lasso/xml/lib_name_identifier_mapping_response.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2004-09-13 09:26:34 UTC
  • Revision ID: james.westby@ubuntu.com-20040913092634-01vdfl8j9cp94exa
Tags: upstream-0.4.1
ImportĀ upstreamĀ versionĀ 0.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: lib_name_identifier_mapping_response.c,v 1.5 2004/08/13 15:16:13 fpeters Exp $ 
 
2
 *
 
3
 * Lasso - A free implementation of the Liberty Alliance specifications.
 
4
 *
 
5
 * Copyright (C) 2004 Entr'ouvert
 
6
 * http://lasso.entrouvert.org
 
7
 * 
 
8
 * Authors: Nicolas Clapies <nclapies@entrouvert.com>
 
9
 *          Valery Febvre <vfebvre@easter-eggs.com>
 
10
 *
 
11
 * This program is free software; you can redistribute it and/or modify
 
12
 * it under the terms of the GNU General Public License as published by
 
13
 * the Free Software Foundation; either version 2 of the License, or
 
14
 * (at your option) any later version.
 
15
 * 
 
16
 * This program is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU General Public License for more details.
 
20
 * 
 
21
 * You should have received a copy of the GNU General Public License
 
22
 * along with this program; if not, write to the Free Software
 
23
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
24
 */
 
25
 
 
26
#include <lasso/xml/lib_name_identifier_mapping_response.h>
 
27
 
 
28
/*
 
29
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
 
30
 
 
31
<xs:element name="NameIdentifierMappingResponse" type="NameIdentifierMappingResponseType"/>
 
32
<xs:complexType name="NameIdentifierMappingResponseType">
 
33
  <xs:complexContent>
 
34
    <xs:extension base="samlp:ResponseAbstractType">
 
35
      <xs:sequence>
 
36
        <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
 
37
        <xs:element ref="ProviderID"/>
 
38
        <xs:element ref="samlp:Status"/>
 
39
        <xs:element ref="saml:NameIdentifier" minOccurs="0"/>
 
40
      </xs:sequence>
 
41
    </xs:extension>
 
42
  </xs:complexContent>
 
43
</xs:complexType>
 
44
 
 
45
*/
 
46
 
 
47
/*****************************************************************************/
 
48
/* public methods                                                            */
 
49
/*****************************************************************************/
 
50
 
 
51
void lasso_lib_name_identifier_mapping_response_set_nameIdentifier(LassoLibNameIdentifierMappingResponse *node,
 
52
                                                                   LassoSamlNameIdentifier *nameIdentifier)
 
53
{
 
54
  LassoNodeClass *class;
 
55
  g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
 
56
  g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(nameIdentifier));
 
57
  
 
58
  class = LASSO_NODE_GET_CLASS(node);
 
59
  class->add_child(LASSO_NODE (node),
 
60
                   LASSO_NODE (nameIdentifier),
 
61
                   FALSE);
 
62
}
 
63
 
 
64
void
 
65
lasso_lib_name_identifier_mapping_response_set_providerID(LassoLibNameIdentifierMappingResponse *node,
 
66
                                                          const xmlChar *providerID)
 
67
{
 
68
  LassoNodeClass *class;
 
69
  g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
 
70
  g_assert(providerID != NULL);
 
71
  /* FIXME : providerID length SHOULD be <= 1024 */
 
72
 
 
73
  class = LASSO_NODE_GET_CLASS(node);
 
74
  class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
 
75
}
 
76
 
 
77
void lasso_lib_name_identifier_mapping_response_set_status(LassoLibNameIdentifierMappingResponse *node,
 
78
                                                           LassoSamlpStatus *status)
 
79
{
 
80
  LassoNodeClass *class;
 
81
  g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
 
82
  g_assert(LASSO_IS_SAMLP_STATUS(status));
 
83
 
 
84
  class = LASSO_NODE_GET_CLASS(node);
 
85
  class->add_child(LASSO_NODE (node), LASSO_NODE(status), FALSE);
 
86
}
 
87
 
 
88
/*****************************************************************************/
 
89
/* instance and class init functions                                         */
 
90
/*****************************************************************************/
 
91
 
 
92
static void
 
93
lasso_lib_name_identifier_mapping_response_instance_init(LassoLibNameIdentifierMappingResponse *node)
 
94
{
 
95
  LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
 
96
 
 
97
  class->set_ns(LASSO_NODE(node), lassoLibHRef, lassoLibPrefix);
 
98
  class->set_name(LASSO_NODE(node), "NameIdentifierMappingResponse");
 
99
}
 
100
 
 
101
static void
 
102
lasso_lib_name_identifier_mapping_response_class_init(LassoLibNameIdentifierMappingResponseClass *klass)
 
103
{
 
104
}
 
105
 
 
106
GType lasso_lib_name_identifier_mapping_response_get_type() {
 
107
  static GType name_identifier_mapping_response_type = 0;
 
108
 
 
109
  if (!name_identifier_mapping_response_type) {
 
110
    static const GTypeInfo name_identifier_mapping_response_info = {
 
111
      sizeof (LassoLibNameIdentifierMappingResponseClass),
 
112
      NULL,
 
113
      NULL,
 
114
      (GClassInitFunc) lasso_lib_name_identifier_mapping_response_class_init,
 
115
      NULL,
 
116
      NULL,
 
117
      sizeof(LassoLibNameIdentifierMappingResponse),
 
118
      0,
 
119
      (GInstanceInitFunc) lasso_lib_name_identifier_mapping_response_instance_init,
 
120
    };
 
121
    
 
122
    name_identifier_mapping_response_type = g_type_register_static(LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT,
 
123
                                                                   "LassoLibNameIdentifierMappingResponse",
 
124
                                                                   &name_identifier_mapping_response_info, 0);
 
125
  }
 
126
  return name_identifier_mapping_response_type;
 
127
}
 
128
 
 
129
LassoNode* lasso_lib_name_identifier_mapping_response_new()
 
130
{
 
131
  return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL));
 
132
}