Open-Transactions  0.93.0-ge03d287
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
opentxs::OTServerContract Class Reference

#include <OTServerContract.hpp>

Inheritance diagram for opentxs::OTServerContract:
Collaboration diagram for opentxs::OTServerContract:

Public Member Functions

EXPORT OTServerContract ()
 
EXPORT OTServerContract (OTString &name, OTString &foldername, OTString &filename, OTString &strID)
 
virtual EXPORT ~OTServerContract ()
 
EXPORT bool GetConnectInfo (OTString &strHostname, int32_t &nPort) const
 
virtual EXPORT void CreateContents ()
 
virtual bool SaveContractWallet (OTString &strContents) const
 
virtual bool SaveContractWallet (std::ofstream &ofs) const
 
virtual bool DisplayStatistics (OTString &strContents) const
 
- Public Member Functions inherited from opentxs::OTContract
const char * GetHashType () const
 
void SetIdentifier (const OTIdentifier &theID)
 
EXPORT OTContract ()
 
EXPORT OTContract (const OTString &name, const OTString &foldername, const OTString &filename, const OTString &strID)
 
EXPORT OTContract (const OTString &strID)
 
EXPORT OTContract (const OTIdentifier &theID)
 
void Initialize ()
 
virtual EXPORT ~OTContract ()
 
virtual EXPORT void Release ()
 
EXPORT void Release_Contract ()
 
EXPORT void ReleaseSignatures ()
 
virtual EXPORT bool CreateContract (const OTString &strContract, const OTPseudonym &theSigner)
 
EXPORT bool InsertNym (const OTString &strKeyName, const OTString &strKeyValue)
 
EXPORT void GetName (OTString &strName) const
 
EXPORT void SetName (const OTString &strName)
 
virtual EXPORT bool VerifyContract ()
 
virtual EXPORT void GetIdentifier (OTIdentifier &theIdentifier) const
 
virtual EXPORT void GetIdentifier (OTString &theIdentifier) const
 
EXPORT void GetFilename (OTString &strFilename) const
 
EXPORT void GetFoldername (OTString &strFoldername) const
 
virtual EXPORT bool LoadContract ()
 
EXPORT bool LoadContract (const char *szFoldername, const char *szFilename)
 
EXPORT bool LoadContractFromString (const OTString &theStr)
 
bool LoadContractRawFile ()
 
EXPORT bool ParseRawFile ()
 
EXPORT bool SaveToContractFolder ()
 
EXPORT bool SaveContractRaw (OTString &strOutput) const
 
EXPORT bool RewriteContract (OTString &strOutput) const
 
EXPORT bool SaveContract ()
 
EXPORT bool SaveContract (const char *szFoldername, const char *szFilename)
 
virtual EXPORT void UpdateContents ()
 
EXPORT void CreateInnerContents ()
 
virtual EXPORT bool SaveContents (std::ofstream &ofs) const
 
virtual EXPORT bool SaveContents (OTString &strContents) const
 
virtual EXPORT bool SignContract (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContractAuthent (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignWithKey (const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const OTPseudonym &theNym, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContractAuthent (const OTPseudonym &theNym, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const OTAsymmetricKey &theKey, OTSignature &theSignature, const OTString &strHashType, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const char *szFoldername, const char *szFilename, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
virtual EXPORT bool VerifyContractID () const
 
virtual EXPORT void CalculateContractID (OTIdentifier &newID) const
 
virtual EXPORT bool VerifySignature (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
 
virtual EXPORT bool VerifySigAuthent (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifyWithKey (const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const OTPseudonym &theNym, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySigAuthent (const OTPseudonym &theNym, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const OTAsymmetricKey &theKey, const OTSignature &theSignature, const OTString &strHashType, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const char *szFoldername, const char *szFilename, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT const OTAsymmetricKeyGetContractPublicKey () const
 
EXPORT const OTPseudonymGetContractPublicNym () const
 

Protected Member Functions

virtual int32_t ProcessXMLNode (irr::io::IrrXMLReader *&xml)
 
- Protected Member Functions inherited from opentxs::OTContract
bool LoadContractXML ()
 

Protected Attributes

OTString m_strHostname
 
int32_t m_nPort
 
OTString m_strURL
 
- Protected Attributes inherited from opentxs::OTContract
OTString m_strName
 
OTString m_strFoldername
 
OTString m_strFilename
 
OTIdentifier m_ID
 
OTStringXML m_xmlUnsigned
 
OTString m_strRawFile
 
OTString m_strSigHashType
 
OTString m_strContractType
 
mapOfNyms m_mapNyms
 
listOfSignatures m_listSignatures
 
OTString m_strVersion
 
OTString m_strEntityShortName
 
OTString m_strEntityLongName
 
OTString m_strEntityEmail
 
OTString::Map m_mapConditions
 

Additional Inherited Members

- Static Public Member Functions inherited from opentxs::OTContract
static EXPORT bool DearmorAndTrim (const OTString &strInput, OTString &strOutput, OTString &strFirstLine)
 
static bool AddBookendsAroundContent (OTString &strOutput, const OTString &strContents, const OTString &strContractType, const OTString &strHashType, const listOfSignatures &listSignatures)
 
static EXPORT bool LoadEncodedTextField (irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput)
 
static EXPORT bool LoadEncodedTextField (irr::io::IrrXMLReader *&xml, OTString &strOutput)
 
static bool LoadEncodedTextFieldByName (irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)
 
static bool LoadEncodedTextFieldByName (irr::io::IrrXMLReader *&xml, OTString &strOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)
 
static bool SkipToElement (irr::io::IrrXMLReader *&xml)
 
static bool SkipToTextField (irr::io::IrrXMLReader *&xml)
 
static bool SkipAfterLoadingField (irr::io::IrrXMLReader *&xml)
 
static EXPORT bool SignFlatText (OTString &strFlatText, const OTString &strContractType, const OTPseudonym &theSigner, OTString &strOutput)
 

Detailed Description

Definition at line 143 of file OTServerContract.hpp.

Constructor & Destructor Documentation

opentxs::OTServerContract::OTServerContract ( )

Definition at line 147 of file OTServerContract.cpp.

148  : OTContract()
149 {
150  m_nPort = 0;
151 }
opentxs::OTServerContract::OTServerContract ( OTString name,
OTString foldername,
OTString filename,
OTString strID 
)

Definition at line 153 of file OTServerContract.cpp.

155  : OTContract(name, foldername, filename, strID)
156 {
157  m_nPort = 0;
158 }
opentxs::OTServerContract::~OTServerContract ( )
virtual

Definition at line 160 of file OTServerContract.cpp.

161 {
162 }

Member Function Documentation

void opentxs::OTServerContract::CreateContents ( )
virtual

Reimplemented from opentxs::OTContract.

Definition at line 217 of file OTServerContract.cpp.

218 {
219 
220  m_strVersion = "2.0"; // 2.0 since adding credentials.
221 
223  m_xmlUnsigned.Concatenate("<?xml version=\"%s\"?>\n", "1.0");
224  m_xmlUnsigned.Concatenate("<%s version=\"%s\">\n\n",
225  "notaryProviderContract", m_strVersion.Get());
226 
227  // Entity
228  m_xmlUnsigned.Concatenate("<entity shortname=\"%s\"\n"
229  " longname=\"%s\"\n"
230  " email=\"%s\"\n"
231  " serverURL=\"%s\"/>\n\n",
234  m_strURL.Get());
235 
236  // notaryServer
237  m_xmlUnsigned.Concatenate("<notaryServer hostname=\"%s\"\n"
238  " port=\"%d\"\n"
239  " URL=\"%s\"/>\n\n",
241 
242  // This is where OTContract scribes m_xmlUnsigned with its keys, conditions,
243  // etc.
245 
246  m_xmlUnsigned.Concatenate("</%s>\n", "notaryProviderContract");
247 }
EXPORT void CreateInnerContents()
EXPORT void Concatenate(const char *arg,...)
Definition: OTString.cpp:1334
OTString m_strEntityShortName
Definition: OTContract.hpp:207
OTString m_strEntityLongName
Definition: OTContract.hpp:208
OTStringXML m_xmlUnsigned
Definition: OTContract.hpp:174
EXPORT const char * Get() const
Definition: OTString.cpp:1045
OTString m_strEntityEmail
Definition: OTContract.hpp:209
virtual EXPORT void Release()
Definition: OTString.cpp:765
bool opentxs::OTServerContract::DisplayStatistics ( OTString strContents) const
virtual

Reimplemented from opentxs::OTContract.

Definition at line 175 of file OTServerContract.cpp.

176 {
177  const OTString strID(m_ID);
178 
179  strContents.Concatenate(" Notary Provider: %s\n"
180  " ServerID: %s\n"
181  "\n",
182  m_strName.Get(), strID.Get());
183 
184  return true;
185 }
OTIdentifier m_ID
Definition: OTContract.hpp:172
EXPORT const char * Get() const
Definition: OTString.cpp:1045
bool opentxs::OTServerContract::GetConnectInfo ( OTString strHostname,
int32_t &  nPort 
) const

Definition at line 164 of file OTServerContract.cpp.

166 {
167  if (m_strHostname.GetLength()) {
168  strHostname = m_strHostname;
169  nPort = m_nPort;
170  return true;
171  }
172  return false;
173 }
EXPORT uint32_t GetLength() const
Definition: OTString.cpp:1040
int32_t opentxs::OTServerContract::ProcessXMLNode ( irr::io::IrrXMLReader *&  xml)
protectedvirtual

Reimplemented from opentxs::OTContract.

Definition at line 251 of file OTServerContract.cpp.

252 {
253  int32_t nReturnVal = 0;
254 
255  // Here we call the parent class first.
256  // If the node is found there, or there is some error,
257  // then we just return either way. But if it comes back
258  // as '0', then nothing happened, and we'll continue executing.
259  //
260  // -- Note you can choose not to call the parent if
261  // you don't want to use any of those xml tags.
262 
263  nReturnVal = OTContract::ProcessXMLNode(xml);
264  if (nReturnVal) return nReturnVal;
265 
266  if (!strcmp("notaryProviderContract", xml->getNodeName())) {
267  m_strVersion = xml->getAttributeValue("version");
268 
269  otWarn << "\n"
270  "===> Loading XML portion of server contract into memory "
271  "structures...\n\n"
272  "Notary Server Name: " << m_strName
273  << "\nContract version: " << m_strVersion << "\n----------\n";
274  nReturnVal = 1;
275  }
276  else if (!strcmp("notaryServer", xml->getNodeName())) {
277  m_strHostname = xml->getAttributeValue("hostname");
278  m_nPort = atoi(xml->getAttributeValue("port"));
279  m_strURL = xml->getAttributeValue("URL");
280 
281  otWarn << "\n"
282  "Notary Server connection info:\n --- Hostname: "
283  << m_strHostname << "\n --- Port: " << m_nPort
284  << "\n --- URL:" << m_strURL << "\n\n";
285  nReturnVal = 1;
286  }
287 
288  return nReturnVal;
289 }
OTLOG_IMPORT OTLogStream otWarn
virtual EXPORT int32_t ProcessXMLNode(irr::io::IrrXMLReader *&xml)
bool opentxs::OTServerContract::SaveContractWallet ( OTString strContents) const
virtual

Reimplemented from opentxs::OTContract.

Definition at line 187 of file OTServerContract.cpp.

188 {
189  const OTString strID(m_ID);
190  OTASCIIArmor ascName;
191 
192  if (m_strName.Exists()) // name is in the clear in memory, and base64 in
193  // storage.
194  {
195  ascName.SetString(m_strName, false); // linebreaks == false
196  }
197  strContents.Concatenate("<notaryProvider name=\"%s\"\n"
198  " serverID=\"%s\" />\n\n",
199  m_strName.Exists() ? ascName.Get() : "",
200  strID.Get());
201 
202  return true;
203 }
EXPORT bool Exists() const
Definition: OTString.cpp:1035
OTIdentifier m_ID
Definition: OTContract.hpp:172
bool opentxs::OTServerContract::SaveContractWallet ( std::ofstream &  ofs) const
virtual

Implements opentxs::OTContract.

Definition at line 205 of file OTServerContract.cpp.

206 {
207  OTString strOutput;
208 
209  if (SaveContractWallet(strOutput)) {
210  ofs << strOutput;
211  return true;
212  }
213 
214  return false;
215 }
virtual bool SaveContractWallet(OTString &strContents) const

Member Data Documentation

int32_t opentxs::OTServerContract::m_nPort
protected

Definition at line 168 of file OTServerContract.hpp.

OTString opentxs::OTServerContract::m_strHostname
protected

Definition at line 167 of file OTServerContract.hpp.

OTString opentxs::OTServerContract::m_strURL
protected

Definition at line 169 of file OTServerContract.hpp.


The documentation for this class was generated from the following files: