/* This file is auto-generated from "ssl_cert_descr.xml" by the typemaker tool of Gwenhywfar. Do not edit this file -- all changes will be lost! */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "ssl_cert_descr_p.h" #include #include #include #include #include #include #include #include GWEN_LIST_FUNCTIONS(GWEN_SSLCERTDESCR, GWEN_SslCertDescr) GWEN_LIST2_FUNCTIONS(GWEN_SSLCERTDESCR, GWEN_SslCertDescr) static GWEN_SSLCERTDESCR *GWEN_SslCertDescr_List2__freeAll_cb(GWEN_SSLCERTDESCR *st, void *user_data); GWEN_SSLCERTDESCR *GWEN_SslCertDescr_new(void) { GWEN_SSLCERTDESCR *st; GWEN_NEW_OBJECT(GWEN_SSLCERTDESCR, st) st->_usage=1; GWEN_LIST_INIT(GWEN_SSLCERTDESCR, st) return st; } void GWEN_SslCertDescr_free(GWEN_SSLCERTDESCR *st) { if (st) { assert(st->_usage); if (--(st->_usage)==0) { if (st->countryName) free(st->countryName); if (st->commonName) free(st->commonName); if (st->organizationName) free(st->organizationName); if (st->organizationalUnitName) free(st->organizationalUnitName); if (st->localityName) free(st->localityName); if (st->stateOrProvinceName) free(st->stateOrProvinceName); if (st->notBefore) GWEN_Time_free(st->notBefore); if (st->notAfter) GWEN_Time_free(st->notAfter); if (st->ipAddress) free(st->ipAddress); if (st->fingerPrint) free(st->fingerPrint); if (st->fingerPrintSha1) free(st->fingerPrintSha1); if (st->fingerPrintSha512) free(st->fingerPrintSha512); if (st->pubKeyModulus) free(st->pubKeyModulus); if (st->pubKeyExponent) free(st->pubKeyExponent); if (st->statusText) free(st->statusText); GWEN_LIST_FINI(GWEN_SSLCERTDESCR, st) GWEN_FREE_OBJECT(st); } } } GWEN_SSLCERTDESCR *GWEN_SslCertDescr_dup(const GWEN_SSLCERTDESCR *d) { GWEN_SSLCERTDESCR *st; assert(d); st=GWEN_SslCertDescr_new(); if (d->countryName) st->countryName=strdup(d->countryName); if (d->commonName) st->commonName=strdup(d->commonName); if (d->organizationName) st->organizationName=strdup(d->organizationName); if (d->organizationalUnitName) st->organizationalUnitName=strdup(d->organizationalUnitName); if (d->localityName) st->localityName=strdup(d->localityName); if (d->stateOrProvinceName) st->stateOrProvinceName=strdup(d->stateOrProvinceName); if (d->notBefore) st->notBefore=GWEN_Time_dup(d->notBefore); if (d->notAfter) st->notAfter=GWEN_Time_dup(d->notAfter); if (d->ipAddress) st->ipAddress=strdup(d->ipAddress); if (d->fingerPrint) st->fingerPrint=strdup(d->fingerPrint); if (d->fingerPrintSha1) st->fingerPrintSha1=strdup(d->fingerPrintSha1); if (d->fingerPrintSha512) st->fingerPrintSha512=strdup(d->fingerPrintSha512); if (d->pubKeyModulus) st->pubKeyModulus=strdup(d->pubKeyModulus); if (d->pubKeyExponent) st->pubKeyExponent=strdup(d->pubKeyExponent); if (d->statusText) st->statusText=strdup(d->statusText); st->isError=d->isError; st->statusFlags=d->statusFlags; return st; } int GWEN_SslCertDescr_toDb(const GWEN_SSLCERTDESCR *st, GWEN_DB_NODE *db) { assert(st); assert(db); if (st->countryName) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "countryName", st->countryName)) return -1; if (st->commonName) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "commonName", st->commonName)) return -1; if (st->organizationName) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "organizationName", st->organizationName)) return -1; if (st->organizationalUnitName) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "organizationalUnitName", st->organizationalUnitName)) return -1; if (st->localityName) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "localityName", st->localityName)) return -1; if (st->stateOrProvinceName) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "stateOrProvinceName", st->stateOrProvinceName)) return -1; if (st->notBefore) if (GWEN_Time_toDb(st->notBefore, GWEN_DB_GetGroup(db, GWEN_DB_FLAGS_DEFAULT, "notBefore"))) return -1; if (st->notAfter) if (GWEN_Time_toDb(st->notAfter, GWEN_DB_GetGroup(db, GWEN_DB_FLAGS_DEFAULT, "notAfter"))) return -1; if (st->ipAddress) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "ipAddress", st->ipAddress)) return -1; if (st->fingerPrint) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fingerPrint", st->fingerPrint)) return -1; if (st->fingerPrintSha1) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fingerPrintSha1", st->fingerPrintSha1)) return -1; if (st->fingerPrintSha512) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fingerPrintSha512", st->fingerPrintSha512)) return -1; if (st->pubKeyModulus) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "pubKeyModulus", st->pubKeyModulus)) return -1; if (st->pubKeyExponent) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "pubKeyExponent", st->pubKeyExponent)) return -1; if (st->statusText) if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "statusText", st->statusText)) return -1; if (GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "isError", st->isError)) return -1; if (GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "statusFlags", st->statusFlags)) return -1; return 0; } int GWEN_SslCertDescr_ReadDb(GWEN_SSLCERTDESCR *st, GWEN_DB_NODE *db) { assert(st); assert(db); GWEN_SslCertDescr_SetCountryName(st, GWEN_DB_GetCharValue(db, "countryName", 0, 0)); GWEN_SslCertDescr_SetCommonName(st, GWEN_DB_GetCharValue(db, "commonName", 0, 0)); GWEN_SslCertDescr_SetOrganizationName(st, GWEN_DB_GetCharValue(db, "organizationName", 0, 0)); GWEN_SslCertDescr_SetOrganizationalUnitName(st, GWEN_DB_GetCharValue(db, "organizationalUnitName", 0, 0)); GWEN_SslCertDescr_SetLocalityName(st, GWEN_DB_GetCharValue(db, "localityName", 0, 0)); GWEN_SslCertDescr_SetStateOrProvinceName(st, GWEN_DB_GetCharValue(db, "stateOrProvinceName", 0, 0)); if (1) { /* for local vars */ GWEN_DB_NODE *dbT; dbT=GWEN_DB_GetGroup(db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "notBefore"); if (dbT) { if (st->notBefore) GWEN_Time_free(st->notBefore); st->notBefore=GWEN_Time_fromDb(dbT); } } if (1) { /* for local vars */ GWEN_DB_NODE *dbT; dbT=GWEN_DB_GetGroup(db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "notAfter"); if (dbT) { if (st->notAfter) GWEN_Time_free(st->notAfter); st->notAfter=GWEN_Time_fromDb(dbT); } } GWEN_SslCertDescr_SetIpAddress(st, GWEN_DB_GetCharValue(db, "ipAddress", 0, 0)); GWEN_SslCertDescr_SetFingerPrint(st, GWEN_DB_GetCharValue(db, "fingerPrint", 0, 0)); GWEN_SslCertDescr_SetFingerPrintSha1(st, GWEN_DB_GetCharValue(db, "fingerPrintSha1", 0, 0)); GWEN_SslCertDescr_SetFingerPrintSha512(st, GWEN_DB_GetCharValue(db, "fingerPrintSha512", 0, 0)); GWEN_SslCertDescr_SetPubKeyModulus(st, GWEN_DB_GetCharValue(db, "pubKeyModulus", 0, 0)); GWEN_SslCertDescr_SetPubKeyExponent(st, GWEN_DB_GetCharValue(db, "pubKeyExponent", 0, 0)); GWEN_SslCertDescr_SetStatusText(st, GWEN_DB_GetCharValue(db, "statusText", 0, 0)); GWEN_SslCertDescr_SetIsError(st, GWEN_DB_GetIntValue(db, "isError", 0, 0)); GWEN_SslCertDescr_SetStatusFlags(st, GWEN_DB_GetIntValue(db, "statusFlags", 0, 0)); return 0; } GWEN_SSLCERTDESCR *GWEN_SslCertDescr_fromDb(GWEN_DB_NODE *db) { GWEN_SSLCERTDESCR *st; assert(db); st=GWEN_SslCertDescr_new(); GWEN_SslCertDescr_ReadDb(st, db); st->_modified=0; return st; } const char *GWEN_SslCertDescr_GetCountryName(const GWEN_SSLCERTDESCR *st) { assert(st); return st->countryName; } void GWEN_SslCertDescr_SetCountryName(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->countryName) free(st->countryName); if (d && *d) st->countryName=strdup(d); else st->countryName=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetCommonName(const GWEN_SSLCERTDESCR *st) { assert(st); return st->commonName; } void GWEN_SslCertDescr_SetCommonName(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->commonName) free(st->commonName); if (d && *d) st->commonName=strdup(d); else st->commonName=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetOrganizationName(const GWEN_SSLCERTDESCR *st) { assert(st); return st->organizationName; } void GWEN_SslCertDescr_SetOrganizationName(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->organizationName) free(st->organizationName); if (d && *d) st->organizationName=strdup(d); else st->organizationName=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetOrganizationalUnitName(const GWEN_SSLCERTDESCR *st) { assert(st); return st->organizationalUnitName; } void GWEN_SslCertDescr_SetOrganizationalUnitName(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->organizationalUnitName) free(st->organizationalUnitName); if (d && *d) st->organizationalUnitName=strdup(d); else st->organizationalUnitName=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetLocalityName(const GWEN_SSLCERTDESCR *st) { assert(st); return st->localityName; } void GWEN_SslCertDescr_SetLocalityName(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->localityName) free(st->localityName); if (d && *d) st->localityName=strdup(d); else st->localityName=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetStateOrProvinceName(const GWEN_SSLCERTDESCR *st) { assert(st); return st->stateOrProvinceName; } void GWEN_SslCertDescr_SetStateOrProvinceName(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->stateOrProvinceName) free(st->stateOrProvinceName); if (d && *d) st->stateOrProvinceName=strdup(d); else st->stateOrProvinceName=0; st->_modified=1; } const GWEN_TIME *GWEN_SslCertDescr_GetNotBefore(const GWEN_SSLCERTDESCR *st) { assert(st); return st->notBefore; } void GWEN_SslCertDescr_SetNotBefore(GWEN_SSLCERTDESCR *st, const GWEN_TIME *d) { assert(st); if (st->notBefore) GWEN_Time_free(st->notBefore); if (d) st->notBefore=GWEN_Time_dup(d); else st->notBefore=0; st->_modified=1; } const GWEN_TIME *GWEN_SslCertDescr_GetNotAfter(const GWEN_SSLCERTDESCR *st) { assert(st); return st->notAfter; } void GWEN_SslCertDescr_SetNotAfter(GWEN_SSLCERTDESCR *st, const GWEN_TIME *d) { assert(st); if (st->notAfter) GWEN_Time_free(st->notAfter); if (d) st->notAfter=GWEN_Time_dup(d); else st->notAfter=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetIpAddress(const GWEN_SSLCERTDESCR *st) { assert(st); return st->ipAddress; } void GWEN_SslCertDescr_SetIpAddress(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->ipAddress) free(st->ipAddress); if (d && *d) st->ipAddress=strdup(d); else st->ipAddress=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetFingerPrint(const GWEN_SSLCERTDESCR *st) { assert(st); return st->fingerPrint; } void GWEN_SslCertDescr_SetFingerPrint(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->fingerPrint) free(st->fingerPrint); if (d && *d) st->fingerPrint=strdup(d); else st->fingerPrint=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetFingerPrintSha1(const GWEN_SSLCERTDESCR *st) { assert(st); return st->fingerPrintSha1; } void GWEN_SslCertDescr_SetFingerPrintSha1(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->fingerPrintSha1) free(st->fingerPrintSha1); if (d && *d) st->fingerPrintSha1=strdup(d); else st->fingerPrintSha1=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetFingerPrintSha512(const GWEN_SSLCERTDESCR *st) { assert(st); return st->fingerPrintSha512; } void GWEN_SslCertDescr_SetFingerPrintSha512(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->fingerPrintSha512) free(st->fingerPrintSha512); if (d && *d) st->fingerPrintSha512=strdup(d); else st->fingerPrintSha512=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetPubKeyModulus(const GWEN_SSLCERTDESCR *st) { assert(st); return st->pubKeyModulus; } void GWEN_SslCertDescr_SetPubKeyModulus(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->pubKeyModulus) free(st->pubKeyModulus); if (d && *d) st->pubKeyModulus=strdup(d); else st->pubKeyModulus=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetPubKeyExponent(const GWEN_SSLCERTDESCR *st) { assert(st); return st->pubKeyExponent; } void GWEN_SslCertDescr_SetPubKeyExponent(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->pubKeyExponent) free(st->pubKeyExponent); if (d && *d) st->pubKeyExponent=strdup(d); else st->pubKeyExponent=0; st->_modified=1; } const char *GWEN_SslCertDescr_GetStatusText(const GWEN_SSLCERTDESCR *st) { assert(st); return st->statusText; } void GWEN_SslCertDescr_SetStatusText(GWEN_SSLCERTDESCR *st, const char *d) { assert(st); if (st->statusText) free(st->statusText); if (d && *d) st->statusText=strdup(d); else st->statusText=0; st->_modified=1; } int GWEN_SslCertDescr_GetIsError(const GWEN_SSLCERTDESCR *st) { assert(st); return st->isError; } void GWEN_SslCertDescr_SetIsError(GWEN_SSLCERTDESCR *st, int d) { assert(st); st->isError=d; st->_modified=1; } uint32_t GWEN_SslCertDescr_GetStatusFlags(const GWEN_SSLCERTDESCR *st) { assert(st); return st->statusFlags; } void GWEN_SslCertDescr_SetStatusFlags(GWEN_SSLCERTDESCR *st, uint32_t d) { assert(st); st->statusFlags=d; st->_modified=1; } int GWEN_SslCertDescr_IsModified(const GWEN_SSLCERTDESCR *st) { assert(st); return st->_modified; } void GWEN_SslCertDescr_SetModified(GWEN_SSLCERTDESCR *st, int i) { assert(st); st->_modified=i; } void GWEN_SslCertDescr_Attach(GWEN_SSLCERTDESCR *st) { assert(st); st->_usage++; } GWEN_SSLCERTDESCR *GWEN_SslCertDescr_List2__freeAll_cb(GWEN_SSLCERTDESCR *st, GWEN_UNUSED void *user_data) { GWEN_SslCertDescr_free(st); return 0; } void GWEN_SslCertDescr_List2_freeAll(GWEN_SSLCERTDESCR_LIST2 *stl) { if (stl) { GWEN_SslCertDescr_List2_ForEach(stl, GWEN_SslCertDescr_List2__freeAll_cb, 0); GWEN_SslCertDescr_List2_free(stl); } } GWEN_SSLCERTDESCR_LIST *GWEN_SslCertDescr_List_dup(const GWEN_SSLCERTDESCR_LIST *stl) { if (stl) { GWEN_SSLCERTDESCR_LIST *nl; GWEN_SSLCERTDESCR *e; nl=GWEN_SslCertDescr_List_new(); e=GWEN_SslCertDescr_List_First(stl); while (e) { GWEN_SSLCERTDESCR *ne; ne=GWEN_SslCertDescr_dup(e); assert(ne); GWEN_SslCertDescr_List_Add(ne, nl); e=GWEN_SslCertDescr_List_Next(e); } /* while (e) */ return nl; } else return 0; }