gwenhywfar  4.3.3
ssl_cert_descr.c
Go to the documentation of this file.
1 /* This file is auto-generated from "ssl_cert_descr.xml" by the typemaker
2  tool of Gwenhywfar.
3  Do not edit this file -- all changes will be lost! */
4 #ifdef HAVE_CONFIG_H
5 # include "config.h"
6 #endif
7 
8 #include "ssl_cert_descr_p.h"
9 #include <gwenhywfar/misc.h>
10 #include <gwenhywfar/db.h>
11 #include <gwenhywfar/debug.h>
12 #include <assert.h>
13 #include <stdlib.h>
14 #include <strings.h>
15 
16 #include <gwenhywfar/gwentime.h>
17 #include <gwenhywfar/ssl_cert_flags.h>
18 
19 
20 GWEN_LIST_FUNCTIONS(GWEN_SSLCERTDESCR, GWEN_SslCertDescr)
21 GWEN_LIST2_FUNCTIONS(GWEN_SSLCERTDESCR, GWEN_SslCertDescr)
22 
23 
24 
25 
26 GWEN_SSLCERTDESCR *GWEN_SslCertDescr_new(void) {
27  GWEN_SSLCERTDESCR *st;
28 
29  GWEN_NEW_OBJECT(GWEN_SSLCERTDESCR, st)
30  st->_usage=1;
31  GWEN_LIST_INIT(GWEN_SSLCERTDESCR, st)
32  return st;
33 }
34 
35 
37  if (st) {
38  assert(st->_usage);
39  if (--(st->_usage)==0) {
40  if (st->countryName)
41  free(st->countryName);
42  if (st->commonName)
43  free(st->commonName);
44  if (st->organizationName)
45  free(st->organizationName);
46  if (st->organizationalUnitName)
47  free(st->organizationalUnitName);
48  if (st->localityName)
49  free(st->localityName);
50  if (st->stateOrProvinceName)
51  free(st->stateOrProvinceName);
52  if (st->notBefore)
53  GWEN_Time_free(st->notBefore);
54  if (st->notAfter)
55  GWEN_Time_free(st->notAfter);
56  if (st->ipAddress)
57  free(st->ipAddress);
58  if (st->fingerPrint)
59  free(st->fingerPrint);
60  if (st->statusText)
61  free(st->statusText);
63  GWEN_FREE_OBJECT(st);
64  }
65  }
66 
67 }
68 
69 
72 
73  assert(d);
75  if (d->countryName)
76  st->countryName=strdup(d->countryName);
77  if (d->commonName)
78  st->commonName=strdup(d->commonName);
79  if (d->organizationName)
80  st->organizationName=strdup(d->organizationName);
81  if (d->organizationalUnitName)
82  st->organizationalUnitName=strdup(d->organizationalUnitName);
83  if (d->localityName)
84  st->localityName=strdup(d->localityName);
85  if (d->stateOrProvinceName)
86  st->stateOrProvinceName=strdup(d->stateOrProvinceName);
87  if (d->notBefore)
88  st->notBefore=GWEN_Time_dup(d->notBefore);
89  if (d->notAfter)
90  st->notAfter=GWEN_Time_dup(d->notAfter);
91  if (d->ipAddress)
92  st->ipAddress=strdup(d->ipAddress);
93  if (d->fingerPrint)
94  st->fingerPrint=strdup(d->fingerPrint);
95  if (d->statusText)
96  st->statusText=strdup(d->statusText);
97  st->isError=d->isError;
98  st->statusFlags=d->statusFlags;
99  return st;
100 }
101 
102 
104  assert(st);
105  assert(db);
106  if (st->countryName)
107  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "countryName", st->countryName))
108  return -1;
109  if (st->commonName)
110  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "commonName", st->commonName))
111  return -1;
112  if (st->organizationName)
113  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "organizationName", st->organizationName))
114  return -1;
115  if (st->organizationalUnitName)
116  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "organizationalUnitName", st->organizationalUnitName))
117  return -1;
118  if (st->localityName)
119  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "localityName", st->localityName))
120  return -1;
121  if (st->stateOrProvinceName)
122  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "stateOrProvinceName", st->stateOrProvinceName))
123  return -1;
124  if (st->notBefore)
125  if (GWEN_Time_toDb(st->notBefore, GWEN_DB_GetGroup(db, GWEN_DB_FLAGS_DEFAULT, "notBefore")))
126  return -1;
127  if (st->notAfter)
128  if (GWEN_Time_toDb(st->notAfter, GWEN_DB_GetGroup(db, GWEN_DB_FLAGS_DEFAULT, "notAfter")))
129  return -1;
130  if (st->ipAddress)
131  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "ipAddress", st->ipAddress))
132  return -1;
133  if (st->fingerPrint)
134  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fingerPrint", st->fingerPrint))
135  return -1;
136  if (st->statusText)
137  if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "statusText", st->statusText))
138  return -1;
139  if (GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "isError", st->isError))
140  return -1;
141  if (GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "statusFlags", st->statusFlags))
142  return -1;
143  return 0;
144 }
145 
146 
148  assert(st);
149  assert(db);
150  GWEN_SslCertDescr_SetCountryName(st, GWEN_DB_GetCharValue(db, "countryName", 0, 0));
151  GWEN_SslCertDescr_SetCommonName(st, GWEN_DB_GetCharValue(db, "commonName", 0, 0));
152  GWEN_SslCertDescr_SetOrganizationName(st, GWEN_DB_GetCharValue(db, "organizationName", 0, 0));
153  GWEN_SslCertDescr_SetOrganizationalUnitName(st, GWEN_DB_GetCharValue(db, "organizationalUnitName", 0, 0));
154  GWEN_SslCertDescr_SetLocalityName(st, GWEN_DB_GetCharValue(db, "localityName", 0, 0));
155  GWEN_SslCertDescr_SetStateOrProvinceName(st, GWEN_DB_GetCharValue(db, "stateOrProvinceName", 0, 0));
156  if (1) { /* for local vars */
157  GWEN_DB_NODE *dbT;
158 
159  dbT=GWEN_DB_GetGroup(db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "notBefore");
160  if (dbT) {
161  if (st->notBefore)
162  GWEN_Time_free(st->notBefore);
163  st->notBefore=GWEN_Time_fromDb(dbT);
164 }
165  }
166  if (1) { /* for local vars */
167  GWEN_DB_NODE *dbT;
168 
169  dbT=GWEN_DB_GetGroup(db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "notAfter");
170  if (dbT) {
171  if (st->notAfter)
172  GWEN_Time_free(st->notAfter);
173  st->notAfter=GWEN_Time_fromDb(dbT);
174 }
175  }
176  GWEN_SslCertDescr_SetIpAddress(st, GWEN_DB_GetCharValue(db, "ipAddress", 0, 0));
177  GWEN_SslCertDescr_SetFingerPrint(st, GWEN_DB_GetCharValue(db, "fingerPrint", 0, 0));
178  GWEN_SslCertDescr_SetStatusText(st, GWEN_DB_GetCharValue(db, "statusText", 0, 0));
179  GWEN_SslCertDescr_SetIsError(st, GWEN_DB_GetIntValue(db, "isError", 0, 0));
180  GWEN_SslCertDescr_SetStatusFlags(st, GWEN_DB_GetIntValue(db, "statusFlags", 0, 0));
181  return 0;
182 }
183 
184 
186  GWEN_SSLCERTDESCR *st;
187 
188  assert(db);
190  GWEN_SslCertDescr_ReadDb(st, db);
191  st->_modified=0;
192  return st;
193 }
194 
195 
196 
197 
199  assert(st);
200  return st->countryName;
201 }
202 
203 
205  assert(st);
206  if (st->countryName)
207  free(st->countryName);
208  if (d && *d)
209  st->countryName=strdup(d);
210  else
211  st->countryName=0;
212  st->_modified=1;
213 }
214 
215 
216 
217 
219  assert(st);
220  return st->commonName;
221 }
222 
223 
225  assert(st);
226  if (st->commonName)
227  free(st->commonName);
228  if (d && *d)
229  st->commonName=strdup(d);
230  else
231  st->commonName=0;
232  st->_modified=1;
233 }
234 
235 
236 
237 
239  assert(st);
240  return st->organizationName;
241 }
242 
243 
245  assert(st);
246  if (st->organizationName)
247  free(st->organizationName);
248  if (d && *d)
249  st->organizationName=strdup(d);
250  else
251  st->organizationName=0;
252  st->_modified=1;
253 }
254 
255 
256 
257 
259  assert(st);
260  return st->organizationalUnitName;
261 }
262 
263 
265  assert(st);
266  if (st->organizationalUnitName)
267  free(st->organizationalUnitName);
268  if (d && *d)
269  st->organizationalUnitName=strdup(d);
270  else
271  st->organizationalUnitName=0;
272  st->_modified=1;
273 }
274 
275 
276 
277 
279  assert(st);
280  return st->localityName;
281 }
282 
283 
285  assert(st);
286  if (st->localityName)
287  free(st->localityName);
288  if (d && *d)
289  st->localityName=strdup(d);
290  else
291  st->localityName=0;
292  st->_modified=1;
293 }
294 
295 
296 
297 
299  assert(st);
300  return st->stateOrProvinceName;
301 }
302 
303 
305  assert(st);
306  if (st->stateOrProvinceName)
307  free(st->stateOrProvinceName);
308  if (d && *d)
309  st->stateOrProvinceName=strdup(d);
310  else
311  st->stateOrProvinceName=0;
312  st->_modified=1;
313 }
314 
315 
316 
317 
319  assert(st);
320  return st->notBefore;
321 }
322 
323 
325  assert(st);
326  if (st->notBefore)
327  GWEN_Time_free(st->notBefore);
328  if (d)
329  st->notBefore=GWEN_Time_dup(d);
330  else
331  st->notBefore=0;
332  st->_modified=1;
333 }
334 
335 
336 
337 
339  assert(st);
340  return st->notAfter;
341 }
342 
343 
345  assert(st);
346  if (st->notAfter)
347  GWEN_Time_free(st->notAfter);
348  if (d)
349  st->notAfter=GWEN_Time_dup(d);
350  else
351  st->notAfter=0;
352  st->_modified=1;
353 }
354 
355 
356 
357 
359  assert(st);
360  return st->ipAddress;
361 }
362 
363 
365  assert(st);
366  if (st->ipAddress)
367  free(st->ipAddress);
368  if (d && *d)
369  st->ipAddress=strdup(d);
370  else
371  st->ipAddress=0;
372  st->_modified=1;
373 }
374 
375 
376 
377 
379  assert(st);
380  return st->fingerPrint;
381 }
382 
383 
385  assert(st);
386  if (st->fingerPrint)
387  free(st->fingerPrint);
388  if (d && *d)
389  st->fingerPrint=strdup(d);
390  else
391  st->fingerPrint=0;
392  st->_modified=1;
393 }
394 
395 
396 
397 
399  assert(st);
400  return st->statusText;
401 }
402 
403 
405  assert(st);
406  if (st->statusText)
407  free(st->statusText);
408  if (d && *d)
409  st->statusText=strdup(d);
410  else
411  st->statusText=0;
412  st->_modified=1;
413 }
414 
415 
416 
417 
419  assert(st);
420  return st->isError;
421 }
422 
423 
425  assert(st);
426  st->isError=d;
427  st->_modified=1;
428 }
429 
430 
431 
432 
434  assert(st);
435  return st->statusFlags;
436 }
437 
438 
440  assert(st);
441  st->statusFlags=d;
442  st->_modified=1;
443 }
444 
445 
446 
447 
449  assert(st);
450  return st->_modified;
451 }
452 
453 
455  assert(st);
456  st->_modified=i;
457 }
458 
459 
461  assert(st);
462  st->_usage++;
463 }
466 return 0;
467 }
468 
469 
470 void GWEN_SslCertDescr_List2_freeAll(GWEN_SSLCERTDESCR_LIST2 *stl) {
471  if (stl) {
472  GWEN_SslCertDescr_List2_ForEach(stl, GWEN_SslCertDescr_List2__freeAll_cb, 0);
473  GWEN_SslCertDescr_List2_free(stl);
474  }
475 }
476 
477 
478 GWEN_SSLCERTDESCR_LIST *GWEN_SslCertDescr_List_dup(const GWEN_SSLCERTDESCR_LIST *stl) {
479  if (stl) {
480  GWEN_SSLCERTDESCR_LIST *nl;
482 
483  nl=GWEN_SslCertDescr_List_new();
484  e=GWEN_SslCertDescr_List_First(stl);
485  while(e) {
486  GWEN_SSLCERTDESCR *ne;
487 
488  ne=GWEN_SslCertDescr_dup(e);
489  assert(ne);
490  GWEN_SslCertDescr_List_Add(ne, nl);
491  e=GWEN_SslCertDescr_List_Next(e);
492  } /* while (e) */
493  return nl;
494  }
495  else
496  return 0;
497 }
498 
499 
500 
501