Classes | Functions

Barry Namespace Reference

Project namespace, containing all related functions and classes. More...

Classes

class  Backup
class  Builder
 Base class for the builder functor hierarchy. More...
class  DBDataBuilder
 Wrapper class around a DBData object, to make it easy to pass a DBData object into a function or API that requires a builder. More...
class  RecordBuilder
 Template class for easy creation of specific protocol packet builder objects. More...
class  RecordFetch
 Generic record fetch class, to help with using records without builder classes. More...
class  CodFileBuilder
 The CodFileBuilder class is used to assemble multiple .cod files into a single packed .cod file using the pkzip file format. More...
class  ConfigFile
class  GlobalConfigFile
class  Connector
class  DesktopConnector
class  Controller
 The main interface class. More...
class  PrivateControllerData
class  Data
class  Diff
class  DBData
 Database record data class. More...
class  DataQueue
 This class provides a thread aware fifo queue for Data objects, providing memory management for all Data object pointers it contains. More...
class  Error
 The base class for any future derived exceptions. More...
class  BadPassword
 A bad or unknown password when talking to the device. More...
class  SocketCloseOnOpen
 Thrown by the Socket class if it receives a CLOSE message in response to an OPEN command. More...
class  PinNotFound
 Thrown by the Connector class when unable to find the requested Pin If the attached pin is not Valid(), then unable to autodetect device. More...
class  BadData
 Thrown by record classes if their data is invalid and cannot be uploaded to the Blackberry. More...
class  BadSize
 Unexpected packet size, or not enough data. More...
class  ErrnoError
 System error that provides an errno error code. More...
class  ConfigFileError
 Thrown by the ConfigFile class when encountering a serious system error while loading the global config file for a given PIN. More...
class  BadPackedFormat
 Thrown by record classes that don't recognize a given packed format code. More...
class  BadPacket
 Thrown by the socket class if a packet command's response indicates an error. More...
class  ConvertError
 Thrown by the vformat related barrysync library classes. More...
class  BackupError
 Thrown by the Backup parser class when there is a problem with the low level file operation. More...
class  RestoreError
 Thrown by the Restore builder class when there is a problem with the low level file operation. More...
class  ReturnCodeError
 Thrown by the Mode::Desktop class when a database command returns a non-zero error code. More...
class  ValidationError
 Thrown by one of the record classes' Validate() function. More...
struct  FifoArgs
 Contains argument variables to be passed through the FIFO. More...
class  FifoServer
 Accepts a FifoArgs struct, and creates the necessary fifo for transfer. More...
class  FifoClient
 Searches for a fifo and opens and reads it if available. More...
class  IConvHandlePrivate
class  IConvHandle
 Wrapper class for a two-way iconv_t handle pair. More...
class  IConverter
 Main charset conversion class, primarily focused on converting between the Blackberry charset and an application-specified one. More...
class  ios_format_state
 This class saves the following stream settings:

  • flags
  • precision
  • width
  • fill character.
More...
class  ContactLdif
 Class for generating LDIF output based on a Barry::Contact record object. More...
class  LdifStore
 Storage class suitable for use in a RecordParser<> or RecordBuilder<>. More...
class  LogLock
 RAII locking class used to protect the logStream passed into Barry::Init() (common.h). More...
class  DeviceBuilder
 Takes a list of database dbId's and behaves like a Builder, trying to avoid copies where possible on the device loading end. More...
class  DeviceParser
 A parser class that "parses" raw data into a device. More...
class  JLDirectory
class  JLDirectoryEntry
class  JLScreenInfo
class  JLEventlog
class  JLEventlogEntry
class  JLDeviceInfo
class  JVMModulesList
class  JVMModulesEntry
class  JVMThreadsList
class  JVMThreadsEntry
class  MimeDump
class  MimeDump< Barry::Contact >
class  MimeDump< Barry::Calendar >
class  MimeDump< Barry::Memo >
class  MimeDump< Barry::Task >
class  MimeBuilder
class  Modem
class  Packet
class  ZeroPacket
 Provides an API for building and analyzing socket-0 protocol packets. More...
class  DBPacket
 Provides an API for building and analyzing raw DB protocol packets. More...
class  JLPacket
 Provides an API for building and analyzing raw Javaloader protocol packets. More...
class  JVMPacket
 Provides an API for building and analyzing raw JavaDebug protocol packets. More...
class  Parser
 Base class for the parser hierarchy. More...
class  NullParser
 If in debug mode, this class can be used as a null parser. More...
class  HexDumpParser
 Dumps raw hex of the given DBData to the given stream. More...
class  RecordParserBase
 Abstract base class for the following RecordParser template, that exposes some information on the specifics that the record parser can handle. More...
class  NullStore
 A Storage class for RecordParser<> that does nothing, for the cases where you only want to dump parsed record data to a stream. More...
class  DumpStore
 A Storage class for RecordParser<> that dumps the parsed record data to the given stream. More...
class  RecordStore
 A Storage class for RecordParser that stores a copy of the parsed record. More...
class  RecordParser
 Template class for easy creation of specific parser objects. More...
class  AllRecordStore
 Base class with overloaded functor behaviour for all available record classes. More...
class  MultiRecordParser
 Container parser class that accepts multiple Parser objects (often RecordParser<> objects but they don't have to be) and automatically routes incoming records to the appropriate parser. More...
class  AllRecordDumpStore
 Derived from AllRecordStore, which just calls each record's Dump() member with the given stream. More...
class  AllRecordParser
 Convenience parser that creates a MultiRecordParser with all known record parsers added. More...
class  TeeParser
 Sends incoming DBData objects to all the parsers in its list. More...
class  Pin
class  Pipe
 Reads data from a builder and feeds it into a parser. More...
class  PppFilter
struct  ProbeResult
class  Probe
class  Bookmark
class  Calendar
class  CalendarAll
class  CallLog
struct  ContactGroupLink
class  Contact
 Represents a single record in the Address Book Blackberry database. More...
class  ContentStore
 Represents a single record in the Content Store Blackberry database. More...
class  Folder
class  HandheldAgent
 Represents a single record in the Handheld Agent database. More...
class  Memo
class  Message
class  MessageBase
class  PINMessage
class  RecurBase
class  SavedMessage
class  ServiceBookData
class  ServiceBookConfig
class  ServiceBook
class  Sms
class  Task
 Task record class. More...
struct  TimeZoneStore
class  TimeZone
class  TimeZones
 Creates a vector of TimeZone objects either based on the library's hard coded StaticTimeZone list, or by extracting the time zone database from a given device. More...
struct  FieldLink
class  Cr2LfWrapper
struct  TimeT
 Struct wrapper for time_t, to make sure that it has its own type, for overload purposes. More...
struct  CommandTableCommand
class  CommandTable
struct  RecordStateTableState
class  RecordStateTable
struct  DatabaseItem
class  DatabaseDatabase
struct  UnknownData
struct  UnknownField
class  EmailList
struct  EmailAddress
class  EmailAddressList
struct  PostalAddress
struct  Date
class  CategoryList
struct  FieldIdentity
 This class holds data that identifies a given field in a record. More...
class  EnumConstants
 This is the base class for the hierarchy of classes to define enum record members. More...
class  FieldValueHandlerBase
 This is a pure virtual base class, defining the various types that record fields can be. More...
class  EnumFieldBase
 EnumFieldBase<RecordT> More...
class  EnumField
 EnumField<RecordT, EnumT> More...
class  FieldHandle
 This is a template class that handles pointers to members of multiple types of data and multiple types of records. More...
class  FieldSorter
 FieldSorter<> is a helper class for NamedFieldCmp<>, used as the callback for FieldHandle<>::Member(). More...
class  NamedFieldCmp
 A comparison functor, intended to be used in std::sort(), which allows sorting by a particular record's member variable, selected by string name. More...
class  DBNamedFieldCmp
 This class is a wrapper around the NamedFieldCmp<>, allowing you to sort a vector (or other container) of DBData objects. More...
class  Restore
 Barry Backup Restore builder class. More...
class  SocketRoutingQueue
class  DataHandle
 std::auto_ptr like class that handles pointers to Data, but instead of freeing them completely, the Data objects are turned to the SocketRoutingQueue from whence they came. More...
class  BoostLoader
class  BoostSaver
class  BoostParser
 This Parser turns incoming records (which can be of any record type included in ALL_KNOWN_PARSER_TYPES) into a Boost Serialization stream on the given iostream. More...
class  BoostBuilder
 This Builder class reads a boost serialization stream, and converts them into DBData records. More...
class  scoped_lock
class  semaphore
struct  SHA_CTX
class  SocketZero
class  SocketBase
class  Socket
 Encapsulates a "logical socket" in the Blackberry USB protocol. More...
class  Thread
struct  StaticTimeZone
class  vSmartPtr
 A special smart pointer for variables that have their own special 'free' functions. More...
class  vLateSmartPtr
 Variation of the above smart pointer that allows the user to assign a free function after construction, in the case of dlopen()'d frees. More...

Functions

size_t GetBitmapHeadersSize ()
 Returns the size of the bitmap headers (both file and info headers).
size_t GetTotalBitmapSize (const JLScreenInfo &info)
 Returns the total number of bytes needed to convert a screenshot of the given dimensions into a bitmap, using the ScreenshotToBitmap() function.
void ScreenshotToRGB (const JLScreenInfo &info, const Data &screenshot, Data &buffer, size_t offset, int depth, bool invert, bool overwrite_alpha, uint8_t alpha)
 Converts screenshot data obtained via JavaLoader::GetScreenshot() into uncompressed RGB bitmap format.
void ScreenshotToBitmap (const JLScreenInfo &info, const Data &screenshot, Data &bitmap)
 Converts screenshot data obtained via JavaLoader::GetScreenshot() into uncompressed bitmap format, suitable for writing BMP files.
template<class RecordT >
void SetDBData (const RecordT &rec, DBData &data, size_t &offset, const IConverter *ic)
 Contains the proper way to convert a record object into a DBData object.
size_t SeekNextCod (std::istream &input)
 Seeks the input stream to the next packed sibling .cod file and returns the packed .cod file size.
void Init (bool data_dump_mode, std::ostream *logStream)
 Barry library initializer.
void Verbose (bool data_dump_mode)
 This API call lets the application enable / disable verbose debug output on the fly.
bool IsVerbose ()
 Returns true if data dump mode is enabled.
std::string MakeBackupFilename (const Barry::Pin &pin, const std::string &label)
 Creates a tar.gz filename using PIN + date + time + label.
template<class RecordT >
void ParseDBData (const DBData &data, RecordT &rec, const IConverter *ic)
 Contains the proper way to convert a DBData object into a record.
template<class RecordT , class TypeT >
FieldHandle< RecordT > MakeFieldHandle (TypeT RecordT::*tp, const FieldIdentity &id)
 Factory function to create a FieldHandle<> object.
template<class HandlesT , class CallbackT >
void ForEachField (const HandlesT &handles, const CallbackT &func)
 Calls FieldHandle<>::Member() for each defined field for a given record type.
template<class RecordT >
void ForEachFieldValue (const RecordT &rec, const FieldValueHandlerBase &vh)
 Calls FieldHandle<>::Value() for each defined field for a given record.
const StaticTimeZoneGetStaticTimeZoneTable ()
 Returns a pointer to an array of StaticTimeZone structs.
const StaticTimeZoneGetStaticTimeZone (uint16_t Code)
 Searches the internal timezone code table for the given Code and returns a pointer to a StaticTimeZone struct found.
uint16_t GetStaticTimeZoneCode (signed short HourOffset, signed short MinOffset)
 Searches the internal timezone table for the first matching Code.
time_t DayToDate (uint16_t Day)
 This routine takes the day of the year and returns a time_t adjusted from the first of the year.
time_t Message2Time (uint16_t r_date, uint16_t r_time)
 Localize the funky math used to convert a Blackberry message timestamp into a time_t.
struct timespec * ThreadTimeout (int timeout_ms, struct timespec *spec)
 Creates a pthread_cond_timedwait() compatible timespec struct, based on a given timeout in milliseconds.
BXEXPORT int DaysInMonth (struct tm &t)
 Returns the number of days in the month, given the tm_mon and tm_year as specified in the struct tm argument.
const char * Version (int &logical, int &major, int &minor)
 Fills major and minor with integer version numbers, and returns a string containing human readable version information in English.

Detailed Description

Project namespace, containing all related functions and classes.

This is the only namespace applications should be concerned with, for now.


Function Documentation

BXEXPORT int Barry::DaysInMonth ( struct tm &  t  ) 

Returns the number of days in the month, given the tm_mon and tm_year as specified in the struct tm argument.

It _does_ take leap year into account.

BXEXPORT time_t Barry::DayToDate ( uint16_t  Day  ) 

This routine takes the day of the year and returns a time_t adjusted from the first of the year.

FIXME This function assumes the year hasn't changed, but I don't have enough information to determine where the year is in this header info

BXEXPORT size_t Barry::GetBitmapHeadersSize (  ) 

Returns the size of the bitmap headers (both file and info headers).

You can use this as an offset into the bitmap produced by ScreenshotToBitmap to get just the 4-byte RGB data.

BXEXPORT const StaticTimeZone * Barry::GetStaticTimeZone ( uint16_t  Code  ) 

Searches the internal timezone code table for the given Code and returns a pointer to a StaticTimeZone struct found.

If the code is not found, a pointer to a valid StaticTimeZone struct is is still returned, but the struct's Code contains STATIC_TIME_ZONE_CODE_ERR, and the name is "Unknown time zone." The unknown timezone is the same offset as GMT.

BXEXPORT unsigned short Barry::GetStaticTimeZoneCode ( signed short  HourOffset,
signed short  MinOffset 
)

Searches the internal timezone table for the first matching Code.

If no matching Code is found, STATIC_TIME_ZONE_CODE_ERR is returned.

This function does not adjust for daylight saving time.

BXEXPORT const StaticTimeZone * Barry::GetStaticTimeZoneTable (  ) 

Returns a pointer to an array of StaticTimeZone structs.

The last struct contains 0 in all fields, and can be used as an "end of array" marker.

Referenced by Barry::TimeZones::TimeZones().

Here is the caller graph for this function:

BXEXPORT size_t Barry::GetTotalBitmapSize ( const JLScreenInfo &  info  ) 

Returns the total number of bytes needed to convert a screenshot of the given dimensions into a bitmap, using the ScreenshotToBitmap() function.

BXEXPORT void Barry::Init ( bool  data_dump_mode,
std::ostream *  logStream 
)

Barry library initializer.

See also the LogLock class.

Call this before anything else. This takes care of initializing the lower level libusb.

This function is safe to be called multiple times. The data_dump_mode and the log stream will be updated each time it is called, but the USB library will not be re-initialized.

Parameters:
[in] data_dump_mode If set to true, the protocol conversation will be sent to the logStream specified in the second argument.
[in] LogStream Pointer to std::ostream object to use for debug output and logging. Defaults to std::cout.
BXEXPORT bool Barry::IsVerbose (  ) 

Returns true if data dump mode is enabled.

BXEXPORT std::string Barry::MakeBackupFilename ( const Barry::Pin pin,
const std::string &  label 
)

Creates a tar.gz filename using PIN + date + time + label.

Does not include any path, just returns a new filename.

BXEXPORT time_t Barry::Message2Time ( uint16_t  r_date,
uint16_t  r_time 
)

Localize the funky math used to convert a Blackberry message timestamp into a time_t.

Both r_date and r_time are expected to be fed in from the Protocol::MessageRecord struct in raw form, without endian conversion. This function handles that.

template<class RecordT >
void Barry::ParseDBData ( const DBData &  data,
RecordT &  rec,
const IConverter *  ic 
)

Contains the proper way to convert a DBData object into a record.

Definition at line 240 of file parser.h.

Referenced by Barry::RecordParser< RecordT, StorageT >::ParseRecord().

Here is the caller graph for this function:

BXEXPORT void Barry::ScreenshotToBitmap ( const JLScreenInfo &  info,
const Data &  screenshot,
Data &  bitmap 
)

Converts screenshot data obtained via JavaLoader::GetScreenshot() into uncompressed bitmap format, suitable for writing BMP files.

Arguments info and screenshot come from GetScreenshot() and the converted data is stored in bitmap.

BXEXPORT void Barry::ScreenshotToRGB ( const JLScreenInfo &  info,
const Data &  screenshot,
Data &  buffer,
size_t  offset,
int  depth,
bool  invert,
bool  overwrite_alpha,
uint8_t  alpha 
)

Converts screenshot data obtained via JavaLoader::GetScreenshot() into uncompressed RGB bitmap format.

The results will not have a bitmap BMP header. Data will be written to buffer, starting at offset. The depth variable can be 24 or 32. If invert is true, the result will be inverted, just like a BMP file; otherwise not.

size_t Barry::SeekNextCod ( std::istream &  input  ) 

Seeks the input stream to the next packed sibling .cod file and returns the packed .cod file size.

When all siblings have been read, zero is returned.

When input stream does not contain the signature for a packed .cod file, it's assumed the entire stream is the .cod file.

Parameters:
input stream to read from
Returns:
size of next packed .cod file, or 0 finished reading .cod files
template<class RecordT >
void Barry::SetDBData ( const RecordT &  rec,
DBData &  data,
size_t &  offset,
const IConverter *  ic 
)

Contains the proper way to convert a record object into a DBData object.

Definition at line 135 of file builder.h.

Referenced by Barry::MimeBuilder::BuildRecord(), and Barry::RecordBuilder< RecordT, StorageT >::BuildRecord().

Here is the caller graph for this function:

BXEXPORT struct timespec * Barry::ThreadTimeout ( int  timeout_ms,
struct timespec *  spec 
) [read]

Creates a pthread_cond_timedwait() compatible timespec struct, based on a given timeout in milliseconds.

Note that the resulting timespec is time-sensitive: the 'timer' starts as soon as this function returns, since timespec is a specific time in the future, and ThreadTimeout() calculates it based on the current time.

Returns the spec pointer, to make it easy to use with pthread_cond_timedwait()

Referenced by Barry::DataQueue::wait_pop().

Here is the caller graph for this function:

BXEXPORT void Barry::Verbose ( bool  data_dump_mode  ) 

This API call lets the application enable / disable verbose debug output on the fly.

Parameters:
[in] data_dump_mode If set to true, the protocol conversation will be sent to the logStream specified in the Barry::Init() call.
BXEXPORT const char * Barry::Version ( int &  logical,
int &  major,
int &  minor 
)

Fills major and minor with integer version numbers, and returns a string containing human readable version information in English.