00001 /* 00002 * libsyncml - A syncml protocol implementation 00003 * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org> 00004 * Copyright (C) 2008 Michael Bell <michael.bell@opensync.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00029 00030 #ifndef _SML_COMMAND_INTERNALS_H_ 00031 #define _SML_COMMAND_INTERNALS_H_ 00032 00033 typedef struct SmlCommandAlertPrivate { 00034 SmlAlertType type; 00035 SmlAnchor *anchor; 00036 char *contentType; 00037 int maxObjSize; 00038 } SmlCommandAlertPrivate; 00039 00040 typedef struct SmlCommandSyncPrivate { 00041 unsigned int numChanged; 00042 int maxObjSize; 00043 SmlBool hasNumChanged; 00044 } SmlCommandSyncPrivate; 00045 00046 typedef struct SmlCommandAccessPrivate { 00047 char *type; 00048 SmlItem *item; 00049 } SmlCommandAccessPrivate; 00050 00051 typedef struct SmlCommandChangePrivate { 00052 GList *items; 00053 SmlChangeType type; 00054 } SmlCommandChangePrivate; 00055 00056 typedef struct SmlCommandMapPrivate { 00057 GList *items; 00058 } SmlCommandMapPrivate; 00059 00060 typedef struct SmlCommandResultsPrivate { 00061 SmlStatus *status; 00062 } SmlCommandResultsPrivate; 00063 00064 typedef union SmlCommandPrivate { 00065 SmlCommandAlertPrivate alert; 00066 SmlCommandSyncPrivate sync; 00067 SmlCommandAccessPrivate access; 00068 SmlCommandChangePrivate change; 00069 SmlCommandMapPrivate map; 00070 SmlCommandResultsPrivate results; 00071 } SmlCommandPrivate; 00072 00073 struct SmlCommand { 00074 gint refCount; 00075 SmlCommandType type; 00076 unsigned int cmdID; 00077 unsigned int msgID; 00078 SmlCommandPrivate private; 00079 SmlLocation *source; 00080 SmlLocation *target; 00081 SmlPendingStatus *pendingReply; 00082 GList *children; 00083 SmlCommand *parent; 00084 SmlBool noResp; 00085 00086 unsigned int size; 00087 00091 SmlBool pushedBack; 00092 }; 00093 00094 struct SmlStatus { 00095 gint refCount; 00096 unsigned int msgRef; 00097 unsigned int cmdRef; 00098 SmlCommandType type; 00099 char *data; 00100 SmlAnchor *anchor; 00101 SmlLocation *sourceRef; 00102 SmlLocation *targetRef; 00103 SmlCred *cred; 00104 SmlChal *chal; 00105 SmlItem *item; 00106 00107 SmlCommand *result; 00108 }; 00109 00110 SmlCommandType smlCommandTypeFromString(const char *name, SmlError **error); 00111 const char *smlCommandTypeToString(SmlCommandType type, SmlError **error); 00112 00113 SmlAlertType smlAlertTypeConvert(unsigned int id, SmlError **error); 00114 00115 #endif //_SML_COMMAND_INTERNALS_H_ 00116