Mixe for Privacy and Anonymity in the Internet
TermsAndConditions.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) The JAP-Team, JonDos GmbH
3 
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright notice,
10  this list of conditions and the following disclaimer in the documentation and/or
11  other materials provided with the distribution.
12  * Neither the name of the University of Technology Dresden, Germany, nor the name of
13  the JonDos GmbH, nor the names of their contributors may be used to endorse or
14  promote products derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
20 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #ifndef TERMSANDCONDITIONS_HPP_
30 #define TERMSANDCONDITIONS_HPP_
31 
32 #define RESIZE_STORE 3
33 
34 #include "StdAfx.h"
35 #include "CAMutex.hpp"
36 
38 {
40 };
41 
42 typedef struct
43 {
45  XERCES_CPP_NAMESPACE::DOMDocument* xmlAnswer;
47 
49 
50 typedef struct
51 {
52  UINT8 *tnc_id; /* The id of the Terms & Conditions is the operator ski. */
53  UINT8 *tnc_locale; /* language code of the T&C translation. */
54  /*UINT8 *tnc_date; the date when the terms andCondtions became valid */
55  DOMNode *tnc_customized; /* the operator specific Terms & Conditions definitions */
56  DOMNode *tnc_template; /* the template needed to render the whole Terms and Conditions translation */
58 
60 
62 {
63 
64 private:
65  /* The id of the Terms & Conditions is the operator ski. */
67  /* the overall number of translations (capacity) */
69  /* array index pointing to where the last translation was stored */
71  /* array containing pointers to the Terms & Conditions translations */
73  /* needed to import the customized sections XML elements. ensures that these
74  * are not released accidently by former owner documents.
75  */
76  XERCES_CPP_NAMESPACE::DOMDocument *customizedSectionsOwner;
77 
78 public:
79 
80  /* all caller threads must lock for the whole time they are working with a translation entry.
81  * the class methods returning entry refernces are not thread-safe.
82  */
84 
85 public:
86 
91  TermsAndConditions(UINT8* id, UINT32 nrOfTranslations);
92  virtual ~TermsAndConditions();
93 
100 
105  const DOMNode *getTranslationTemplate(const UINT8 *locale);
106 
111  const DOMNode *getTranslationCustomizedSections(const UINT8 *locale);
112 
117  void removeTranslation(const UINT8 *locale);
118 
123  void addTranslation(const UINT8 *locale, DOMNode *tnc_customized, DOMNode *tnc_template);
124 
125  /*
126  * returns a POINTER, NOT A COPY of the ID of these T&Cs (the operator subject key identifier).
127  */
128  const UINT8 *getID();
129 
130 private:
131 
133 };
134 
135 #endif /* TERMSANDCONDITIONS_HPP_ */
void cleanupTnCTranslation(termsAndConditionsTranslation_t *tnCTranslation)
void cleanupTnCMixAnswer(termsAndConditionMixAnswer_t *answer)
IMPORTANT NOTE: all methods does NOT incorporate locking over the translation store and thus are NOT ...
tcAnswerCode_t
@ TC_FAILED
@ TC_UNFINISHED
@ TC_CONFIRMED
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
const DOMNode * getTranslationCustomizedSections(const UINT8 *locale)
returns only the customized sections of the translation specified by the language code or NULL if no ...
void removeTranslation(const UINT8 *locale)
removes the specific Terms & Conditions translation for the the language with the specified language ...
TermsAndConditions(UINT8 *id, UINT32 nrOfTranslations)
Constructor with the id (Operator SKI), the number of translations and those elements to be imported ...
const termsAndConditionsTranslation_t * getTranslation(const UINT8 *locale)
returns the specific TermsAndconditions translation for the the language with the specified language ...
XERCES_CPP_NAMESPACE::DOMDocument * customizedSectionsOwner
const DOMNode * getTranslationTemplate(const UINT8 *locale)
returns only the template of the translation specified by the language code or NULL if no such transl...
termsAndConditionsTranslation_t ** allTranslations
void addTranslation(const UINT8 *locale, DOMNode *tnc_customized, DOMNode *tnc_template)
add a language specific terms and Conditions document, which can be retrieved by *getTermsAndConditio...
XERCES_CPP_NAMESPACE::DOMDocument * xmlAnswer