libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

- File List

sml_xml_assm_internals.h
1 /*
2 * libsyncml - A syncml protocol implementation
3 * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
4 * Copyright (C) 2008 Michael Bell <michael.bell@opensync.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
29
30 #ifndef _SML_XML_ASSM_INTERNALS_H_
31 #define _SML_XML_ASSM_INTERNALS_H_
32
33 #include <libxml/xmlwriter.h>
34
35 #define XML_NODE_START 1
36 #define XML_NODE_TEXT 3
37 #define XML_NODE_CLOSE 15
38 #define XML_NODE_CDATA 4
39
40 typedef enum {
41 SML_ASSEMBLER_NODE_OPEN,
42 SML_ASSEMBLER_NODE_CLOSE
43 } SmlXmlAssemblerNodeType;
44
45 typedef struct SmlXmlAssemblerCommand {
47 SmlCommandType cmdType;
49 xmlBuffer *buffer;
51 SmlXmlAssemblerNodeType nodeType;
53 unsigned int cmdID;
54 GList *children;
55 } SmlXmlAssemblerCommand;
56
57 typedef struct SmlXmlAssemblerStatus {
59 unsigned int cmdRef;
60
61 unsigned int msgRef;
63 xmlBuffer *buffer;
65 unsigned int cmdID;
66 } SmlXmlAssemblerStatus;
67
68 struct SmlXmlAssembler {
69 xmlTextWriter *writer;
70 xmlBuffer *header_buffer;
71 GList *statuses;
72 GList *commands;
73 GList *last_commands;
74 GList *parent_commands;
75 GList *parent_buffers;
76 SmlSession *session;
77 SmlAssembler *assembler;
78 GMutex *mutex;
79
80 unsigned int reserved_statuses;
81 unsigned int added_statuses;
82
83 SmlBool moreDataSet;
84 };
85
86 SmlBool smlAssemblerStartNode(SmlAssembler *assm, const char *name, SmlError **error);
87 SmlBool smlAssemblerStartNodeNS(SmlAssembler *assm, const char *prefix, const char *name, const char *uri, SmlError **error);
88 SmlBool smlAssemblerEndNode(SmlAssembler *assm, SmlError **error);
89 SmlBool smlAssemblerAddString(SmlAssembler *assm, const char *name, const char *value, SmlError **error);
90 SmlBool smlAssemblerAddStringNS(SmlAssembler *assm, const char *prefix, const char *name, const char *uri, const char *value, SmlError **error);
91 SmlBool smlAssemblerAddID(SmlAssembler *assm, const char *name, unsigned int id, SmlError **error);
92 SmlBool smlAssemblerAddData(SmlAssembler *assm, const char *name, const char *value, SmlError **error);
93
94 #endif //_SML_XML_ASSM_INTERNALS_H_
95