PKIFTSPMemoryHelper.cpp

Go to the documentation of this file.
00001 
00009 #include "private/PKIFTSPMemoryHelper.h"
00010 #include "PKIFTSP.h"
00011 #include "PKIXTSP.h"
00012 #include "ToolkitUtils.h"
00013 #include "components.h"
00014 
00015 //*****************************************************************
00016 //  Memory helper
00017 //*****************************************************************
00018 
00019 //declare these as non-member functions instead of private functions
00020 //no need to make them visible beyond this file
00028 void FreeRequestMembers(PKIFTSPTimeStampReq* pRequest)
00029 {
00030     LOG_STRING_DEBUG("FreeRequestMembers", TOOLKIT_TSP_ASN, 0, NULL);
00031 
00032     if(!pRequest)
00033         return;
00034 
00035     //currently nothing is allocated inside PKIFTSPTimeStampReq
00036 }
00044 void FreeResponseMembers(PKIFTSPTimeStampResp* pResponse)
00045 {
00046     LOG_STRING_DEBUG("FreeResponseMembers", TOOLKIT_TSP_ASN, 0, NULL);
00047 
00048     if(!pResponse)
00049         return;
00050 
00051     DListNode* cur = NULL, *tmp = NULL;
00052     if(pResponse->status.m.statusStringPresent)
00053     {
00054         cur = pResponse->status.statusString.head;
00055         while(NULL != cur)
00056         {
00057             tmp = cur->next;
00058             delete cur;
00059             cur = tmp;
00060         }
00061     }
00062 }
00070 void FreeTSTInfoMembers(PKIFTSPTSTInfo* pTSTInfo)
00071 {
00072     LOG_STRING_DEBUG("FreeTSTInfoMembers", TOOLKIT_TSP_ASN, 0, NULL);
00073 
00074     if(!pTSTInfo)
00075         return;
00076 
00077     //currently nothing is allocated inside PKIFTSPTSTInfo
00078 }
00088 PKIFTSPMemoryHelper::PKIFTSPMemoryHelper()
00089 {
00090     LOG_STRING_DEBUG("PKIFTSPMemoryHelper::PKIFTSPMemoryHelper()", TOOLKIT_TSP_ASN, 0, this);
00091 
00092     pRequest = NULL;
00093     pResponse = NULL;
00094     pTSTInfo = NULL;
00095 }
00103 PKIFTSPMemoryHelper::~PKIFTSPMemoryHelper()
00104 {
00105     LOG_STRING_DEBUG("PKIFTSPMemoryHelper::~PKIFTSPMemoryHelper()", TOOLKIT_TSP_ASN, 0, this);
00106 
00107     if(NULL != pRequest)
00108     {
00109         FreeRequestMembers(pRequest);
00110         delete pRequest;
00111     }
00112 
00113     if(NULL != pResponse)
00114     {
00115         FreeResponseMembers(pResponse);
00116         delete pResponse;
00117     }
00118 
00119     if(NULL != pTSTInfo)
00120     {
00121         FreeTSTInfoMembers(pTSTInfo);
00122         delete pTSTInfo;
00123     }
00124 }

Generated on Mon Nov 15 11:15:55 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6