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

#include <OTCaller.hpp>

Collaboration diagram for opentxs::OTCaller:

Public Member Functions

 OTCaller ()
 
EXPORT ~OTCaller ()
 
EXPORT bool GetPassword (OTPassword &theOutput) const
 
EXPORT void ZeroOutPassword ()
 
EXPORT const char * GetDisplay () const
 
EXPORT void SetDisplay (const char *szDisplay, int32_t nLength)
 
EXPORT void delCallback ()
 
EXPORT void setCallback (OTCallback *cb)
 
EXPORT bool isCallbackSet () const
 
EXPORT void callOne ()
 
EXPORT void callTwo ()
 

Protected Attributes

OTPassword m_Password
 
OTPassword m_Display
 
OTCallback_callback
 

Detailed Description

Definition at line 344 of file OTCaller.hpp.

Constructor & Destructor Documentation

opentxs::OTCaller::OTCaller ( )
inline

Definition at line 357 of file OTCaller.hpp.

358  : _callback(nullptr)
359  {
360  }
OTCallback * _callback
Definition: OTCaller.hpp:354
opentxs::OTCaller::~OTCaller ( )

Definition at line 168 of file OTCaller.cpp.

169 {
170  otOut << "OTCaller::~OTCaller: (This should only happen as the application "
171  "is closing.)\n";
172 
173  delCallback();
174 }
EXPORT void delCallback()
Definition: OTCaller.cpp:221
OTLOG_IMPORT OTLogStream otOut

Member Function Documentation

void opentxs::OTCaller::callOne ( )

Definition at line 261 of file OTCaller.cpp.

262 {
263  ZeroOutPassword(); // Make sure there isn't some old password still in here.
264 
265  if (isCallbackSet()) {
266  otOut
267  << "OTCaller::callOne: FYI, Executing password callback (one)...\n";
269  }
270  else {
271  otOut << "OTCaller::callOne: WARNING: Failed attempt to trigger "
272  "password callback (one), due to \"it hasn't been set "
273  "yet.\"\n";
274  }
275 }
EXPORT void ZeroOutPassword()
Definition: OTCaller.cpp:215
OTLOG_IMPORT OTLogStream otOut
OTCallback * _callback
Definition: OTCaller.hpp:354
virtual EXPORT void runOne(const char *szDisplay, OTPassword &theOutput) const
Definition: OTCallback.cpp:176
EXPORT bool isCallbackSet() const
Definition: OTCaller.cpp:256
EXPORT const char * GetDisplay() const
Definition: OTCaller.cpp:179
OTPassword m_Password
Definition: OTCaller.hpp:347
void opentxs::OTCaller::callTwo ( )

Definition at line 277 of file OTCaller.cpp.

278 {
279  ZeroOutPassword(); // Make sure there isn't some old password still in here.
280 
281  if (isCallbackSet()) {
282  otOut
283  << "OTCaller::callTwo: FYI, Executing password callback (two)...\n";
285  }
286  else {
287  otOut << "OTCaller::callTwo: WARNING: Failed attempt to trigger "
288  "password callback (two), due to \"it hasn't been set "
289  "yet.\"\n";
290  }
291 }
EXPORT void ZeroOutPassword()
Definition: OTCaller.cpp:215
OTLOG_IMPORT OTLogStream otOut
OTCallback * _callback
Definition: OTCaller.hpp:354
EXPORT bool isCallbackSet() const
Definition: OTCaller.cpp:256
EXPORT const char * GetDisplay() const
Definition: OTCaller.cpp:179
OTPassword m_Password
Definition: OTCaller.hpp:347
virtual EXPORT void runTwo(const char *szDisplay, OTPassword &theOutput) const
Definition: OTCallback.cpp:186
void opentxs::OTCaller::delCallback ( )

Definition at line 221 of file OTCaller.cpp.

222 {
223  // if (nullptr != _callback) // TODO this may be a memory leak.
224  // delete _callback; // But I know we're currently crashing from
225  // deleting same object twice.
226  // And since the object comes from Java, who am I to delete it? Let Java
227  // clean it up.
228  if (isCallbackSet())
229  otOut << "OTCaller::delCallback: WARNING: setting existing callback "
230  "object pointer to nullptr. "
231  "(This message doesn't trigger if it was already nullptr.)\n";
232 
233  _callback = nullptr;
234 }
OTLOG_IMPORT OTLogStream otOut
OTCallback * _callback
Definition: OTCaller.hpp:354
EXPORT bool isCallbackSet() const
Definition: OTCaller.cpp:256
const char * opentxs::OTCaller::GetDisplay ( ) const

Definition at line 179 of file OTCaller.cpp.

180 {
181  // I'm using the OTPassword class to store the display string, in addition
182  // to
183  // storing the password itself. (For convenience.)
184  //
185  return reinterpret_cast<const char*>(m_Display.getPassword_uint8());
186 }
OTPassword m_Display
Definition: OTCaller.hpp:350
EXPORT const uint8_t * getPassword_uint8() const
Definition: OTPassword.cpp:554
bool opentxs::OTCaller::GetPassword ( OTPassword theOutput) const

Definition at line 204 of file OTCaller.cpp.

205 {
206  otOut << "OTCaller::GetPassword: FYI, returning password after invoking a "
207  "(probably Java) password dialog.\n";
208 
209  theOutput.setPassword_uint8(m_Password.getPassword_uint8(),
211 
212  return true;
213 }
OTLOG_IMPORT OTLogStream otOut
EXPORT uint32_t getPasswordSize() const
Definition: OTPassword.cpp:613
EXPORT const uint8_t * getPassword_uint8() const
Definition: OTPassword.cpp:554
OTPassword m_Password
Definition: OTCaller.hpp:347
bool opentxs::OTCaller::isCallbackSet ( ) const

Definition at line 256 of file OTCaller.cpp.

257 {
258  return (nullptr == _callback) ? false : true;
259 }
OTCallback * _callback
Definition: OTCaller.hpp:354
void opentxs::OTCaller::setCallback ( OTCallback cb)

Definition at line 236 of file OTCaller.cpp.

237 {
238  otOut << "OTCaller::setCallback: Attempting to set the password OTCallback "
239  "pointer...\n";
240 
241  if (nullptr == cb) {
242  otOut << "OTCaller::setCallback: ERROR: nullptr password OTCallback "
243  "object passed in. (Returning.)\n";
244  return;
245  }
246 
247  delCallback(); // Sets _callback to nullptr, but LOGS first, if it was
248  // already
249  // set.
250 
251  _callback = cb;
252  otOut << "OTCaller::setCallback: FYI, the password OTCallback pointer was "
253  "set.\n";
254 }
EXPORT void delCallback()
Definition: OTCaller.cpp:221
OTLOG_IMPORT OTLogStream otOut
OTCallback * _callback
Definition: OTCaller.hpp:354
void opentxs::OTCaller::SetDisplay ( const char *  szDisplay,
int32_t  nLength 
)

Definition at line 191 of file OTCaller.cpp.

192 {
193  // I'm using the OTPassword class to store the display string, in addition
194  // to
195  // storing the password itself. (For convenience.)
196  //
197  m_Display.setPassword_uint8(reinterpret_cast<const uint8_t*>(szDisplay),
198  nLength);
199 }
OTPassword m_Display
Definition: OTCaller.hpp:350
EXPORT int32_t setPassword_uint8(const uint8_t *input, uint32_t size)
Definition: OTPassword.cpp:674
void opentxs::OTCaller::ZeroOutPassword ( )

Definition at line 215 of file OTCaller.cpp.

217 {
219 }
EXPORT void zeroMemory()
Definition: OTPassword.cpp:281
EXPORT uint32_t getPasswordSize() const
Definition: OTPassword.cpp:613
OTPassword m_Password
Definition: OTCaller.hpp:347

Member Data Documentation

OTCallback* opentxs::OTCaller::_callback
protected

Definition at line 354 of file OTCaller.hpp.

OTPassword opentxs::OTCaller::m_Display
protected

Definition at line 350 of file OTCaller.hpp.

OTPassword opentxs::OTCaller::m_Password
protected

Definition at line 347 of file OTCaller.hpp.


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