libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

- File List

sml_devinf.h
1 /*
2 * libsyncml - A syncml protocol implementation
3 * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
4 * Copyright (C) 2007-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_DEVINF_H_
31 #define _SML_DEVINF_H_
32
33 SmlDevInfDevTyp smlDevInfDevTypeFromString(const char *name, SmlError **error);
34 const char *smlDevInfDevTypeToString(SmlDevInfDevTyp type, SmlError **error);
35
36 SmlDevInf *smlDevInfNew(const char *devid, SmlDevInfDevTyp devtyp, SmlError **error);
37 SmlDevInf *smlDevInfRef(SmlDevInf *devinf);
38 void smlDevInfUnref(SmlDevInf *devinf);
39
40 const char *smlDevInfGetManufacturer(SmlDevInf *devinf);
41 void smlDevInfSetManufacturer(SmlDevInf *devinf, const char *man);
42 const char *smlDevInfGetModel(SmlDevInf *devinf);
43 void smlDevInfSetModel(SmlDevInf *devinf, const char *model);
44 const char *smlDevInfGetOEM(SmlDevInf *devinf);
45 void smlDevInfSetOEM(SmlDevInf *devinf, const char *oem);
46 const char *smlDevInfGetFirmwareVersion(SmlDevInf *devinf);
47 void smlDevInfSetFirmwareVersion(SmlDevInf *devinf, const char *firmwareVersion);
48 const char *smlDevInfGetSoftwareVersion(SmlDevInf *devinf);
49 void smlDevInfSetSoftwareVersion(SmlDevInf *devinf, const char *softwareVersion);
50 const char *smlDevInfGetHardwareVersion(SmlDevInf *devinf);
51 void smlDevInfSetHardwareVersion(SmlDevInf *devinf, const char *hardwareVersion);
52 const char *smlDevInfGetDeviceID(SmlDevInf *devinf);
53 void smlDevInfSetDeviceID(SmlDevInf *devinf, const char *devid);
54 SmlDevInfDevTyp smlDevInfGetDeviceType(SmlDevInf *devinf);
55 void smlDevInfSetDeviceType(SmlDevInf *devinf, SmlDevInfDevTyp devtyp);
56 SmlBool smlDevInfSupportsUTC(SmlDevInf *devinf);
57 void smlDevInfSetSupportsUTC(SmlDevInf *devinf, SmlBool supports);
58 SmlBool smlDevInfSupportsLargeObjs(SmlDevInf *devinf);
59 void smlDevInfSetSupportsLargeObjs(SmlDevInf *devinf, SmlBool supports);
60 SmlBool smlDevInfSupportsNumberOfChanges(SmlDevInf *devinf);
61 void smlDevInfSetSupportsNumberOfChanges(SmlDevInf *devinf, SmlBool supports);
62
63 void smlDevInfAddDataStore(SmlDevInf *devinf, SmlDevInfDataStore *datastore);
64 unsigned int smlDevInfNumDataStores(SmlDevInf *devinf);
65 const SmlDevInfDataStore *smlDevInfGetNthDataStore(const SmlDevInf *devinf, unsigned int nth);
66
67 SmlDevInfDataStore *smlDevInfDataStoreNew(const char *sourceRef, SmlError **error);
68 SmlDevInfDataStore *smlDevInfDataStoreRef(SmlDevInfDataStore *datastore);
69 void smlDevInfDataStoreUnref(SmlDevInfDataStore *datastore);
70
71 const char *smlDevInfDataStoreGetSourceRef(const SmlDevInfDataStore *datastore);
72 void smlDevInfDataStoreSetSourceRef(SmlDevInfDataStore *datastore, const char *sourceref);
73 const char *smlDevInfDataStoreGetDisplayName(const SmlDevInfDataStore *datastore);
74 void smlDevInfDataStoreSetDisplayName(SmlDevInfDataStore *datastore, const char *displayName);
75 unsigned int smlDevInfGetMaxGUIDSize(const SmlDevInfDataStore *datastore);
76 void smlDevInfSetMaxGUIDSize(SmlDevInfDataStore *datastore, unsigned int max);
77
78 void smlDevInfDataStoreSetRxPref(SmlDevInfDataStore *datastore, const char *contenttype, const char *version);
79 SmlBool smlDevInfDataStoreGetRxPref(const SmlDevInfDataStore *datastore, char **contenttype, char **version);
80 void smlDevInfDataStoreAddRx(SmlDevInfDataStore *datastore, SmlDevInfContentType *ct);
81 unsigned int smlDevInfDataStoreNumRx(const SmlDevInfDataStore *datastore);
82 const SmlDevInfContentType *smlDevInfDataStoreGetNthRx(const SmlDevInfDataStore *datastore, unsigned int n);
83 void smlDevInfDataStoreSetTxPref(SmlDevInfDataStore *datastore, const char *contenttype, const char *version);
84 SmlBool smlDevInfDataStoreGetTxPref(const SmlDevInfDataStore *datastore, char **contenttype, char **version);
85 void smlDevInfDataStoreAddTx(SmlDevInfDataStore *datastore, SmlDevInfContentType *ct);
86 unsigned int smlDevInfDataStoreNumTx(const SmlDevInfDataStore *datastore);
87 const SmlDevInfContentType *smlDevInfDataStoreGetNthTx(const SmlDevInfDataStore *datastore, unsigned int n);
88
89 void smlDevInfDataStoreSetMemory(SmlDevInfDataStore *datastore, SmlBool shared, unsigned int maxid, unsigned int maxmem);
90 void smlDevInfDataStoreGetMemory(const SmlDevInfDataStore *datastore, SmlBool *shared, unsigned int *maxid, unsigned int *maxmem);
91 void smlDevInfDataStoreSetSyncCap(SmlDevInfDataStore *datastore, SmlDevInfSyncCap cap, SmlBool supported);
92 SmlBool smlDevInfDataStoreGetSyncCap(const SmlDevInfDataStore *datastore, SmlDevInfSyncCap cap);
93
94 SmlBool smlDevInfAssemble(SmlDevInf *devinf, char **data, unsigned int *size, SmlError **error);
95 SmlCommand *smlDevInfNewResult(SmlCommand *cmd, SmlDevInf *devinf, SmlDevInfVersion version, SmlError **error);
96 SmlCommand *smlDevInfNewPut(SmlDevInf *devinf, SmlDevInfVersion version, SmlError **error);
97 SmlCommand *smlDevInfNewGet(SmlDevInfVersion version, SmlError **error);
98
99 void smlDevInfConfigureSession(SmlDevInf *devinf, SmlSession *session);
100
101 SmlDevInf *smlDevInfParse(const char *data, unsigned int length, SmlError **error);
102 SmlDevInf *smlDevInfFromResult(SmlCommand *result, SmlError **error);
103
104 SmlDevInfCTCapType smlDevInfCTCapTypeFromString(const char *name, SmlError **error);
105 const char *smlDevInfCTCapTypeToString(SmlDevInfCTCapType type, SmlError **error);
106
107 /* this interface enforce the logical structure behind the devinf spec */
108 /* so we can generate SyncML 1.0, 1.1 and 1.2 devinf from this structure */
109 /* the CTCap will be assigned to a datastore if CTType and VerCT match */
110
111 /* PropParam stuff */
112
113 SmlDevInfPropParam *smlDevInfNewPropParam(SmlError **error);
114 void smlDevInfPropParamSetParamName( // REQUIRED
115 SmlDevInfPropParam *propParam,
116 const char *paramName);
117 void smlDevInfPropParamSetDataType(
118 SmlDevInfPropParam *propParam,
119 const char *dataType);
120 void smlDevInfPropParamSetDisplayName(
121 SmlDevInfPropParam *propParam,
122 const char *displayName);
123 void smlDevInfPropParamAddValEnum(
124 SmlDevInfPropParam *propParam,
125 const char *valEnum);
126
127 char *smlDevInfPropParamGetParamName(const SmlDevInfPropParam *propParam);
128 char *smlDevInfPropParamGetDataType(const SmlDevInfPropParam *propParam);
129 char *smlDevInfPropParamGetDisplayName(const SmlDevInfPropParam *propParam);
130 unsigned int smlDevInfPropParamNumValEnums(const SmlDevInfPropParam *propParam);
131 char *smlDevInfPropParamGetNthValEnum(
132 const SmlDevInfPropParam *propParam,
133 unsigned int n);
134
135 /* Property stuff */
136
137 SmlDevInfProperty *smlDevInfNewProperty(SmlError **error);
138 void smlDevInfPropertySetPropName( // REQUIRED
139 SmlDevInfProperty *property,
140 const char *propName);
141 void smlDevInfPropertySetPropSize(
142 SmlDevInfProperty *property,
143 unsigned int propSize);
144 void smlDevInfPropertySetDataType(
145 SmlDevInfProperty *property,
146 const char *dataType);
147 void smlDevInfPropertySetMaxOccur(
148 SmlDevInfProperty *property,
149 unsigned int maxOccur);
150 void smlDevInfPropertySetMaxSize(
151 SmlDevInfProperty *property,
152 unsigned int maxSize);
153 void smlDevInfPropertySetNoTruncate(
154 SmlDevInfProperty *property);
155 void smlDevInfPropertySetDisplayName(
156 SmlDevInfProperty *property,
157 const char *displayName);
158 void smlDevInfPropertyAddValEnum(
159 SmlDevInfProperty *property,
160 const char *valEnum);
161 void smlDevInfPropertyAddPropParam(
162 SmlDevInfProperty *property,
163 SmlDevInfPropParam *propParam);
164
165 char *smlDevInfPropertyGetPropName(const SmlDevInfProperty *property);
166 char *smlDevInfPropertyGetDataType(const SmlDevInfProperty *property);
167 unsigned int smlDevInfPropertyGetMaxOccur(const SmlDevInfProperty *property);
168 unsigned int smlDevInfPropertyGetMaxSize(const SmlDevInfProperty *property);
169 SmlBool smlDevInfPropertyGetNoTruncate(const SmlDevInfProperty *property);
170 char *smlDevInfPropertyGetDisplayName(const SmlDevInfProperty *property);
171 unsigned int smlDevInfPropertyNumValEnums(const SmlDevInfProperty *property);
172 char *smlDevInfPropertyGetNthValEnum(
173 const SmlDevInfProperty *property,
174 unsigned int n);
175 unsigned int smlDevInfPropertyNumPropParams(const SmlDevInfProperty *property);
176 const SmlDevInfPropParam *smlDevInfPropertyGetNthPropParam(
177 const SmlDevInfProperty *property,
178 unsigned int n);
179
180 /* CTCap stuff */
181
182 SmlDevInfContentType *smlDevInfNewContentType(
183 const char *cttype,
184 const char *verct,
185 SmlError **error);
186 char *smlDevInfContentTypeGetCTType(const SmlDevInfContentType *ct);
187 char *smlDevInfContentTypeGetVerCT(const SmlDevInfContentType *ct);
188 void smlDevInfFreeContentType(SmlDevInfContentType *ct);
189
190 SmlDevInfCTCap *smlDevInfNewCTCap(SmlError **error);
191 void smlDevInfCTCapSetCTType(
192 SmlDevInfCTCap *ctcap,
193 const char *cttype); // REQUIRED => NOT NULL
194 void smlDevInfCTCapSetVerCT(
195 SmlDevInfCTCap *ctcap,
196 const char *verct); // REQUIRED => NOT NULL
197 char *smlDevInfCTCapGetCTType(const SmlDevInfCTCap *ctcap);
198 char *smlDevInfCTCapGetVerCT(const SmlDevInfCTCap *ctcap);
199 void smlDevInfCTCapAddProperty(
200 SmlDevInfCTCap *ctcap,
201 SmlDevInfProperty *property);
202 void smlDevInfAppendCTCap(SmlDevInf *devinf, SmlDevInfCTCap *ctcap);
203
204 const SmlDevInfCTCap *smlDevInfGetCTCap(
205 const SmlDevInf *devinf,
206 SmlDevInfContentType *ct);
207 unsigned int smlDevInfNumCTCaps(const SmlDevInf *devinf);
208 const SmlDevInfCTCap *smlDevInfGetNthCTCap(
209 const SmlDevInf *devinf,
210 unsigned int n);
211 unsigned int smlDevInfCTCapNumProperties(const SmlDevInfCTCap *ctcap);
212 const SmlDevInfProperty *smlDevInfCTCapGetNthProperty(
213 const SmlDevInfCTCap *ctcap,
214 unsigned int n);
215
216 /* expire date: 20090120 */
217 void smlDevInfAddCTCap(SmlDevInf *devinf, SmlDevInfCTCapType type, const char *value) LIBSYNCML_DEPRECATED;
218 SmlDevInfCTCapType smlDevInfGetNthCTCapType(SmlDevInf *devinf, unsigned int nth) LIBSYNCML_DEPRECATED;
219 const char *smlDevInfGetNthCTCapValue(SmlDevInf *devinf, unsigned int nth) LIBSYNCML_DEPRECATED;
220
221 /* expire date: 20090407 */
222 void smlDevInfDataStoreSetRx(SmlDevInfDataStore *datastore, const char *contenttype, const char *version) LIBSYNCML_DEPRECATED;
223 SmlBool smlDevInfDataStoreGetRx(const SmlDevInfDataStore *datastore, char **contenttype, char **version) LIBSYNCML_DEPRECATED;
224 void smlDevInfDataStoreSetTx(SmlDevInfDataStore *datastore, const char *contenttype, const char *version) LIBSYNCML_DEPRECATED;
225 SmlBool smlDevInfDataStoreGetTx(const SmlDevInfDataStore *datastore, char **contenttype, char **version) LIBSYNCML_DEPRECATED;
226
227 #endif //_SML_DEVINF_H_
228