gwenhywfar 5.10.1
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
20GWEN_LIST_FUNCTIONS(GWEN_SSLCERTDESCR, GWEN_SslCertDescr)
22
23
24
26
27
28
30{
32
34 st->_usage=1;
36 return st;
37}
38
39
41{
42 if (st) {
43 assert(st->_usage);
44 if (--(st->_usage)==0) {
45 if (st->countryName)
46 free(st->countryName);
47 if (st->commonName)
48 free(st->commonName);
49 if (st->organizationName)
50 free(st->organizationName);
51 if (st->organizationalUnitName)
52 free(st->organizationalUnitName);
53 if (st->localityName)
54 free(st->localityName);
55 if (st->stateOrProvinceName)
56 free(st->stateOrProvinceName);
57 if (st->notBefore)
58 GWEN_Time_free(st->notBefore);
59 if (st->notAfter)
60 GWEN_Time_free(st->notAfter);
61 if (st->ipAddress)
62 free(st->ipAddress);
63 if (st->fingerPrint)
64 free(st->fingerPrint);
65 if (st->fingerPrintSha1)
66 free(st->fingerPrintSha1);
67 if (st->fingerPrintSha512)
68 free(st->fingerPrintSha512);
69 if (st->pubKeyModulus)
70 free(st->pubKeyModulus);
71 if (st->pubKeyExponent)
72 free(st->pubKeyExponent);
73 if (st->statusText)
74 free(st->statusText);
77 }
78 }
79
80}
81
82
84{
86
87 assert(d);
89 if (d->countryName)
90 st->countryName=strdup(d->countryName);
91 if (d->commonName)
92 st->commonName=strdup(d->commonName);
93 if (d->organizationName)
94 st->organizationName=strdup(d->organizationName);
95 if (d->organizationalUnitName)
96 st->organizationalUnitName=strdup(d->organizationalUnitName);
97 if (d->localityName)
98 st->localityName=strdup(d->localityName);
99 if (d->stateOrProvinceName)
100 st->stateOrProvinceName=strdup(d->stateOrProvinceName);
101 if (d->notBefore)
102 st->notBefore=GWEN_Time_dup(d->notBefore);
103 if (d->notAfter)
104 st->notAfter=GWEN_Time_dup(d->notAfter);
105 if (d->ipAddress)
106 st->ipAddress=strdup(d->ipAddress);
107 if (d->fingerPrint)
108 st->fingerPrint=strdup(d->fingerPrint);
109 if (d->fingerPrintSha1)
110 st->fingerPrintSha1=strdup(d->fingerPrintSha1);
111 if (d->fingerPrintSha512)
112 st->fingerPrintSha512=strdup(d->fingerPrintSha512);
113 if (d->pubKeyModulus)
114 st->pubKeyModulus=strdup(d->pubKeyModulus);
115 if (d->pubKeyExponent)
116 st->pubKeyExponent=strdup(d->pubKeyExponent);
117 if (d->statusText)
118 st->statusText=strdup(d->statusText);
119 st->isError=d->isError;
120 st->statusFlags=d->statusFlags;
121 return st;
122}
123
124
126{
127 assert(st);
128 assert(db);
129 if (st->countryName)
130 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "countryName", st->countryName))
131 return -1;
132 if (st->commonName)
133 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "commonName", st->commonName))
134 return -1;
135 if (st->organizationName)
136 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "organizationName", st->organizationName))
137 return -1;
138 if (st->organizationalUnitName)
139 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "organizationalUnitName", st->organizationalUnitName))
140 return -1;
141 if (st->localityName)
142 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "localityName", st->localityName))
143 return -1;
144 if (st->stateOrProvinceName)
145 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "stateOrProvinceName", st->stateOrProvinceName))
146 return -1;
147 if (st->notBefore)
148 if (GWEN_Time_toDb(st->notBefore, GWEN_DB_GetGroup(db, GWEN_DB_FLAGS_DEFAULT, "notBefore")))
149 return -1;
150 if (st->notAfter)
151 if (GWEN_Time_toDb(st->notAfter, GWEN_DB_GetGroup(db, GWEN_DB_FLAGS_DEFAULT, "notAfter")))
152 return -1;
153 if (st->ipAddress)
154 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "ipAddress", st->ipAddress))
155 return -1;
156 if (st->fingerPrint)
157 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fingerPrint", st->fingerPrint))
158 return -1;
159 if (st->fingerPrintSha1)
160 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fingerPrintSha1", st->fingerPrintSha1))
161 return -1;
162 if (st->fingerPrintSha512)
163 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fingerPrintSha512", st->fingerPrintSha512))
164 return -1;
165 if (st->pubKeyModulus)
166 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "pubKeyModulus", st->pubKeyModulus))
167 return -1;
168 if (st->pubKeyExponent)
169 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "pubKeyExponent", st->pubKeyExponent))
170 return -1;
171 if (st->statusText)
172 if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "statusText", st->statusText))
173 return -1;
174 if (GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "isError", st->isError))
175 return -1;
176 if (GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "statusFlags", st->statusFlags))
177 return -1;
178 return 0;
179}
180
181
183{
184 assert(st);
185 assert(db);
186 GWEN_SslCertDescr_SetCountryName(st, GWEN_DB_GetCharValue(db, "countryName", 0, 0));
187 GWEN_SslCertDescr_SetCommonName(st, GWEN_DB_GetCharValue(db, "commonName", 0, 0));
188 GWEN_SslCertDescr_SetOrganizationName(st, GWEN_DB_GetCharValue(db, "organizationName", 0, 0));
189 GWEN_SslCertDescr_SetOrganizationalUnitName(st, GWEN_DB_GetCharValue(db, "organizationalUnitName", 0, 0));
190 GWEN_SslCertDescr_SetLocalityName(st, GWEN_DB_GetCharValue(db, "localityName", 0, 0));
191 GWEN_SslCertDescr_SetStateOrProvinceName(st, GWEN_DB_GetCharValue(db, "stateOrProvinceName", 0, 0));
192 if (1) { /* for local vars */
193 GWEN_DB_NODE *dbT;
194
196 if (dbT) {
197 if (st->notBefore)
198 GWEN_Time_free(st->notBefore);
199 st->notBefore=GWEN_Time_fromDb(dbT);
200 }
201 }
202 if (1) { /* for local vars */
203 GWEN_DB_NODE *dbT;
204
206 if (dbT) {
207 if (st->notAfter)
208 GWEN_Time_free(st->notAfter);
209 st->notAfter=GWEN_Time_fromDb(dbT);
210 }
211 }
212 GWEN_SslCertDescr_SetIpAddress(st, GWEN_DB_GetCharValue(db, "ipAddress", 0, 0));
213 GWEN_SslCertDescr_SetFingerPrint(st, GWEN_DB_GetCharValue(db, "fingerPrint", 0, 0));
214 GWEN_SslCertDescr_SetFingerPrintSha1(st, GWEN_DB_GetCharValue(db, "fingerPrintSha1", 0, 0));
215 GWEN_SslCertDescr_SetFingerPrintSha512(st, GWEN_DB_GetCharValue(db, "fingerPrintSha512", 0, 0));
216 GWEN_SslCertDescr_SetPubKeyModulus(st, GWEN_DB_GetCharValue(db, "pubKeyModulus", 0, 0));
217 GWEN_SslCertDescr_SetPubKeyExponent(st, GWEN_DB_GetCharValue(db, "pubKeyExponent", 0, 0));
218 GWEN_SslCertDescr_SetStatusText(st, GWEN_DB_GetCharValue(db, "statusText", 0, 0));
219 GWEN_SslCertDescr_SetIsError(st, GWEN_DB_GetIntValue(db, "isError", 0, 0));
220 GWEN_SslCertDescr_SetStatusFlags(st, GWEN_DB_GetIntValue(db, "statusFlags", 0, 0));
221 return 0;
222}
223
224
226{
228
229 assert(db);
232 st->_modified=0;
233 return st;
234}
235
236
237
238
240{
241 assert(st);
242 return st->countryName;
243}
244
245
247{
248 assert(st);
249 if (st->countryName)
250 free(st->countryName);
251 if (d && *d)
252 st->countryName=strdup(d);
253 else
254 st->countryName=0;
255 st->_modified=1;
256}
257
258
259
260
262{
263 assert(st);
264 return st->commonName;
265}
266
267
269{
270 assert(st);
271 if (st->commonName)
272 free(st->commonName);
273 if (d && *d)
274 st->commonName=strdup(d);
275 else
276 st->commonName=0;
277 st->_modified=1;
278}
279
280
281
282
284{
285 assert(st);
286 return st->organizationName;
287}
288
289
291{
292 assert(st);
293 if (st->organizationName)
294 free(st->organizationName);
295 if (d && *d)
296 st->organizationName=strdup(d);
297 else
298 st->organizationName=0;
299 st->_modified=1;
300}
301
302
303
304
306{
307 assert(st);
308 return st->organizationalUnitName;
309}
310
311
313{
314 assert(st);
315 if (st->organizationalUnitName)
316 free(st->organizationalUnitName);
317 if (d && *d)
318 st->organizationalUnitName=strdup(d);
319 else
320 st->organizationalUnitName=0;
321 st->_modified=1;
322}
323
324
325
326
328{
329 assert(st);
330 return st->localityName;
331}
332
333
335{
336 assert(st);
337 if (st->localityName)
338 free(st->localityName);
339 if (d && *d)
340 st->localityName=strdup(d);
341 else
342 st->localityName=0;
343 st->_modified=1;
344}
345
346
347
348
350{
351 assert(st);
352 return st->stateOrProvinceName;
353}
354
355
357{
358 assert(st);
359 if (st->stateOrProvinceName)
360 free(st->stateOrProvinceName);
361 if (d && *d)
362 st->stateOrProvinceName=strdup(d);
363 else
364 st->stateOrProvinceName=0;
365 st->_modified=1;
366}
367
368
369
370
372{
373 assert(st);
374 return st->notBefore;
375}
376
377
379{
380 assert(st);
381 if (st->notBefore)
382 GWEN_Time_free(st->notBefore);
383 if (d)
384 st->notBefore=GWEN_Time_dup(d);
385 else
386 st->notBefore=0;
387 st->_modified=1;
388}
389
390
391
392
394{
395 assert(st);
396 return st->notAfter;
397}
398
399
401{
402 assert(st);
403 if (st->notAfter)
404 GWEN_Time_free(st->notAfter);
405 if (d)
406 st->notAfter=GWEN_Time_dup(d);
407 else
408 st->notAfter=0;
409 st->_modified=1;
410}
411
412
413
414
416{
417 assert(st);
418 return st->ipAddress;
419}
420
421
423{
424 assert(st);
425 if (st->ipAddress)
426 free(st->ipAddress);
427 if (d && *d)
428 st->ipAddress=strdup(d);
429 else
430 st->ipAddress=0;
431 st->_modified=1;
432}
433
434
435
436
438{
439 assert(st);
440 return st->fingerPrint;
441}
442
443
445{
446 assert(st);
447 if (st->fingerPrint)
448 free(st->fingerPrint);
449 if (d && *d)
450 st->fingerPrint=strdup(d);
451 else
452 st->fingerPrint=0;
453 st->_modified=1;
454}
455
456
457
458
460{
461 assert(st);
462 return st->fingerPrintSha1;
463}
464
465
467{
468 assert(st);
469 if (st->fingerPrintSha1)
470 free(st->fingerPrintSha1);
471 if (d && *d)
472 st->fingerPrintSha1=strdup(d);
473 else
474 st->fingerPrintSha1=0;
475 st->_modified=1;
476}
477
478
479
480
482{
483 assert(st);
484 return st->fingerPrintSha512;
485}
486
487
489{
490 assert(st);
491 if (st->fingerPrintSha512)
492 free(st->fingerPrintSha512);
493 if (d && *d)
494 st->fingerPrintSha512=strdup(d);
495 else
496 st->fingerPrintSha512=0;
497 st->_modified=1;
498}
499
500
501
502
504{
505 assert(st);
506 return st->pubKeyModulus;
507}
508
509
511{
512 assert(st);
513 if (st->pubKeyModulus)
514 free(st->pubKeyModulus);
515 if (d && *d)
516 st->pubKeyModulus=strdup(d);
517 else
518 st->pubKeyModulus=0;
519 st->_modified=1;
520}
521
522
523
524
526{
527 assert(st);
528 return st->pubKeyExponent;
529}
530
531
533{
534 assert(st);
535 if (st->pubKeyExponent)
536 free(st->pubKeyExponent);
537 if (d && *d)
538 st->pubKeyExponent=strdup(d);
539 else
540 st->pubKeyExponent=0;
541 st->_modified=1;
542}
543
544
545
546
548{
549 assert(st);
550 return st->statusText;
551}
552
553
555{
556 assert(st);
557 if (st->statusText)
558 free(st->statusText);
559 if (d && *d)
560 st->statusText=strdup(d);
561 else
562 st->statusText=0;
563 st->_modified=1;
564}
565
566
567
568
570{
571 assert(st);
572 return st->isError;
573}
574
575
577{
578 assert(st);
579 st->isError=d;
580 st->_modified=1;
581}
582
583
584
585
587{
588 assert(st);
589 return st->statusFlags;
590}
591
592
594{
595 assert(st);
596 st->statusFlags=d;
597 st->_modified=1;
598}
599
600
601
602
604{
605 assert(st);
606 return st->_modified;
607}
608
609
611{
612 assert(st);
613 st->_modified=i;
614}
615
616
618{
619 assert(st);
620 st->_usage++;
621}
623{
625 return 0;
626}
627
628
630{
631 if (stl) {
634 }
635}
636
637
639{
640 if (stl) {
643
646 while (e) {
648
650 assert(ne);
653 } /* while (e) */
654 return nl;
655 }
656 else
657 return 0;
658}
659
660
661
662
const char * GWEN_DB_GetCharValue(GWEN_DB_NODE *n, const char *path, int idx, const char *defVal)
Definition: db.c:971
int GWEN_DB_SetIntValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, int val)
Definition: db.c:1202
GWEN_DB_NODE * GWEN_DB_GetGroup(GWEN_DB_NODE *n, uint32_t flags, const char *path)
Definition: db.c:1381
int GWEN_DB_SetCharValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, const char *val)
Definition: db.c:997
int GWEN_DB_GetIntValue(GWEN_DB_NODE *n, const char *path, int idx, int defVal)
Definition: db.c:1163
#define GWEN_DB_FLAGS_DEFAULT
Definition: db.h:168
#define GWEN_DB_FLAGS_OVERWRITE_VARS
Definition: db.h:121
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:228
#define GWEN_UNUSED
GWENHYWFAR_API int GWEN_Time_toDb(const GWEN_TIME *t, GWEN_DB_NODE *db)
Definition: gwentime_all.c:133
struct GWEN_TIME GWEN_TIME
Definition: gwentime.h:43
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromDb(GWEN_DB_NODE *db)
Definition: gwentime_all.c:174
GWENHYWFAR_API void GWEN_Time_free(GWEN_TIME *t)
Definition: gwentime_all.c:462
GWENHYWFAR_API GWEN_TIME * GWEN_Time_dup(const GWEN_TIME *t)
Definition: gwentime_all.c:449
#define GWEN_LIST_FINI(t, element)
Definition: list1.h:474
#define GWEN_LIST_FUNCTIONS(t, pr)
Definition: list1.h:366
#define GWEN_LIST_INIT(t, element)
Definition: list1.h:465
#define GWEN_LIST2_FUNCTIONS(t, pr)
Definition: list2.h:99
GWEN_SSLCERTDESCR_LIST * GWEN_SslCertDescr_List_new()
struct GWEN_SSLCERTDESCR_LIST2 GWEN_SSLCERTDESCR_LIST2
Definition: listdoc.h:7081
void GWEN_SslCertDescr_List_Add(GWEN_SSLCERTDESCR *element, GWEN_SSLCERTDESCR_LIST *list)
GWEN_SSLCERTDESCR * GWEN_SslCertDescr_List2_ForEach(GWEN_SSLCERTDESCR_LIST2 *list, GWEN_SSLCERTDESCR_LIST2_FOREACH func, void *user_data)
void GWEN_SslCertDescr_List2_free(GWEN_SSLCERTDESCR_LIST2 *l)
GWEN_SSLCERTDESCR * GWEN_SslCertDescr_List_First(const GWEN_SSLCERTDESCR_LIST *l)
GWEN_SSLCERTDESCR * GWEN_SslCertDescr_List_Next(const GWEN_SSLCERTDESCR *element)
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:61
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:55
#define GWEN_PATH_FLAGS_NAMEMUSTEXIST
Definition: path.h:84
void GWEN_SslCertDescr_SetIsError(GWEN_SSLCERTDESCR *st, int d)
const char * GWEN_SslCertDescr_GetFingerPrintSha1(const GWEN_SSLCERTDESCR *st)
const char * GWEN_SslCertDescr_GetCommonName(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetFingerPrintSha1(GWEN_SSLCERTDESCR *st, const char *d)
const char * GWEN_SslCertDescr_GetPubKeyExponent(const GWEN_SSLCERTDESCR *st)
const char * GWEN_SslCertDescr_GetOrganizationName(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetOrganizationName(GWEN_SSLCERTDESCR *st, const char *d)
GWEN_SSLCERTDESCR * GWEN_SslCertDescr_new(void)
void GWEN_SslCertDescr_SetNotAfter(GWEN_SSLCERTDESCR *st, const GWEN_TIME *d)
static GWEN_SSLCERTDESCR * GWEN_SslCertDescr_List2__freeAll_cb(GWEN_SSLCERTDESCR *st, void *user_data)
const GWEN_TIME * GWEN_SslCertDescr_GetNotAfter(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetFingerPrint(GWEN_SSLCERTDESCR *st, const char *d)
int GWEN_SslCertDescr_ReadDb(GWEN_SSLCERTDESCR *st, GWEN_DB_NODE *db)
const char * GWEN_SslCertDescr_GetFingerPrint(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetPubKeyExponent(GWEN_SSLCERTDESCR *st, const char *d)
int GWEN_SslCertDescr_toDb(const GWEN_SSLCERTDESCR *st, GWEN_DB_NODE *db)
const char * GWEN_SslCertDescr_GetPubKeyModulus(const GWEN_SSLCERTDESCR *st)
GWEN_SSLCERTDESCR_LIST * GWEN_SslCertDescr_List_dup(const GWEN_SSLCERTDESCR_LIST *stl)
const char * GWEN_SslCertDescr_GetIpAddress(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetStatusFlags(GWEN_SSLCERTDESCR *st, uint32_t d)
void GWEN_SslCertDescr_SetCommonName(GWEN_SSLCERTDESCR *st, const char *d)
void GWEN_SslCertDescr_Attach(GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetLocalityName(GWEN_SSLCERTDESCR *st, const char *d)
GWEN_SSLCERTDESCR * GWEN_SslCertDescr_dup(const GWEN_SSLCERTDESCR *d)
const char * GWEN_SslCertDescr_GetFingerPrintSha512(const GWEN_SSLCERTDESCR *st)
const char * GWEN_SslCertDescr_GetStateOrProvinceName(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetOrganizationalUnitName(GWEN_SSLCERTDESCR *st, const char *d)
void GWEN_SslCertDescr_SetModified(GWEN_SSLCERTDESCR *st, int i)
void GWEN_SslCertDescr_SetIpAddress(GWEN_SSLCERTDESCR *st, const char *d)
const char * GWEN_SslCertDescr_GetStatusText(const GWEN_SSLCERTDESCR *st)
const char * GWEN_SslCertDescr_GetLocalityName(const GWEN_SSLCERTDESCR *st)
GWEN_SSLCERTDESCR * GWEN_SslCertDescr_fromDb(GWEN_DB_NODE *db)
void GWEN_SslCertDescr_SetNotBefore(GWEN_SSLCERTDESCR *st, const GWEN_TIME *d)
int GWEN_SslCertDescr_GetIsError(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_free(GWEN_SSLCERTDESCR *st)
const char * GWEN_SslCertDescr_GetOrganizationalUnitName(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetCountryName(GWEN_SSLCERTDESCR *st, const char *d)
void GWEN_SslCertDescr_SetFingerPrintSha512(GWEN_SSLCERTDESCR *st, const char *d)
int GWEN_SslCertDescr_IsModified(const GWEN_SSLCERTDESCR *st)
const char * GWEN_SslCertDescr_GetCountryName(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetPubKeyModulus(GWEN_SSLCERTDESCR *st, const char *d)
void GWEN_SslCertDescr_SetStatusText(GWEN_SSLCERTDESCR *st, const char *d)
uint32_t GWEN_SslCertDescr_GetStatusFlags(const GWEN_SSLCERTDESCR *st)
void GWEN_SslCertDescr_SetStateOrProvinceName(GWEN_SSLCERTDESCR *st, const char *d)
void GWEN_SslCertDescr_List2_freeAll(GWEN_SSLCERTDESCR_LIST2 *stl)
const GWEN_TIME * GWEN_SslCertDescr_GetNotBefore(const GWEN_SSLCERTDESCR *st)
struct GWEN_SSLCERTDESCR GWEN_SSLCERTDESCR