|
Mixe for Privacy and Anonymity in the Internet
|
00001 /* 00002 Copyright (c) The JAP-Team, JonDos GmbH 00003 00004 All rights reserved. 00005 00006 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 00007 00008 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright notice, 00010 this list of conditions and the following disclaimer in the documentation and/or 00011 other materials provided with the distribution. 00012 * Neither the name of the University of Technology Dresden, Germany, nor the name of 00013 the JonDos GmbH, nor the names of their contributors may be used to endorse or 00014 promote products derived from this software without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00017 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00018 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00019 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 00020 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00021 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00022 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00023 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00026 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00029 #ifndef TERMSANDCONDITIONS_HPP_ 00030 #define TERMSANDCONDITIONS_HPP_ 00031 00032 #define RESIZE_STORE 3 00033 00034 #include "StdAfx.h" 00035 #include "CAMutex.hpp" 00036 00037 enum tcAnswerCode_t 00038 { 00039 TC_FAILED = -1, TC_CONFIRMED = 0, TC_UNFINISHED = 1 00040 }; 00041 00042 typedef struct 00043 { 00044 tcAnswerCode_t result; 00045 XERCES_CPP_NAMESPACE::DOMDocument* xmlAnswer; 00046 } termsAndConditionMixAnswer_t; 00047 00048 void cleanupTnCMixAnswer(termsAndConditionMixAnswer_t *answer); 00049 00050 typedef struct 00051 { 00052 UINT8 *tnc_id; /* The id of the Terms & Conditions is the operator ski. */ 00053 UINT8 *tnc_locale; /* language code of the T&C translation. */ 00054 /*UINT8 *tnc_date; the date when the terms andCondtions became valid */ 00055 DOMNode *tnc_customized; /* the operator specific Terms & Conditions definitions */ 00056 DOMNode *tnc_template; /* the template needed to render the whole Terms and Conditions translation */ 00057 } termsAndConditionsTranslation_t; 00058 00059 void cleanupTnCTranslation(termsAndConditionsTranslation_t *tnCTranslation); 00060 00061 class TermsAndConditions 00062 { 00063 00064 private: 00065 /* The id of the Terms & Conditions is the operator ski. */ 00066 UINT8 *tnc_id; 00067 /* the overall number of translations (capacity) */ 00068 UINT32 translations; 00069 /* array index pointing to where the last translation was stored */ 00070 UINT32 currentTranslationIndex; 00071 /* array containing pointers to the Terms & Conditions translations */ 00072 termsAndConditionsTranslation_t **allTranslations; 00073 /* needed to import the customized sections XML elements. ensures that these 00074 * are not released accidently by former owner documents. 00075 */ 00076 XERCES_CPP_NAMESPACE::DOMDocument *customizedSectionsOwner; 00077 00078 public: 00079 00080 /* all caller threads must lock for the whole time they are working with a translation entry. 00081 * the class methods returning entry refernces are not thread-safe. 00082 */ 00083 CAMutex *synchLock; 00084 00085 public: 00086 00091 TermsAndConditions(UINT8* id, UINT32 nrOfTranslations); 00092 virtual ~TermsAndConditions(); 00093 00099 const termsAndConditionsTranslation_t *getTranslation(const UINT8 *locale); 00100 00105 const DOMNode *getTranslationTemplate(const UINT8 *locale); 00106 00111 const DOMNode *getTranslationCustomizedSections(const UINT8 *locale); 00112 00117 void removeTranslation(const UINT8 *locale); 00118 00123 void addTranslation(const UINT8 *locale, DOMNode *tnc_customized, DOMNode *tnc_template); 00124 00125 /* 00126 * returns a POINTER, NOT A COPY of the ID of these T&Cs (the operator subject key identifier). 00127 */ 00128 const UINT8 *getID(); 00129 00130 private: 00131 00132 void setIndexToNextEmptySlot(); 00133 }; 00134 00135 #endif /* TERMSANDCONDITIONS_HPP_ */
1.7.6.1