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