diff options
author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-12-08 11:47:39 +0000 |
---|---|---|
committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-12-08 11:47:39 +0000 |
commit | 22e856deb69c78cbdee4d4201106cd70eb1c1c72 (patch) | |
tree | 7c4dfead6ca23b5e29193e66515f76abcd173564 /lasso/xml | |
parent | 03545f18382e16d46a0e1fdb3a3f5138229c0b2f (diff) | |
download | lasso-22e856deb69c78cbdee4d4201106cd70eb1c1c72.tar.gz lasso-22e856deb69c78cbdee4d4201106cd70eb1c1c72.tar.xz lasso-22e856deb69c78cbdee4d4201106cd70eb1c1c72.zip |
Initial version : complex class to manage ResourceID and EncryptedResourceID choice.
Diffstat (limited to 'lasso/xml')
-rw-r--r-- | lasso/xml/disco_resource_id_group.c | 93 | ||||
-rw-r--r-- | lasso/xml/disco_resource_id_group.h | 78 |
2 files changed, 171 insertions, 0 deletions
diff --git a/lasso/xml/disco_resource_id_group.c b/lasso/xml/disco_resource_id_group.c new file mode 100644 index 00000000..595daa2f --- /dev/null +++ b/lasso/xml/disco_resource_id_group.c @@ -0,0 +1,93 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Nicolas Clapies <nclapies@entrouvert.com> + * Valery Febvre <vfebvre@easter-eggs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <lasso/xml/disco_resource_id_group.h> + + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "ResourceID", SNIPPET_NODE, G_STRUCT_OFFSET(LassoDiscoResourceIDGroup, ResourceID) }, + { "EncryptedResourceID", SNIPPET_NODE, G_STRUCT_OFFSET(LassoDiscoResourceIDGroup, + EncryptedResourceID) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoResourceIDGroup *node) +{ + +} + +static void +class_init(LassoDiscoResourceIDGroupClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "ResourceIDGroup"); + lasso_node_class_set_ns(nclass, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_disco_resource_id_group_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoResourceIDGroupClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoResourceIDGroup), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoResourceIDGroup", &this_info, 0); + } + return this_type; +} + +LassoDiscoResourceIDGroup* +lasso_disco_resource_id_group_new() +{ + LassoDiscoResourceIDGroup *node; + + node = g_object_new(LASSO_TYPE_DISCO_RESOURCE_ID_GROUP, NULL); + + return node; +} diff --git a/lasso/xml/disco_resource_id_group.h b/lasso/xml/disco_resource_id_group.h new file mode 100644 index 00000000..2a3ea688 --- /dev/null +++ b/lasso/xml/disco_resource_id_group.h @@ -0,0 +1,78 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Nicolas Clapies <nclapies@entrouvert.com> + * Valery Febvre <vfebvre@easter-eggs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LASSO_DISCO_RESOURCE_ID_GROUP_H__ +#define __LASSO_DISCO_RESOURCE_ID_GROUP_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> +#include <lasso/xml/disco_resource_id.h> +#include <lasso/xml/disco_encrypted_resource_id.h> + +#define LASSO_TYPE_DISCO_RESOURCE_ID_GROUP (lasso_disco_resource_id_group_get_type()) +#define LASSO_DISCO_RESOURCE_ID_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_DISCO_RESOURCE_ID_GROUP, LassoDiscoResourceIDGroup)) +#define LASSO_DISCO_RESOURCE_ID_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_DISCO_RESOURCE_ID_GROUP, LassoDiscoResourceIDGroupClass)) +#define LASSO_IS_DISCO_RESOURCE_ID_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_DISCO_RESOURCE_ID_GROUP)) +#define LASSO_IS_DISCO_RESOURCE_ID_GROUP_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass),LASSO_TYPE_DISCO_RESOURCE_ID_GROUP)) +#define LASSO_DISCO_RESOURCE_ID_GROUP_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_RESOURCE_ID_GROUP, \ + LassoDiscoResourceIDGroupClass)) + +typedef struct _LassoDiscoResourceIDGroup LassoDiscoResourceIDGroup; +typedef struct _LassoDiscoResourceIDGroupClass LassoDiscoResourceIDGroupClass; + +struct _LassoDiscoResourceIDGroup { + LassoNode parent; + + LassoDiscoResourceID *ResourceID; + LassoDiscoEncryptedResourceID *EncryptedResourceID; +}; + +struct _LassoDiscoResourceIDGroupClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_resource_id_group_get_type(void); + +LASSO_EXPORT LassoDiscoResourceIDGroup* lasso_disco_resource_id_group_new(void); + +LASSO_EXPORT LassoDiscoResourceIDGroup* lasso_disco_resource_id_group_set_resourceID( + const char *resourceID, const char id); + +LASSO_EXPORT LassoDiscoResourceIDGroup* lasso_disco_resource_id_group_set_encryptedResourceID( + const char *encryptedData, const char *encryptedKey); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_RESOURCE_ID_GROUP_H__ */ |