Base class for simple mode classes. More...
#include <m_mode_base.h>
Public Member Functions | |
void | Open (const char *password=0) |
Select device mode. | |
void | Open (const char *password, const char *name) |
Select device mode. | |
void | RetryPassword (const char *password) |
Retry a failed password attempt from the first call to Open(). |
Base class for simple mode classes.
Put common code here.
Definition at line 37 of file m_mode_base.h.
void Barry::Mode::Mode::Open | ( | const char * | password, | |
const char * | name | |||
) |
Select device mode.
This is required before using any other mode-based operations, such as GetDBDB() and LoadDatabase().
This function opens a socket to the device for communicating in Desktop mode. If the device requires it, specify the password with a const char* string in password. The password will not be stored in memory inside this class, only a hash will be generated from it. After using the hash, the hash memory will be set to 0. The application is responsible for safely handling the raw password data.
It uses the provided name as the name for the socket used in this mode. Usually this shouldn't be needed unless using the raw channel mode.
You can retry the password by catching Barry::BadPassword and calling RetryPassword() with the new password.
Barry::Error | Thrown on protocol error. | |
std::logic_error() | Thrown if unsupported mode is requested, or if socket already open. | |
Barry::BadPassword | Thrown when password is invalid or if not enough retries left in the device. |
Definition at line 109 of file m_mode_base.cc.
References RetryPassword().
void Barry::Mode::Mode::Open | ( | const char * | password = 0 |
) |
Select device mode.
This is required before using any other mode-based operations, such as GetDBDB() and LoadDatabase().
This function opens a socket to the device for communicating in Desktop mode. If the device requires it, specify the password with a const char* string in password. The password will not be stored in memory inside this class, only a hash will be generated from it. After using the hash, the hash memory will be set to 0. The application is responsible for safely handling the raw password data.
You can retry the password by catching Barry::BadPassword and calling RetryPassword() with the new password.
Barry::Error | Thrown on protocol error. | |
std::logic_error() | Thrown if unsupported mode is requested, or if socket already open. | |
Barry::BadPassword | Thrown when password is invalid or if not enough retries left in the device. |
Definition at line 67 of file m_mode_base.cc.
References RetryPassword().
void Barry::Mode::Mode::RetryPassword | ( | const char * | password | ) |
Retry a failed password attempt from the first call to Open().
Only call this function in response to Barry::BadPassword exceptions that are thrown from Open().
Barry::Error | Thrown on protocol error. | |
std::logic_error() | Thrown if in unsupported mode, or if socket already open. | |
Barry::BadPassword | Thrown when password is invalid or if not enough retries left in the device. |
Definition at line 138 of file m_mode_base.cc.
References Barry::SocketZero::Open().
Referenced by Open().