12 #include "ct_context_p.h"
14 #include <gwenhywfar/misc.h>
15 #include <gwenhywfar/debug.h>
26 GWEN_CRYPT_TOKEN_CONTEXT *p_struct;
29 p_struct->_refCount=1;
34 p_struct->signKeyId=0;
35 p_struct->verifyKeyId=0;
36 p_struct->encipherKeyId=0;
37 p_struct->decipherKeyId=0;
38 p_struct->authSignKeyId=0;
39 p_struct->authVerifyKeyId=0;
40 p_struct->tempSignKeyId=0;
41 p_struct->serviceId=
NULL;
42 p_struct->userId=
NULL;
43 p_struct->customerId=
NULL;
44 p_struct->userName=
NULL;
45 p_struct->peerId=
NULL;
46 p_struct->peerName=
NULL;
47 p_struct->address=
NULL;
49 p_struct->systemId=
NULL;
56 assert(p_struct->_refCount);
57 if (p_struct->_refCount==1) {
61 free(p_struct->serviceId);
62 free(p_struct->userId);
63 free(p_struct->customerId);
64 free(p_struct->userName);
65 free(p_struct->peerId);
66 free(p_struct->peerName);
67 free(p_struct->address);
68 free(p_struct->systemId);
69 p_struct->_refCount=0;
73 p_struct->_refCount--;
79 assert(p_struct->_refCount);
80 p_struct->_refCount++;
89 p_struct->id=p_src->id;
92 p_struct->signKeyId=p_src->signKeyId;
95 p_struct->verifyKeyId=p_src->verifyKeyId;
98 p_struct->encipherKeyId=p_src->encipherKeyId;
101 p_struct->decipherKeyId=p_src->decipherKeyId;
104 p_struct->authSignKeyId=p_src->authSignKeyId;
107 p_struct->authVerifyKeyId=p_src->authVerifyKeyId;
110 p_struct->tempSignKeyId=p_src->tempSignKeyId;
113 if (p_struct->serviceId) {
114 free(p_struct->serviceId);
115 p_struct->serviceId=
NULL;
117 if (p_src->serviceId) {
118 p_struct->serviceId=strdup(p_src->serviceId);
122 if (p_struct->userId) {
123 free(p_struct->userId);
124 p_struct->userId=
NULL;
127 p_struct->userId=strdup(p_src->userId);
131 if (p_struct->customerId) {
132 free(p_struct->customerId);
133 p_struct->customerId=
NULL;
135 if (p_src->customerId) {
136 p_struct->customerId=strdup(p_src->customerId);
140 if (p_struct->userName) {
141 free(p_struct->userName);
142 p_struct->userName=
NULL;
144 if (p_src->userName) {
145 p_struct->userName=strdup(p_src->userName);
149 if (p_struct->peerId) {
150 free(p_struct->peerId);
151 p_struct->peerId=
NULL;
154 p_struct->peerId=strdup(p_src->peerId);
158 if (p_struct->peerName) {
159 free(p_struct->peerName);
160 p_struct->peerName=
NULL;
162 if (p_src->peerName) {
163 p_struct->peerName=strdup(p_src->peerName);
167 if (p_struct->address) {
168 free(p_struct->address);
169 p_struct->address=
NULL;
171 if (p_src->address) {
172 p_struct->address=strdup(p_src->address);
176 p_struct->port=p_src->port;
179 if (p_struct->systemId) {
180 free(p_struct->systemId);
181 p_struct->systemId=
NULL;
183 if (p_src->systemId) {
184 p_struct->systemId=strdup(p_src->systemId);
197 return p_struct->signKeyId;
202 return p_struct->verifyKeyId;
207 return p_struct->encipherKeyId;
212 return p_struct->decipherKeyId;
217 return p_struct->authSignKeyId;
222 return p_struct->authVerifyKeyId;
227 return p_struct->tempSignKeyId;
232 return p_struct->serviceId;
237 return p_struct->userId;
242 return p_struct->customerId;
247 return p_struct->userName;
252 return p_struct->peerId;
257 return p_struct->peerName;
262 return p_struct->address;
267 return p_struct->port;
272 return p_struct->systemId;
282 p_struct->signKeyId=p_src;
287 p_struct->verifyKeyId=p_src;
292 p_struct->encipherKeyId=p_src;
297 p_struct->decipherKeyId=p_src;
302 p_struct->authSignKeyId=p_src;
307 p_struct->authVerifyKeyId=p_src;
312 p_struct->tempSignKeyId=p_src;
317 if (p_struct->serviceId) {
318 free(p_struct->serviceId);
321 p_struct->serviceId=strdup(p_src);
324 p_struct->serviceId=
NULL;
330 if (p_struct->userId) {
331 free(p_struct->userId);
334 p_struct->userId=strdup(p_src);
337 p_struct->userId=
NULL;
343 if (p_struct->customerId) {
344 free(p_struct->customerId);
347 p_struct->customerId=strdup(p_src);
350 p_struct->customerId=
NULL;
356 if (p_struct->userName) {
357 free(p_struct->userName);
360 p_struct->userName=strdup(p_src);
363 p_struct->userName=
NULL;
369 if (p_struct->peerId) {
370 free(p_struct->peerId);
373 p_struct->peerId=strdup(p_src);
376 p_struct->peerId=
NULL;
382 if (p_struct->peerName) {
383 free(p_struct->peerName);
386 p_struct->peerName=strdup(p_src);
389 p_struct->peerName=
NULL;
395 if (p_struct->address) {
396 free(p_struct->address);
399 p_struct->address=strdup(p_src);
402 p_struct->address=
NULL;
408 p_struct->port=p_src;
413 if (p_struct->systemId) {
414 free(p_struct->systemId);
417 p_struct->systemId=strdup(p_src);
420 p_struct->systemId=
NULL;
425 GWEN_CRYPT_TOKEN_CONTEXT_LIST *p_dest;
429 p_dest=GWEN_Crypt_Token_Context_List_new();
430 p_elem=GWEN_Crypt_Token_Context_List_First(p_src);
435 GWEN_Crypt_Token_Context_List_Add(p_cpy, p_dest);
436 p_elem=GWEN_Crypt_Token_Context_List_Next(p_elem);
469 if (p_struct->serviceId) {
470 free(p_struct->serviceId);
473 if (p_struct->serviceId==
NULL) { p_struct->serviceId=
NULL;
477 if (p_struct->userId) {
478 free(p_struct->userId);
481 if (p_struct->userId==
NULL) { p_struct->userId=
NULL;
485 if (p_struct->customerId) {
486 free(p_struct->customerId);
489 if (p_struct->customerId==
NULL) { p_struct->customerId=
NULL;
493 if (p_struct->userName) {
494 free(p_struct->userName);
497 if (p_struct->userName==
NULL) { p_struct->userName=
NULL;
501 if (p_struct->peerId) {
502 free(p_struct->peerId);
505 if (p_struct->peerId==
NULL) { p_struct->peerId=
NULL;
509 if (p_struct->peerName) {
510 free(p_struct->peerName);
513 if (p_struct->peerName==
NULL) { p_struct->peerName=
NULL;
517 if (p_struct->address) {
518 free(p_struct->address);
521 if (p_struct->address==
NULL) { p_struct->address=
NULL;
528 if (p_struct->systemId) {
529 free(p_struct->systemId);
532 if (p_struct->systemId==
NULL) { p_struct->systemId=
NULL;
701 if (p_struct->serviceId) {
702 free(p_struct->serviceId);
705 if (p_struct->serviceId==
NULL) {
706 p_struct->serviceId=
NULL;
710 if (p_struct->userId) {
711 free(p_struct->userId);
714 if (p_struct->userId==
NULL) {
715 p_struct->userId=
NULL;
719 if (p_struct->customerId) {
720 free(p_struct->customerId);
723 if (p_struct->customerId==
NULL) {
724 p_struct->customerId=
NULL;
728 if (p_struct->userName) {
729 free(p_struct->userName);
732 if (p_struct->userName==
NULL) {
733 p_struct->userName=
NULL;
737 if (p_struct->peerId) {
738 free(p_struct->peerId);
741 if (p_struct->peerId==
NULL) {
742 p_struct->peerId=
NULL;
746 if (p_struct->peerName) {
747 free(p_struct->peerName);
750 if (p_struct->peerName==
NULL) {
751 p_struct->peerName=
NULL;
755 if (p_struct->address) {
756 free(p_struct->address);
759 if (p_struct->address==
NULL) {
760 p_struct->address=
NULL;
767 if (p_struct->systemId) {
768 free(p_struct->systemId);
771 if (p_struct->systemId==
NULL) {
772 p_struct->systemId=
NULL;
847 p_struct = GWEN_Crypt_Token_Context_List_First(p_list);
851 if (p_struct->id==p_cmp) p_rv=0;
else if (p_cmp<p_struct->
id) p_rv=-1;
else p_rv=1;
854 p_struct = GWEN_Crypt_Token_Context_List_Next(p_struct);