gwenhywfar
4.3.3
|
00001 /********************************************************** 00002 * This file has been automatically created by "typemaker2" 00003 * from the file "ct_context.xml". 00004 * Please do not edit this file, all changes will be lost. 00005 * Better edit the mentioned source file instead. 00006 **********************************************************/ 00007 00008 #ifdef HAVE_CONFIG_H 00009 # include <config.h> 00010 #endif 00011 00012 #include "ct_context_p.h" 00013 00014 #include <gwenhywfar/misc.h> 00015 #include <gwenhywfar/debug.h> 00016 00017 /* code headers */ 00018 00019 /* macro functions */ 00020 GWEN_LIST_FUNCTIONS(GWEN_CRYPT_TOKEN_CONTEXT, GWEN_Crypt_Token_Context) 00021 GWEN_LIST2_FUNCTIONS(GWEN_CRYPT_TOKEN_CONTEXT, GWEN_Crypt_Token_Context) 00022 GWEN_INHERIT_FUNCTIONS(GWEN_CRYPT_TOKEN_CONTEXT) 00023 00024 00025 GWEN_CRYPT_TOKEN_CONTEXT *GWEN_Crypt_Token_Context_new(void) { 00026 GWEN_CRYPT_TOKEN_CONTEXT *p_struct; 00027 00028 GWEN_NEW_OBJECT(GWEN_CRYPT_TOKEN_CONTEXT, p_struct) 00029 p_struct->_refCount=1; 00030 GWEN_INHERIT_INIT(GWEN_CRYPT_TOKEN_CONTEXT, p_struct) 00031 GWEN_LIST_INIT(GWEN_CRYPT_TOKEN_CONTEXT, p_struct) 00032 /* members */ 00033 p_struct->id=0; 00034 p_struct->signKeyId=0; 00035 p_struct->verifyKeyId=0; 00036 p_struct->encipherKeyId=0; 00037 p_struct->decipherKeyId=0; 00038 p_struct->authSignKeyId=0; 00039 p_struct->authVerifyKeyId=0; 00040 p_struct->tempSignKeyId=0; 00041 p_struct->serviceId=NULL; 00042 p_struct->userId=NULL; 00043 p_struct->customerId=NULL; 00044 p_struct->userName=NULL; 00045 p_struct->peerId=NULL; 00046 p_struct->peerName=NULL; 00047 p_struct->address=NULL; 00048 p_struct->port=0; 00049 p_struct->systemId=NULL; 00050 00051 return p_struct; 00052 } 00053 00054 void GWEN_Crypt_Token_Context_free(GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00055 if (p_struct) { 00056 assert(p_struct->_refCount); 00057 if (p_struct->_refCount==1) { 00058 GWEN_INHERIT_FINI(GWEN_CRYPT_TOKEN_CONTEXT, p_struct) 00059 GWEN_LIST_FINI(GWEN_CRYPT_TOKEN_CONTEXT, p_struct) 00060 /* members */ 00061 free(p_struct->serviceId); 00062 free(p_struct->userId); 00063 free(p_struct->customerId); 00064 free(p_struct->userName); 00065 free(p_struct->peerId); 00066 free(p_struct->peerName); 00067 free(p_struct->address); 00068 free(p_struct->systemId); 00069 p_struct->_refCount=0; 00070 GWEN_FREE_OBJECT(p_struct); 00071 } 00072 else 00073 p_struct->_refCount--; 00074 } 00075 } 00076 00077 void GWEN_Crypt_Token_Context_Attach(GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00078 assert(p_struct); 00079 assert(p_struct->_refCount); 00080 p_struct->_refCount++; 00081 } 00082 00083 GWEN_CRYPT_TOKEN_CONTEXT *GWEN_Crypt_Token_Context_dup(const GWEN_CRYPT_TOKEN_CONTEXT *p_src) { 00084 GWEN_CRYPT_TOKEN_CONTEXT *p_struct; 00085 00086 assert(p_src); 00087 p_struct=GWEN_Crypt_Token_Context_new(); 00088 /* member "id" */ 00089 p_struct->id=p_src->id; 00090 00091 /* member "signKeyId" */ 00092 p_struct->signKeyId=p_src->signKeyId; 00093 00094 /* member "verifyKeyId" */ 00095 p_struct->verifyKeyId=p_src->verifyKeyId; 00096 00097 /* member "encipherKeyId" */ 00098 p_struct->encipherKeyId=p_src->encipherKeyId; 00099 00100 /* member "decipherKeyId" */ 00101 p_struct->decipherKeyId=p_src->decipherKeyId; 00102 00103 /* member "authSignKeyId" */ 00104 p_struct->authSignKeyId=p_src->authSignKeyId; 00105 00106 /* member "authVerifyKeyId" */ 00107 p_struct->authVerifyKeyId=p_src->authVerifyKeyId; 00108 00109 /* member "tempSignKeyId" */ 00110 p_struct->tempSignKeyId=p_src->tempSignKeyId; 00111 00112 /* member "serviceId" */ 00113 if (p_struct->serviceId) { 00114 free(p_struct->serviceId); 00115 p_struct->serviceId=NULL; 00116 } 00117 if (p_src->serviceId) { 00118 p_struct->serviceId=strdup(p_src->serviceId); 00119 } 00120 00121 /* member "userId" */ 00122 if (p_struct->userId) { 00123 free(p_struct->userId); 00124 p_struct->userId=NULL; 00125 } 00126 if (p_src->userId) { 00127 p_struct->userId=strdup(p_src->userId); 00128 } 00129 00130 /* member "customerId" */ 00131 if (p_struct->customerId) { 00132 free(p_struct->customerId); 00133 p_struct->customerId=NULL; 00134 } 00135 if (p_src->customerId) { 00136 p_struct->customerId=strdup(p_src->customerId); 00137 } 00138 00139 /* member "userName" */ 00140 if (p_struct->userName) { 00141 free(p_struct->userName); 00142 p_struct->userName=NULL; 00143 } 00144 if (p_src->userName) { 00145 p_struct->userName=strdup(p_src->userName); 00146 } 00147 00148 /* member "peerId" */ 00149 if (p_struct->peerId) { 00150 free(p_struct->peerId); 00151 p_struct->peerId=NULL; 00152 } 00153 if (p_src->peerId) { 00154 p_struct->peerId=strdup(p_src->peerId); 00155 } 00156 00157 /* member "peerName" */ 00158 if (p_struct->peerName) { 00159 free(p_struct->peerName); 00160 p_struct->peerName=NULL; 00161 } 00162 if (p_src->peerName) { 00163 p_struct->peerName=strdup(p_src->peerName); 00164 } 00165 00166 /* member "address" */ 00167 if (p_struct->address) { 00168 free(p_struct->address); 00169 p_struct->address=NULL; 00170 } 00171 if (p_src->address) { 00172 p_struct->address=strdup(p_src->address); 00173 } 00174 00175 /* member "port" */ 00176 p_struct->port=p_src->port; 00177 00178 /* member "systemId" */ 00179 if (p_struct->systemId) { 00180 free(p_struct->systemId); 00181 p_struct->systemId=NULL; 00182 } 00183 if (p_src->systemId) { 00184 p_struct->systemId=strdup(p_src->systemId); 00185 } 00186 00187 return p_struct; 00188 } 00189 00190 uint32_t GWEN_Crypt_Token_Context_GetId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00191 assert(p_struct); 00192 return p_struct->id; 00193 } 00194 00195 uint32_t GWEN_Crypt_Token_Context_GetSignKeyId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00196 assert(p_struct); 00197 return p_struct->signKeyId; 00198 } 00199 00200 uint32_t GWEN_Crypt_Token_Context_GetVerifyKeyId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00201 assert(p_struct); 00202 return p_struct->verifyKeyId; 00203 } 00204 00205 uint32_t GWEN_Crypt_Token_Context_GetEncipherKeyId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00206 assert(p_struct); 00207 return p_struct->encipherKeyId; 00208 } 00209 00210 uint32_t GWEN_Crypt_Token_Context_GetDecipherKeyId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00211 assert(p_struct); 00212 return p_struct->decipherKeyId; 00213 } 00214 00215 uint32_t GWEN_Crypt_Token_Context_GetAuthSignKeyId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00216 assert(p_struct); 00217 return p_struct->authSignKeyId; 00218 } 00219 00220 uint32_t GWEN_Crypt_Token_Context_GetAuthVerifyKeyId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00221 assert(p_struct); 00222 return p_struct->authVerifyKeyId; 00223 } 00224 00225 uint32_t GWEN_Crypt_Token_Context_GetTempSignKeyId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00226 assert(p_struct); 00227 return p_struct->tempSignKeyId; 00228 } 00229 00230 const char *GWEN_Crypt_Token_Context_GetServiceId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00231 assert(p_struct); 00232 return p_struct->serviceId; 00233 } 00234 00235 const char *GWEN_Crypt_Token_Context_GetUserId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00236 assert(p_struct); 00237 return p_struct->userId; 00238 } 00239 00240 const char *GWEN_Crypt_Token_Context_GetCustomerId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00241 assert(p_struct); 00242 return p_struct->customerId; 00243 } 00244 00245 const char *GWEN_Crypt_Token_Context_GetUserName(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00246 assert(p_struct); 00247 return p_struct->userName; 00248 } 00249 00250 const char *GWEN_Crypt_Token_Context_GetPeerId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00251 assert(p_struct); 00252 return p_struct->peerId; 00253 } 00254 00255 const char *GWEN_Crypt_Token_Context_GetPeerName(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00256 assert(p_struct); 00257 return p_struct->peerName; 00258 } 00259 00260 const char *GWEN_Crypt_Token_Context_GetAddress(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00261 assert(p_struct); 00262 return p_struct->address; 00263 } 00264 00265 int GWEN_Crypt_Token_Context_GetPort(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00266 assert(p_struct); 00267 return p_struct->port; 00268 } 00269 00270 const char *GWEN_Crypt_Token_Context_GetSystemId(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct) { 00271 assert(p_struct); 00272 return p_struct->systemId; 00273 } 00274 00275 void GWEN_Crypt_Token_Context_SetId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, uint32_t p_src) { 00276 assert(p_struct); 00277 p_struct->id=p_src; 00278 } 00279 00280 void GWEN_Crypt_Token_Context_SetSignKeyId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, uint32_t p_src) { 00281 assert(p_struct); 00282 p_struct->signKeyId=p_src; 00283 } 00284 00285 void GWEN_Crypt_Token_Context_SetVerifyKeyId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, uint32_t p_src) { 00286 assert(p_struct); 00287 p_struct->verifyKeyId=p_src; 00288 } 00289 00290 void GWEN_Crypt_Token_Context_SetEncipherKeyId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, uint32_t p_src) { 00291 assert(p_struct); 00292 p_struct->encipherKeyId=p_src; 00293 } 00294 00295 void GWEN_Crypt_Token_Context_SetDecipherKeyId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, uint32_t p_src) { 00296 assert(p_struct); 00297 p_struct->decipherKeyId=p_src; 00298 } 00299 00300 void GWEN_Crypt_Token_Context_SetAuthSignKeyId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, uint32_t p_src) { 00301 assert(p_struct); 00302 p_struct->authSignKeyId=p_src; 00303 } 00304 00305 void GWEN_Crypt_Token_Context_SetAuthVerifyKeyId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, uint32_t p_src) { 00306 assert(p_struct); 00307 p_struct->authVerifyKeyId=p_src; 00308 } 00309 00310 void GWEN_Crypt_Token_Context_SetTempSignKeyId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, uint32_t p_src) { 00311 assert(p_struct); 00312 p_struct->tempSignKeyId=p_src; 00313 } 00314 00315 void GWEN_Crypt_Token_Context_SetServiceId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, const char *p_src) { 00316 assert(p_struct); 00317 if (p_struct->serviceId) { 00318 free(p_struct->serviceId); 00319 } 00320 if (p_src) { 00321 p_struct->serviceId=strdup(p_src); 00322 } 00323 else { 00324 p_struct->serviceId=NULL; 00325 } 00326 } 00327 00328 void GWEN_Crypt_Token_Context_SetUserId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, const char *p_src) { 00329 assert(p_struct); 00330 if (p_struct->userId) { 00331 free(p_struct->userId); 00332 } 00333 if (p_src) { 00334 p_struct->userId=strdup(p_src); 00335 } 00336 else { 00337 p_struct->userId=NULL; 00338 } 00339 } 00340 00341 void GWEN_Crypt_Token_Context_SetCustomerId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, const char *p_src) { 00342 assert(p_struct); 00343 if (p_struct->customerId) { 00344 free(p_struct->customerId); 00345 } 00346 if (p_src) { 00347 p_struct->customerId=strdup(p_src); 00348 } 00349 else { 00350 p_struct->customerId=NULL; 00351 } 00352 } 00353 00354 void GWEN_Crypt_Token_Context_SetUserName(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, const char *p_src) { 00355 assert(p_struct); 00356 if (p_struct->userName) { 00357 free(p_struct->userName); 00358 } 00359 if (p_src) { 00360 p_struct->userName=strdup(p_src); 00361 } 00362 else { 00363 p_struct->userName=NULL; 00364 } 00365 } 00366 00367 void GWEN_Crypt_Token_Context_SetPeerId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, const char *p_src) { 00368 assert(p_struct); 00369 if (p_struct->peerId) { 00370 free(p_struct->peerId); 00371 } 00372 if (p_src) { 00373 p_struct->peerId=strdup(p_src); 00374 } 00375 else { 00376 p_struct->peerId=NULL; 00377 } 00378 } 00379 00380 void GWEN_Crypt_Token_Context_SetPeerName(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, const char *p_src) { 00381 assert(p_struct); 00382 if (p_struct->peerName) { 00383 free(p_struct->peerName); 00384 } 00385 if (p_src) { 00386 p_struct->peerName=strdup(p_src); 00387 } 00388 else { 00389 p_struct->peerName=NULL; 00390 } 00391 } 00392 00393 void GWEN_Crypt_Token_Context_SetAddress(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, const char *p_src) { 00394 assert(p_struct); 00395 if (p_struct->address) { 00396 free(p_struct->address); 00397 } 00398 if (p_src) { 00399 p_struct->address=strdup(p_src); 00400 } 00401 else { 00402 p_struct->address=NULL; 00403 } 00404 } 00405 00406 void GWEN_Crypt_Token_Context_SetPort(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, int p_src) { 00407 assert(p_struct); 00408 p_struct->port=p_src; 00409 } 00410 00411 void GWEN_Crypt_Token_Context_SetSystemId(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, const char *p_src) { 00412 assert(p_struct); 00413 if (p_struct->systemId) { 00414 free(p_struct->systemId); 00415 } 00416 if (p_src) { 00417 p_struct->systemId=strdup(p_src); 00418 } 00419 else { 00420 p_struct->systemId=NULL; 00421 } 00422 } 00423 00424 GWEN_CRYPT_TOKEN_CONTEXT_LIST *GWEN_Crypt_Token_Context_List_dup(const GWEN_CRYPT_TOKEN_CONTEXT_LIST *p_src) { 00425 GWEN_CRYPT_TOKEN_CONTEXT_LIST *p_dest; 00426 GWEN_CRYPT_TOKEN_CONTEXT *p_elem; 00427 00428 assert(p_src); 00429 p_dest=GWEN_Crypt_Token_Context_List_new(); 00430 p_elem=GWEN_Crypt_Token_Context_List_First(p_src); 00431 while(p_elem) { 00432 GWEN_CRYPT_TOKEN_CONTEXT *p_cpy; 00433 00434 p_cpy=GWEN_Crypt_Token_Context_dup(p_elem); 00435 GWEN_Crypt_Token_Context_List_Add(p_cpy, p_dest); 00436 p_elem=GWEN_Crypt_Token_Context_List_Next(p_elem); 00437 } 00438 00439 return p_dest; 00440 } 00441 00442 void GWEN_Crypt_Token_Context_ReadDb(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, GWEN_DB_NODE *p_db) { 00443 assert(p_struct); 00444 /* member "id" */ 00445 p_struct->id=GWEN_DB_GetIntValue(p_db, "id", 0, 0); 00446 00447 /* member "signKeyId" */ 00448 p_struct->signKeyId=GWEN_DB_GetIntValue(p_db, "signKeyId", 0, 0); 00449 00450 /* member "verifyKeyId" */ 00451 p_struct->verifyKeyId=GWEN_DB_GetIntValue(p_db, "verifyKeyId", 0, 0); 00452 00453 /* member "encipherKeyId" */ 00454 p_struct->encipherKeyId=GWEN_DB_GetIntValue(p_db, "encipherKeyId", 0, 0); 00455 00456 /* member "decipherKeyId" */ 00457 p_struct->decipherKeyId=GWEN_DB_GetIntValue(p_db, "decipherKeyId", 0, 0); 00458 00459 /* member "authSignKeyId" */ 00460 p_struct->authSignKeyId=GWEN_DB_GetIntValue(p_db, "authSignKeyId", 0, 0); 00461 00462 /* member "authVerifyKeyId" */ 00463 p_struct->authVerifyKeyId=GWEN_DB_GetIntValue(p_db, "authVerifyKeyId", 0, 0); 00464 00465 /* member "tempSignKeyId" */ 00466 p_struct->tempSignKeyId=GWEN_DB_GetIntValue(p_db, "tempSignKeyId", 0, 0); 00467 00468 /* member "serviceId" */ 00469 if (p_struct->serviceId) { 00470 free(p_struct->serviceId); 00471 } 00472 { const char *s; s=GWEN_DB_GetCharValue(p_db, "serviceId", 0, NULL); if (s) p_struct->serviceId=strdup(s); } 00473 if (p_struct->serviceId==NULL) { p_struct->serviceId=NULL; 00474 } 00475 00476 /* member "userId" */ 00477 if (p_struct->userId) { 00478 free(p_struct->userId); 00479 } 00480 { const char *s; s=GWEN_DB_GetCharValue(p_db, "userId", 0, NULL); if (s) p_struct->userId=strdup(s); } 00481 if (p_struct->userId==NULL) { p_struct->userId=NULL; 00482 } 00483 00484 /* member "customerId" */ 00485 if (p_struct->customerId) { 00486 free(p_struct->customerId); 00487 } 00488 { const char *s; s=GWEN_DB_GetCharValue(p_db, "customerId", 0, NULL); if (s) p_struct->customerId=strdup(s); } 00489 if (p_struct->customerId==NULL) { p_struct->customerId=NULL; 00490 } 00491 00492 /* member "userName" */ 00493 if (p_struct->userName) { 00494 free(p_struct->userName); 00495 } 00496 { const char *s; s=GWEN_DB_GetCharValue(p_db, "userName", 0, NULL); if (s) p_struct->userName=strdup(s); } 00497 if (p_struct->userName==NULL) { p_struct->userName=NULL; 00498 } 00499 00500 /* member "peerId" */ 00501 if (p_struct->peerId) { 00502 free(p_struct->peerId); 00503 } 00504 { const char *s; s=GWEN_DB_GetCharValue(p_db, "peerId", 0, NULL); if (s) p_struct->peerId=strdup(s); } 00505 if (p_struct->peerId==NULL) { p_struct->peerId=NULL; 00506 } 00507 00508 /* member "peerName" */ 00509 if (p_struct->peerName) { 00510 free(p_struct->peerName); 00511 } 00512 { const char *s; s=GWEN_DB_GetCharValue(p_db, "peerName", 0, NULL); if (s) p_struct->peerName=strdup(s); } 00513 if (p_struct->peerName==NULL) { p_struct->peerName=NULL; 00514 } 00515 00516 /* member "address" */ 00517 if (p_struct->address) { 00518 free(p_struct->address); 00519 } 00520 { const char *s; s=GWEN_DB_GetCharValue(p_db, "address", 0, NULL); if (s) p_struct->address=strdup(s); } 00521 if (p_struct->address==NULL) { p_struct->address=NULL; 00522 } 00523 00524 /* member "port" */ 00525 p_struct->port=GWEN_DB_GetIntValue(p_db, "port", 0, 0); 00526 00527 /* member "systemId" */ 00528 if (p_struct->systemId) { 00529 free(p_struct->systemId); 00530 } 00531 { const char *s; s=GWEN_DB_GetCharValue(p_db, "systemId", 0, NULL); if (s) p_struct->systemId=strdup(s); } 00532 if (p_struct->systemId==NULL) { p_struct->systemId=NULL; 00533 } 00534 00535 } 00536 00537 int GWEN_Crypt_Token_Context_WriteDb(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct, GWEN_DB_NODE *p_db) { 00538 int p_rv; 00539 00540 assert(p_struct); 00541 /* member "id" */ 00542 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "id", p_struct->id); 00543 if (p_rv<0) { 00544 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00545 return p_rv; 00546 } 00547 00548 /* member "signKeyId" */ 00549 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "signKeyId", p_struct->signKeyId); 00550 if (p_rv<0) { 00551 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00552 return p_rv; 00553 } 00554 00555 /* member "verifyKeyId" */ 00556 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "verifyKeyId", p_struct->verifyKeyId); 00557 if (p_rv<0) { 00558 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00559 return p_rv; 00560 } 00561 00562 /* member "encipherKeyId" */ 00563 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "encipherKeyId", p_struct->encipherKeyId); 00564 if (p_rv<0) { 00565 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00566 return p_rv; 00567 } 00568 00569 /* member "decipherKeyId" */ 00570 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "decipherKeyId", p_struct->decipherKeyId); 00571 if (p_rv<0) { 00572 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00573 return p_rv; 00574 } 00575 00576 /* member "authSignKeyId" */ 00577 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "authSignKeyId", p_struct->authSignKeyId); 00578 if (p_rv<0) { 00579 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00580 return p_rv; 00581 } 00582 00583 /* member "authVerifyKeyId" */ 00584 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "authVerifyKeyId", p_struct->authVerifyKeyId); 00585 if (p_rv<0) { 00586 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00587 return p_rv; 00588 } 00589 00590 /* member "tempSignKeyId" */ 00591 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "tempSignKeyId", p_struct->tempSignKeyId); 00592 if (p_rv<0) { 00593 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00594 return p_rv; 00595 } 00596 00597 /* member "serviceId" */ 00598 if (p_struct->serviceId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "serviceId", p_struct->serviceId); else { GWEN_DB_DeleteVar(p_db, "serviceId"); p_rv=0; } 00599 if (p_rv<0) { 00600 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00601 return p_rv; 00602 } 00603 00604 /* member "userId" */ 00605 if (p_struct->userId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "userId", p_struct->userId); else { GWEN_DB_DeleteVar(p_db, "userId"); p_rv=0; } 00606 if (p_rv<0) { 00607 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00608 return p_rv; 00609 } 00610 00611 /* member "customerId" */ 00612 if (p_struct->customerId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "customerId", p_struct->customerId); else { GWEN_DB_DeleteVar(p_db, "customerId"); p_rv=0; } 00613 if (p_rv<0) { 00614 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00615 return p_rv; 00616 } 00617 00618 /* member "userName" */ 00619 if (p_struct->userName) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "userName", p_struct->userName); else { GWEN_DB_DeleteVar(p_db, "userName"); p_rv=0; } 00620 if (p_rv<0) { 00621 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00622 return p_rv; 00623 } 00624 00625 /* member "peerId" */ 00626 if (p_struct->peerId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "peerId", p_struct->peerId); else { GWEN_DB_DeleteVar(p_db, "peerId"); p_rv=0; } 00627 if (p_rv<0) { 00628 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00629 return p_rv; 00630 } 00631 00632 /* member "peerName" */ 00633 if (p_struct->peerName) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "peerName", p_struct->peerName); else { GWEN_DB_DeleteVar(p_db, "peerName"); p_rv=0; } 00634 if (p_rv<0) { 00635 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00636 return p_rv; 00637 } 00638 00639 /* member "address" */ 00640 if (p_struct->address) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "address", p_struct->address); else { GWEN_DB_DeleteVar(p_db, "address"); p_rv=0; } 00641 if (p_rv<0) { 00642 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00643 return p_rv; 00644 } 00645 00646 /* member "port" */ 00647 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "port", p_struct->port); 00648 if (p_rv<0) { 00649 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00650 return p_rv; 00651 } 00652 00653 /* member "systemId" */ 00654 if (p_struct->systemId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "systemId", p_struct->systemId); else { GWEN_DB_DeleteVar(p_db, "systemId"); p_rv=0; } 00655 if (p_rv<0) { 00656 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv); 00657 return p_rv; 00658 } 00659 00660 return 0; 00661 } 00662 00663 GWEN_CRYPT_TOKEN_CONTEXT *GWEN_Crypt_Token_Context_fromDb(GWEN_DB_NODE *p_db) { 00664 GWEN_CRYPT_TOKEN_CONTEXT *p_struct; 00665 p_struct=GWEN_Crypt_Token_Context_new(); 00666 GWEN_Crypt_Token_Context_ReadDb(p_struct, p_db); 00667 return p_struct; 00668 } 00669 00670 int GWEN_Crypt_Token_Context_toDb(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct, GWEN_DB_NODE *p_db) { 00671 return GWEN_Crypt_Token_Context_WriteDb(p_struct, p_db); 00672 } 00673 00674 void GWEN_Crypt_Token_Context_ReadXml(GWEN_CRYPT_TOKEN_CONTEXT *p_struct, GWEN_XMLNODE *p_db) { 00675 assert(p_struct); 00676 /* member "id" */ 00677 p_struct->id=GWEN_XMLNode_GetIntValue(p_db, "id", 0); 00678 00679 /* member "signKeyId" */ 00680 p_struct->signKeyId=GWEN_XMLNode_GetIntValue(p_db, "signKeyId", 0); 00681 00682 /* member "verifyKeyId" */ 00683 p_struct->verifyKeyId=GWEN_XMLNode_GetIntValue(p_db, "verifyKeyId", 0); 00684 00685 /* member "encipherKeyId" */ 00686 p_struct->encipherKeyId=GWEN_XMLNode_GetIntValue(p_db, "encipherKeyId", 0); 00687 00688 /* member "decipherKeyId" */ 00689 p_struct->decipherKeyId=GWEN_XMLNode_GetIntValue(p_db, "decipherKeyId", 0); 00690 00691 /* member "authSignKeyId" */ 00692 p_struct->authSignKeyId=GWEN_XMLNode_GetIntValue(p_db, "authSignKeyId", 0); 00693 00694 /* member "authVerifyKeyId" */ 00695 p_struct->authVerifyKeyId=GWEN_XMLNode_GetIntValue(p_db, "authVerifyKeyId", 0); 00696 00697 /* member "tempSignKeyId" */ 00698 p_struct->tempSignKeyId=GWEN_XMLNode_GetIntValue(p_db, "tempSignKeyId", 0); 00699 00700 /* member "serviceId" */ 00701 if (p_struct->serviceId) { 00702 free(p_struct->serviceId); 00703 } 00704 { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "serviceId", NULL); if (s) p_struct->serviceId=strdup(s); } 00705 if (p_struct->serviceId==NULL) { /* member "serviceId" is volatile, just presetting */ 00706 p_struct->serviceId=NULL; 00707 } 00708 00709 /* member "userId" */ 00710 if (p_struct->userId) { 00711 free(p_struct->userId); 00712 } 00713 { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "userId", NULL); if (s) p_struct->userId=strdup(s); } 00714 if (p_struct->userId==NULL) { /* member "userId" is volatile, just presetting */ 00715 p_struct->userId=NULL; 00716 } 00717 00718 /* member "customerId" */ 00719 if (p_struct->customerId) { 00720 free(p_struct->customerId); 00721 } 00722 { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "customerId", NULL); if (s) p_struct->customerId=strdup(s); } 00723 if (p_struct->customerId==NULL) { /* member "customerId" is volatile, just presetting */ 00724 p_struct->customerId=NULL; 00725 } 00726 00727 /* member "userName" */ 00728 if (p_struct->userName) { 00729 free(p_struct->userName); 00730 } 00731 { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "userName", NULL); if (s) p_struct->userName=strdup(s); } 00732 if (p_struct->userName==NULL) { /* member "userName" is volatile, just presetting */ 00733 p_struct->userName=NULL; 00734 } 00735 00736 /* member "peerId" */ 00737 if (p_struct->peerId) { 00738 free(p_struct->peerId); 00739 } 00740 { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "peerId", NULL); if (s) p_struct->peerId=strdup(s); } 00741 if (p_struct->peerId==NULL) { /* member "peerId" is volatile, just presetting */ 00742 p_struct->peerId=NULL; 00743 } 00744 00745 /* member "peerName" */ 00746 if (p_struct->peerName) { 00747 free(p_struct->peerName); 00748 } 00749 { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "peerName", NULL); if (s) p_struct->peerName=strdup(s); } 00750 if (p_struct->peerName==NULL) { /* member "peerName" is volatile, just presetting */ 00751 p_struct->peerName=NULL; 00752 } 00753 00754 /* member "address" */ 00755 if (p_struct->address) { 00756 free(p_struct->address); 00757 } 00758 { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "address", NULL); if (s) p_struct->address=strdup(s); } 00759 if (p_struct->address==NULL) { /* member "address" is volatile, just presetting */ 00760 p_struct->address=NULL; 00761 } 00762 00763 /* member "port" */ 00764 p_struct->port=GWEN_XMLNode_GetIntValue(p_db, "port", 0); 00765 00766 /* member "systemId" */ 00767 if (p_struct->systemId) { 00768 free(p_struct->systemId); 00769 } 00770 { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "systemId", NULL); if (s) p_struct->systemId=strdup(s); } 00771 if (p_struct->systemId==NULL) { /* member "systemId" is volatile, just presetting */ 00772 p_struct->systemId=NULL; 00773 } 00774 00775 } 00776 00777 void GWEN_Crypt_Token_Context_WriteXml(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct, GWEN_XMLNODE *p_db) { 00778 assert(p_struct); 00779 /* member "id" */ 00780 GWEN_XMLNode_SetIntValue(p_db, "id", p_struct->id); 00781 00782 /* member "signKeyId" */ 00783 GWEN_XMLNode_SetIntValue(p_db, "signKeyId", p_struct->signKeyId); 00784 00785 /* member "verifyKeyId" */ 00786 GWEN_XMLNode_SetIntValue(p_db, "verifyKeyId", p_struct->verifyKeyId); 00787 00788 /* member "encipherKeyId" */ 00789 GWEN_XMLNode_SetIntValue(p_db, "encipherKeyId", p_struct->encipherKeyId); 00790 00791 /* member "decipherKeyId" */ 00792 GWEN_XMLNode_SetIntValue(p_db, "decipherKeyId", p_struct->decipherKeyId); 00793 00794 /* member "authSignKeyId" */ 00795 GWEN_XMLNode_SetIntValue(p_db, "authSignKeyId", p_struct->authSignKeyId); 00796 00797 /* member "authVerifyKeyId" */ 00798 GWEN_XMLNode_SetIntValue(p_db, "authVerifyKeyId", p_struct->authVerifyKeyId); 00799 00800 /* member "tempSignKeyId" */ 00801 GWEN_XMLNode_SetIntValue(p_db, "tempSignKeyId", p_struct->tempSignKeyId); 00802 00803 /* member "serviceId" */ 00804 GWEN_XMLNode_SetCharValue(p_db, "serviceId", p_struct->serviceId); 00805 00806 /* member "userId" */ 00807 GWEN_XMLNode_SetCharValue(p_db, "userId", p_struct->userId); 00808 00809 /* member "customerId" */ 00810 GWEN_XMLNode_SetCharValue(p_db, "customerId", p_struct->customerId); 00811 00812 /* member "userName" */ 00813 GWEN_XMLNode_SetCharValue(p_db, "userName", p_struct->userName); 00814 00815 /* member "peerId" */ 00816 GWEN_XMLNode_SetCharValue(p_db, "peerId", p_struct->peerId); 00817 00818 /* member "peerName" */ 00819 GWEN_XMLNode_SetCharValue(p_db, "peerName", p_struct->peerName); 00820 00821 /* member "address" */ 00822 GWEN_XMLNode_SetCharValue(p_db, "address", p_struct->address); 00823 00824 /* member "port" */ 00825 GWEN_XMLNode_SetIntValue(p_db, "port", p_struct->port); 00826 00827 /* member "systemId" */ 00828 GWEN_XMLNode_SetCharValue(p_db, "systemId", p_struct->systemId); 00829 00830 } 00831 00832 void GWEN_Crypt_Token_Context_toXml(const GWEN_CRYPT_TOKEN_CONTEXT *p_struct, GWEN_XMLNODE *p_db) { 00833 GWEN_Crypt_Token_Context_WriteXml(p_struct, p_db); 00834 } 00835 00836 GWEN_CRYPT_TOKEN_CONTEXT *GWEN_Crypt_Token_Context_fromXml(GWEN_XMLNODE *p_db) { 00837 GWEN_CRYPT_TOKEN_CONTEXT *p_struct; 00838 p_struct=GWEN_Crypt_Token_Context_new(); 00839 GWEN_Crypt_Token_Context_ReadXml(p_struct, p_db); 00840 return p_struct; 00841 } 00842 00843 GWEN_CRYPT_TOKEN_CONTEXT *GWEN_Crypt_Token_Context_List_GetById(const GWEN_CRYPT_TOKEN_CONTEXT_LIST *p_list, uint32_t p_cmp) { 00844 GWEN_CRYPT_TOKEN_CONTEXT *p_struct; 00845 00846 assert(p_list); 00847 p_struct = GWEN_Crypt_Token_Context_List_First(p_list); 00848 while(p_struct) { 00849 int p_rv; 00850 00851 if (p_struct->id==p_cmp) p_rv=0; else if (p_cmp<p_struct->id) p_rv=-1; else p_rv=1; 00852 if (p_rv == 0) 00853 return p_struct; 00854 p_struct = GWEN_Crypt_Token_Context_List_Next(p_struct); 00855 } 00856 return NULL; 00857 } 00858 00859 00860 /* code headers */ 00861