barry.h   barry.h 
/// ///
/// \file barry.h /// \file barry.h
/// Main header file for applications /// Main header file for applications
/// ///
/*
Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the
root directory of this project for more details.
*/
#ifndef __BARRY_BARRY_H__ #ifndef __BARRY_BARRY_H__
#define __BARRY_BARRY_H__ #define __BARRY_BARRY_H__
/** /**
\mainpage Barry Reference Manual \mainpage Barry Reference Manual
\section getting_started Getting Started \section getting_started Getting Started
Welcome to the Barry reference manual. This entire manual was Welcome to the Barry reference manual. This entire manual was
skipping to change at line 36 skipping to change at line 52
*/ */
// This lists all the headers that the application needs. // This lists all the headers that the application needs.
// Only these headers get installed. // Only these headers get installed.
#include "data.h" #include "data.h"
#include "usbwrap.h" // to be moved to libusb someday #include "usbwrap.h" // to be moved to libusb someday
#include "common.h" // Init() #include "common.h" // Init()
#include "error.h" // exceptions #include "error.h" // exceptions
#include "probe.h" // device prober class #include "probe.h" // device prober class
#include "dataqueue.h"
#include "socket.h" #include "socket.h"
#include "router.h"
#include "protocol.h" // application-safe header #include "protocol.h" // application-safe header
#include "parser.h" #include "parser.h"
#include "builder.h" #include "builder.h"
#include "record.h" #include "record.h"
#include "ldif.h" #include "ldif.h"
#include "controller.h" #include "controller.h"
#include "controllertmpl.h" #include "m_desktop.h"
#include "m_desktoptmpl.h"
#include "m_ipmodem.h"
#include "m_serial.h"
#include "version.h" #include "version.h"
#include "log.h"
#include "sha1.h"
#ifdef __BARRY_BOOST_MODE__ #ifdef __BARRY_BOOST_MODE__
// Boost serialization seems to be picky about header order, do them all he re // Boost serialization seems to be picky about header order, do them all he re
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <vector> #include <vector>
#include <string> #include <string>
#include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_oarchive.hpp>
 End of changes. 5 change blocks. 
1 lines changed or deleted 24 lines changed or added


 builder.h   builder.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_BUILDER_H__ #ifndef __BARRY_BUILDER_H__
#define __BARRY_BUILDER_H__ #define __BARRY_BUILDER_H__
//#include "data.h" #include "dll.h"
//#include "protocol.h"
//#include "debug.h"
namespace Barry { namespace Barry {
// //
// Builder class // Builder class
// //
/// Base class for the builder functor hierarchy. /// Base class for the builder functor hierarchy.
/// ///
/// This defines the API used by the Controller and Packet classes /// This defines the API used by the Controller and Packet classes
/// for building a raw device record to write to the device. /// for building a raw device record to write to the device.
/// ///
class Builder class BXEXPORT Builder
{ {
public: public:
Builder() {} Builder() {}
virtual ~Builder() {} virtual ~Builder() {}
/// Called first in the sequence, to allow the application to /// Called first in the sequence, to allow the application to
/// load the needed data from memory, disk, etc. If successful, /// load the needed data from memory, disk, etc. If successful,
/// return true. If at the end of the series, return false. /// return true. If at the end of the series, return false.
virtual bool Retrieve(unsigned int databaseId) = 0; virtual bool Retrieve(unsigned int databaseId) = 0;
 End of changes. 2 change blocks. 
4 lines changed or deleted 2 lines changed or added


 common.h   common.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_COMMON_H__ #ifndef __BARRY_COMMON_H__
#define __BARRY_COMMON_H__ #define __BARRY_COMMON_H__
#include "dll.h"
#include <iostream>
#define VENDOR_RIM 0x0fca #define VENDOR_RIM 0x0fca
#define PRODUCT_RIM_BLACKBERRY 0x0001 #define PRODUCT_RIM_BLACKBERRY 0x0001
#define PRODUCT_RIM_PEARL_DUAL 0x0004 #define PRODUCT_RIM_PEARL_DUAL 0x0004
#define PRODUCT_RIM_PEARL_8120 0x8004
#define PRODUCT_RIM_PEARL 0x0006 #define PRODUCT_RIM_PEARL 0x0006
#define BLACKBERRY_CONFIGURATION 1 #define BLACKBERRY_CONFIGURATION 1
#define BLACKBERRY_DB_CLASS 0xff #define BLACKBERRY_DB_CLASS 0xff
// minimum number of password tries remaining at which Barry gives up
// for safety
#define BARRY_MIN_PASSWORD_TRIES 3
#define BARRY_MIN_PASSWORD_TRIES_ASC "3"
namespace Barry { namespace Barry {
void Init(bool data_dump_mode = false); /// See also the LogLock class.
BXEXPORT void Init(bool data_dump_mode = false, std::ostream *logStream = &
std::cout);
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 4 change blocks. 
1 lines changed or deleted 12 lines changed or added


 controller.h   controller.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_CONTROLLER_H__ #ifndef __BARRY_CONTROLLER_H__
#define __BARRY_CONTROLLER_H__ #define __BARRY_CONTROLLER_H__
#include "dll.h"
#include "usbwrap.h" #include "usbwrap.h"
#include "probe.h"
#include "socket.h" #include "socket.h"
#include "record.h" #include "probe.h"
#include "data.h"
/// Project namespace, containing all related functions and classes. /// Project namespace, containing all related functions and classes.
/// This is the only namespace applications should be concerned with, /// This is the only namespace applications should be concerned with,
/// for now. /// for now.
namespace Barry { namespace Barry {
// forward declarations // forward declarations
class Parser; class SocketRoutingQueue;
class Builder;
class DBPacket; namespace Mode {
class Desktop;
class IpModem;
class Serial;
}
// //
// Controller class // Controller class
// //
/// The main interface class. This class coordinates the communication to /// The main interface class. This class coordinates the communication to
/// a single handheld. /// a single handheld. This class also owns the only Usb::Device object
/// the handheld. All other classes reference this one for the low level
/// device object. This class owns the only SocketZero object as well,
/// which is the object that any SocketRoutingQueue is plugged into
/// if constructed that way.
/// ///
/// To use this class, use the following steps: /// To use this class, use the following steps:
/// ///
/// - Probe the USB bus for matching devices with the Probe class /// - Probe the USB bus for matching devices with the Probe class
/// - Create an optional SocketRoutingQueue object and create a
/// read thread for it, or use its default read thread.
/// - Pass one of the probe results into the Controller constructor /// - Pass one of the probe results into the Controller constructor
/// to connect /// to connect to the USB device. Pass the routing queue
/// - Call OpenMode() to select the desired mode. This will fill all /// to the Controller constructor here too, if needed.
/// internal data structures for that mode, such as the /// - Create the Mode object of your choice. See m_desktop.h
/// Database Database in Desktop mode. /// and m_serial.h for these mode classes. You pass
/// NOTE: only Desktop mode is currently implemented. /// your controller object into these mode constructors
/// - Call GetDBDB() to get the device's database database /// to create the mode.
/// - Call GetDBID() to get a database ID by name
/// - In Desktop mode, call LoadDatabase() to retrieve and store a datab
ase
/// ///
class Controller class BXEXPORT Controller
{ {
friend class Barry::DBPacket; friend class Barry::Mode::Desktop;
friend class Barry::Mode::IpModem;
friend class Barry::Mode::Serial;
public: public:
/// Handheld mode type /// Handheld mode type
enum ModeType { enum ModeType {
Unspecified, //< default on start up Unspecified, //< default on start up (unused)
Bypass, //< unsupported, unknown Bypass, //< unsupported, unknown
Desktop, //< desktop mode required for databa se Desktop, //< desktop mode required for databa se
//< operation //< operation
JavaLoader, //< unsupported JavaLoader, //< unsupported
UsbSerData //< GPRS modem support over USB UsbSerData, //< GPRS modem support over USB
UsbSerCtrl //< internally used behind the scene
s
}; };
enum CommandType { Unknown, DatabaseAccess };
private: private:
ProbeResult m_result;
Usb::Device m_dev; Usb::Device m_dev;
Usb::Interface *m_iface; Usb::Interface *m_iface;
uint32_t m_pin; uint32_t m_pin;
Socket m_socket; SocketZero m_zero;
SocketRoutingQueue *m_queue; //< ptr to external object; no delet
CommandTable m_commandTable; e
DatabaseDatabase m_dbdb;
ModeType m_mode;
uint16_t m_modeSocket; // socket recommended by dev
ice
// when mode was selected
// UsbSerData cache
Data m_writeCache, m_readCache;
// tracking of open Desktop socket, and the need to reset private:
bool m_halfOpen; void SetupUsb(const ProbeResult &device);
protected: protected:
void SelectMode(ModeType mode); uint16_t SelectMode(ModeType mode); // returns mode socket
unsigned int GetCommand(CommandType ct);
void LoadCommandTable();
void LoadDBDB();
public: public:
Controller(const ProbeResult &device); explicit Controller(const ProbeResult &device);
Controller(const ProbeResult &device, SocketRoutingQueue &queue);
~Controller(); ~Controller();
////////////////////////////////// bool HasQueue() const { return m_queue; }
// meta access
/// Returns DatabaseDatabase object for this connection.
/// Must call OpenMode() to select Desktop mode first
const DatabaseDatabase& GetDBDB() const { return m_dbdb; }
unsigned int GetDBID(const std::string &name) const;
//////////////////////////////////
// general operations
void OpenMode(ModeType mode, const char *password = 0);
void RetryPassword(const char *password);
//////////////////////////////////
// Desktop mode - database specific
// dirty flag related functions, for sync operations
void GetRecordStateTable(unsigned int dbId, RecordStateTable &result
);
void AddRecord(unsigned int dbId, Builder &build); // RecordId is
// retrieved from build, and duplicate IDs are allowed,
// but *not* recommended!
void GetRecord(unsigned int dbId, unsigned int stateTableIndex, Pars
er &parser);
void SetRecord(unsigned int dbId, unsigned int stateTableIndex, Buil
der &build);
void ClearDirty(unsigned int dbId, unsigned int stateTableIndex);
void DeleteRecord(unsigned int dbId, unsigned int stateTableIndex);
// pure load/save operations
void LoadDatabase(unsigned int dbId, Parser &parser);
void SaveDatabase(unsigned int dbId, Builder &builder);
template <class RecordT, class StorageT> void LoadDatabaseByType(Sto
rageT &store);
template <class RecordT, class StorageT> void SaveDatabaseByType(Sto
rageT &store);
template <class StorageT> void LoadDatabaseByName(const std::string
&name, StorageT &store);
template <class StorageT> void SaveDatabaseByName(const std::string
&name, StorageT &store);
template <class RecordT> void AddRecordByType(uint32_t recordId, con
st RecordT &rec);
//////////////////////////////////
// UsbSerData mode - modem specific
void SerialRead(Data &data, int timeout); // can be called from sepa const ProbeResult& GetProbeResult() const { return m_result; }
rate thread
void SerialWrite(const Data &data);
}; };
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 19 change blocks. 
93 lines changed or deleted 41 lines changed or added


 data.h   data.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __SB_DATA_H__ #ifndef __SB_DATA_H__
#define __SB_DATA_H__ #define __SB_DATA_H__
#include "dll.h"
#include <iosfwd> #include <iosfwd>
#include <vector> #include <vector>
namespace Barry { namespace Barry {
class Data class BXEXPORT Data
{ {
unsigned char *m_data; unsigned char *m_data;
size_t m_bufsize; //< size of m_data buffer allocated size_t m_bufsize; //< size of m_data buffer allocated
size_t m_datasize; //< number of bytes of actual data size_t m_datasize; //< number of bytes of actual data
int m_endpoint; int m_endpoint;
// copy on write feature // copy on write feature
const unsigned char *m_externalData; const unsigned char *m_externalData;
bool m_external; bool m_external;
skipping to change at line 79 skipping to change at line 80
void Zap(); void Zap();
Data& operator=(const Data &other); Data& operator=(const Data &other);
// static functions // static functions
static void PrintAscii(bool setting) { bPrintAscii = setting; } static void PrintAscii(bool setting) { bPrintAscii = setting; }
static bool PrintAscii() { return bPrintAscii; } static bool PrintAscii() { return bPrintAscii; }
}; };
std::istream& operator>> (std::istream &is, Data &data); BXEXPORT std::istream& operator>> (std::istream &is, Data &data);
std::ostream& operator<< (std::ostream &os, const Data &data); BXEXPORT std::ostream& operator<< (std::ostream &os, const Data &data);
class Diff class BXEXPORT Diff
{ {
const Data &m_old, &m_new; const Data &m_old, &m_new;
void Compare(std::ostream &os, size_t index, size_t size) const; BXLOCAL void Compare(std::ostream &os, size_t index, size_t size) co nst;
public: public:
Diff(const Data &old, const Data &new_); Diff(const Data &old, const Data &new_);
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
}; };
std::ostream& operator<< (std::ostream &os, const Diff &diff); BXEXPORT std::ostream& operator<< (std::ostream &os, const Diff &diff);
// utility functions // utility functions
bool LoadDataArray(const std::string &filename, std::vector<Data> &array); BXEXPORT bool LoadDataArray(const std::string &filename, std::vector<Data>
bool ReadDataArray(std::istream &is, std::vector<Data> &array); &array);
BXEXPORT bool ReadDataArray(std::istream &is, std::vector<Data> &array);
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 7 change blocks. 
8 lines changed or deleted 10 lines changed or added


 error.h   error.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_ERROR_H__ #ifndef __BARRY_ERROR_H__
#define __BARRY_ERROR_H__ #define __BARRY_ERROR_H__
#include "dll.h"
#include <stdexcept> #include <stdexcept>
namespace Barry { namespace Barry {
/// \addtogroup exceptions /// \addtogroup exceptions
/// @{ /// @{
// //
// Error class // Error class
// //
/// The base class for any future derived exceptions. /// The base class for any future derived exceptions.
/// Can be thrown on any protocol error. /// Can be thrown on any protocol error.
/// ///
class Error : public std::runtime_error class BXEXPORT Error : public std::runtime_error
{ {
public: public:
Error(const std::string &str) : std::runtime_error(str) {} Error(const std::string &str) : std::runtime_error(str) {}
}; };
// //
// BadPassword // BadPassword
// //
/// A bad or unknown password when talking to the device. /// A bad or unknown password when talking to the device.
/// Can be thrown in the following instances: /// Can be thrown in the following instances:
/// ///
/// - no password provided and the device requests one /// - no password provided and the device requests one
/// - device rejected the available password /// - device rejected the available password
/// - too few remaining tries left... Barry will refuse to keep /// - too few remaining tries left... Barry will refuse to keep
/// trying passwords if there are fewer than /// trying passwords if there are fewer than
/// 6 tries remaining. In this case, out_of_tries() /// BARRY_MIN_PASSWORD_TRIES tries remaining. In this case,
/// will return true. /// out_of_tries() will return true.
/// ///
/// ///
class BadPassword : public Barry::Error class BXEXPORT BadPassword : public Barry::Error
{ {
int m_remaining_tries; int m_remaining_tries;
bool m_out_of_tries; bool m_out_of_tries;
public: public:
BadPassword(const std::string &str, int remaining_tries, BadPassword(const std::string &str, int remaining_tries,
bool out_of_tries) bool out_of_tries)
: Barry::Error(str), : Barry::Error(str),
m_remaining_tries(remaining_tries), m_remaining_tries(remaining_tries),
m_out_of_tries(out_of_tries) m_out_of_tries(out_of_tries)
{} {}
int remaining_tries() const { return m_remaining_tries; } int remaining_tries() const { return m_remaining_tries; }
bool out_of_tries() const { return m_out_of_tries; } bool out_of_tries() const { return m_out_of_tries; }
}; };
// //
// BadSize // BadSize
// //
/// Unexpected packet size, or not enough data. /// Unexpected packet size, or not enough data.
/// ///
class BadSize : public Barry::Error class BXEXPORT BadSize : public Barry::Error
{ {
unsigned int m_packet_size, unsigned int m_packet_size,
m_data_buf_size, m_data_buf_size,
m_required_size; m_required_size;
static std::string GetMsg(unsigned int p, unsigned int d, unsigned i nt r); BXLOCAL static std::string GetMsg(unsigned int p, unsigned int d, un signed int r);
public: public:
BadSize(unsigned int packet_size, BadSize(unsigned int packet_size,
unsigned int data_buf_size, unsigned int data_buf_size,
unsigned int required_size) unsigned int required_size)
: Barry::Error(GetMsg(packet_size, data_buf_size, required_s ize)), : Barry::Error(GetMsg(packet_size, data_buf_size, required_s ize)),
m_packet_size(packet_size), m_packet_size(packet_size),
m_data_buf_size(data_buf_size), m_data_buf_size(data_buf_size),
m_required_size(required_size) m_required_size(required_size)
{} {}
unsigned int packet_size() const { return m_packet_size; } unsigned int packet_size() const { return m_packet_size; }
unsigned int data_buf_size() const { return m_data_buf_size; } unsigned int data_buf_size() const { return m_data_buf_size; }
unsigned int required_size() const { return m_required_size; } unsigned int required_size() const { return m_required_size; }
}; };
//
// ErrnoError
//
/// System error that provides an errno error code.
///
class ErrnoError : public Barry::Error
{
int m_errno;
static std::string GetMsg(const std::string &msg, int err);
public:
ErrnoError(const std::string &msg, int err)
: Barry::Error(GetMsg(msg, err))
, m_errno(err)
{}
int error_code() const { return m_errno; }
};
/// @} /// @}
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 7 change blocks. 
6 lines changed or deleted 27 lines changed or added


 ldif.h   ldif.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_LDIF_H__ #ifndef __BARRY_LDIF_H__
#define __BARRY_LDIF_H__ #define __BARRY_LDIF_H__
#include "dll.h"
#include <string> #include <string>
#include <map> #include <map>
// forward declarations // forward declarations
namespace Barry { namespace Barry {
class Contact; class Contact;
} }
namespace Barry { namespace Barry {
skipping to change at line 63 skipping to change at line 64
/// <pre> /// <pre>
/// for( ContactLdif::NameToFunc *n = o.GetFieldNames(); n->name; n++ ) { /// for( ContactLdif::NameToFunc *n = o.GetFieldNames(); n->name; n++ ) {
/// ... /// ...
/// } /// }
/// </pre> /// </pre>
/// ///
/// Note that all Get/Set functions used in attribute mapping are virtual, /// Note that all Get/Set functions used in attribute mapping are virtual,
/// and can be overridden by a derived class. This includes the heuristics /// and can be overridden by a derived class. This includes the heuristics
/// functions, which are called by DumpLdif(). /// functions, which are called by DumpLdif().
/// ///
class ContactLdif class BXEXPORT ContactLdif
{ {
public: public:
typedef std::string (ContactLdif::*GetFunctionType)(const Barry::Con tact&) const; typedef std::string (ContactLdif::*GetFunctionType)(const Barry::Con tact&) const;
typedef void (ContactLdif::*SetFunctionType)(Barry::Contact&, const std::string &) const; typedef void (ContactLdif::*SetFunctionType)(Barry::Contact&, const std::string &) const;
/// Used to create a List of supported Barry field names, including /// Used to create a List of supported Barry field names, including
/// calculated names, such as full postal address. /// calculated names, such as full postal address.
struct NameToFunc struct NameToFunc
{ {
const char *name; const char *name;
skipping to change at line 121 skipping to change at line 122
protected: protected:
static const NameToFunc FieldMap[]; static const NameToFunc FieldMap[];
AccessMapType m_map; AccessMapType m_map;
std::string m_baseDN; std::string m_baseDN;
HookMapType m_hookMap; HookMapType m_hookMap;
LdifAttribute m_dnAttr; LdifAttribute m_dnAttr;
void DoWrite(Barry::Contact &con, const std::string &attr, void DoWrite(Barry::Contact &con, const std::string &attr,
const std::string &data); const std::string &data);
// Array getter state
mutable unsigned int m_emailIndex;
// name heuristics // name heuristics
std::string m_cn, m_displayName, m_sn, m_givenName; std::string m_cn, m_displayName, m_sn, m_givenName;
// heuristics hooking - saves each found value in the variable // heuristics hooking - saves each found value in the variable
// pointed at by var // pointed at by var
void Hook(const std::string &ldifname, std::string *var); void Hook(const std::string &ldifname, std::string *var);
public: public:
explicit ContactLdif(const std::string &baseDN); explicit ContactLdif(const std::string &baseDN);
virtual ~ContactLdif(); virtual ~ContactLdif();
skipping to change at line 180 skipping to change at line 184
virtual std::string Country(const Barry::Contact &con) const; virtual std::string Country(const Barry::Contact &con) const;
virtual std::string JobTitle(const Barry::Contact &con) const; virtual std::string JobTitle(const Barry::Contact &con) const;
virtual std::string PublicKey(const Barry::Contact &con) const; virtual std::string PublicKey(const Barry::Contact &con) const;
virtual std::string Notes(const Barry::Contact &con) const; virtual std::string Notes(const Barry::Contact &con) const;
// calculated values... // calculated values...
virtual std::string PostalAddress(const Barry::Contact &con) const; virtual std::string PostalAddress(const Barry::Contact &con) const;
virtual std::string FullName(const Barry::Contact &con) const; virtual std::string FullName(const Barry::Contact &con) const;
virtual std::string FQDN(const Barry::Contact &con) const; virtual std::string FQDN(const Barry::Contact &con) const;
// //
// Array modifier functions for above Access functions
//
virtual bool IsArrayFunc(GetFunctionType getf) const;
void ClearArrayState() const;
//
// Write functions // Write functions
// //
virtual void SetEmail(Barry::Contact &con, const std::string &val) c onst; virtual void SetEmail(Barry::Contact &con, const std::string &val) c onst;
virtual void SetPhone(Barry::Contact &con, const std::string &val) c onst; virtual void SetPhone(Barry::Contact &con, const std::string &val) c onst;
virtual void SetFax(Barry::Contact &con, const std::string &val) con st; virtual void SetFax(Barry::Contact &con, const std::string &val) con st;
virtual void SetWorkPhone(Barry::Contact &con, const std::string &va l) const; virtual void SetWorkPhone(Barry::Contact &con, const std::string &va l) const;
virtual void SetHomePhone(Barry::Contact &con, const std::string &va l) const; virtual void SetHomePhone(Barry::Contact &con, const std::string &va l) const;
virtual void SetMobilePhone(Barry::Contact &con, const std::string & val) const; virtual void SetMobilePhone(Barry::Contact &con, const std::string & val) const;
virtual void SetPager(Barry::Contact &con, const std::string &val) c onst; virtual void SetPager(Barry::Contact &con, const std::string &val) c onst;
skipping to change at line 229 skipping to change at line 240
void DumpLdif(std::ostream &os, const Barry::Contact &contact) const ; void DumpLdif(std::ostream &os, const Barry::Contact &contact) const ;
bool ReadLdif(std::istream &is, Barry::Contact &contact); bool ReadLdif(std::istream &is, Barry::Contact &contact);
// returns true on s uccess // returns true on s uccess
void DumpMap(std::ostream &os) const; void DumpMap(std::ostream &os) const;
static std::string MakeLdifData(const std::string &str); static std::string MakeLdifData(const std::string &str);
static bool NeedsEncoding(const std::string &str); static bool NeedsEncoding(const std::string &str);
}; };
inline std::ostream& operator<< (std::ostream &os, const ContactLdif &ldif) { BXEXPORT inline std::ostream& operator<< (std::ostream &os, const ContactLd if &ldif) {
ldif.DumpMap(os); ldif.DumpMap(os);
return os; return os;
} }
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 5 change blocks. 
2 lines changed or deleted 13 lines changed or added


 parser.h   parser.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_PARSER_H__ #ifndef __BARRY_PARSER_H__
#define __BARRY_PARSER_H__ #define __BARRY_PARSER_H__
#include "dll.h"
#include "data.h" #include "data.h"
#include "protocol.h" #include "protocol.h"
#include <stdint.h> // for uint32_t #include <stdint.h> // for uint32_t
// forward declarations // forward declarations
namespace Barry { class Data; } namespace Barry { class Data; }
namespace Barry { namespace Barry {
// also acts as a null parser // also acts as a null parser
skipping to change at line 47 skipping to change at line 48
// //
/// Base class for the parser hierarchy. If in debug mode, this /// Base class for the parser hierarchy. If in debug mode, this
/// class can be used as a null parser. Call Init() and the protocol /// class can be used as a null parser. Call Init() and the protocol
/// will be dumped to stdout and no parsing will be done. /// will be dumped to stdout and no parsing will be done.
/// ///
/// This class provides the interface that the Controller class uses /// This class provides the interface that the Controller class uses
/// to pass raw data it reads from the device. The Controller, along /// to pass raw data it reads from the device. The Controller, along
/// with the Packet class, calls each of the virtual functions below /// with the Packet class, calls each of the virtual functions below
/// in the same order. /// in the same order.
/// ///
class Parser class BXEXPORT Parser
{ {
public: public:
Parser() {} Parser() {}
virtual ~Parser() {} virtual ~Parser() {}
/// Reset and prepare for a new raw data packet /// Reset and prepare for a new raw data packet
virtual void Clear() {} virtual void Clear() {}
/// Stores the IDs /// Stores the IDs
virtual void SetIds(uint8_t RecType, uint32_t UniqueId) {} virtual void SetIds(uint8_t RecType, uint32_t UniqueId) {}
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 probe.h   probe.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_PROBE_H__ #ifndef __BARRY_PROBE_H__
#define __BARRY_PROBE_H__ #define __BARRY_PROBE_H__
#include "dll.h"
#include "usbwrap.h" #include "usbwrap.h"
#include <vector> #include <vector>
#include <iosfwd> #include <iosfwd>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
struct ProbeResult struct BXEXPORT ProbeResult
{ {
Usb::DeviceIDType m_dev; Usb::DeviceIDType m_dev;
unsigned char m_interface; unsigned char m_interface;
uint32_t m_pin; uint32_t m_pin;
Usb::EndpointPair m_ep; Usb::EndpointPair m_ep;
Usb::EndpointPair m_epModem;
uint8_t m_zeroSocketSequence; uint8_t m_zeroSocketSequence;
std::string m_description; std::string m_description;
ProbeResult()
: m_dev(0), m_interface(0), m_pin(0), m_zeroSocketSequence(0
)
{}
void DumpAll(std::ostream &os) const;
bool HasIpModem() const { return m_epModem.IsComplete(); }
}; };
std::ostream& operator<< (std::ostream &os, const ProbeResult &pr); BXEXPORT std::ostream& operator<< (std::ostream &os, const ProbeResult &pr) ;
class Probe class BXEXPORT Probe
{ {
std::vector<ProbeResult> m_results; std::vector<ProbeResult> m_results;
std::vector<std::string> m_fail_msgs; std::vector<std::string> m_fail_msgs;
int m_fail_count; int m_fail_count;
bool CheckSize(const Data &data, unsigned int required); BXLOCAL bool CheckSize(const Data &data, unsigned int required);
bool ParsePIN(const Data &data, ProbeResult &result); BXLOCAL bool ParsePIN(const Data &data, uint32_t &pin);
bool ParseDesc(const Data &data, ProbeResult &result); BXLOCAL bool ParseDesc(const Data &data, std::string &desc);
protected: protected:
void ProbeMatching(int vendor, int product, void ProbeMatching(int vendor, int product,
const char *busname, const char *devname); const char *busname, const char *devname);
void ProbeDevice(Usb::DeviceIDType devid); void ProbeDevice(Usb::DeviceIDType devid);
bool ProbePair(Usb::Device &dev, const Usb::EndpointPair &ep,
uint32_t &pin, std::string &desc, uint8_t &zeroSocketSequenc
e);
bool ProbeModem(Usb::Device &dev, const Usb::EndpointPair &ep);
public: public:
Probe(const char *busname = 0, const char *devname = 0); Probe(const char *busname = 0, const char *devname = 0);
int GetCount() const { return m_results.size(); } int GetCount() const { return m_results.size(); }
int GetFailCount() const { return m_fail_count; } int GetFailCount() const { return m_fail_count; }
const std::string& GetFailMsg(int index) const { return m_fail_msgs[ index]; } const std::string& GetFailMsg(int index) const { return m_fail_msgs[ index]; }
const ProbeResult& Get(int index) const { return m_results[index]; } const ProbeResult& Get(int index) const { return m_results[index]; }
 End of changes. 8 change blocks. 
6 lines changed or deleted 19 lines changed or added


 r_calendar.h   r_calendar.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_CALENDAR_H__ #ifndef __BARRY_RECORD_CALENDAR_H__
#define __BARRY_RECORD_CALENDAR_H__ #define __BARRY_RECORD_CALENDAR_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
// //
// NOTE: All classes here must be container-safe! Perhaps add sorting // NOTE: All classes here must be container-safe! Perhaps add sorting
// operators in the future. // operators in the future.
// //
/// \addtogroup RecordParserClasses /// \addtogroup RecordParserClasses
/// @{ /// @{
class Calendar class BXEXPORT Calendar
{ {
public: public:
typedef std::vector<UnknownField> UnknownsType; typedef std::vector<UnknownField> UnknownsType;
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
// general data // general data
bool AllDayEvent; bool AllDayEvent;
std::string Subject; std::string Subject;
skipping to change at line 130 skipping to change at line 131
// should no longer occur // should no longer occur
// If a perpetual appointment, this // If a perpetual appointment, this
// is 0xFFFFFFFF in the low level da ta // is 0xFFFFFFFF in the low level da ta
// Instead, set the following flag. // Instead, set the following flag.
bool Perpetual; // if true, this will always recur bool Perpetual; // if true, this will always recur
unsigned short TimeZoneCode; // the time zone originally used unsigned short TimeZoneCode; // the time zone originally used
// for the recurrence data... // for the recurrence data...
// seems to have little use, but // seems to have little use, but
// set to your current time zone // set to your current time zone
// as a good default // as a good default
bool TimeZoneValid; // true if the record contained a
// time zone code
unsigned short // recurring details, depending on t ype unsigned short // recurring details, depending on t ype
DayOfWeek, // 0-6 DayOfWeek, // 0-6
WeekOfMonth, // 1-5 WeekOfMonth, // 1-5
DayOfMonth, // 1-31 DayOfMonth, // 1-31
MonthOfYear; // 1-12 MonthOfYear; // 1-12
unsigned char WeekDays; // bitmask, bit 0 = sunday unsigned char WeekDays; // bitmask, bit 0 = sunday
// FIXME - put these somewhere usable by both C and C++ // FIXME - put these somewhere usable by both C and C++
#define CAL_WD_SUN 0x01 #define CAL_WD_SUN 0x01
skipping to change at line 154 skipping to change at line 157
#define CAL_WD_FRI 0x20 #define CAL_WD_FRI 0x20
#define CAL_WD_SAT 0x40 #define CAL_WD_SAT 0x40
// unknown // unknown
UnknownsType Unknowns; UnknownsType Unknowns;
public: public:
const unsigned char* ParseField(const unsigned char *begin, const unsigned char* ParseField(const unsigned char *begin,
const unsigned char *end); const unsigned char *end);
void ParseRecurrenceData(const void *data); void ParseRecurrenceData(const void *data);
void BuildRecurrenceData(void *data); void BuildRecurrenceData(void *data) const;
public: public:
Calendar(); Calendar();
~Calendar(); ~Calendar();
// Parser / Builder API (see parser.h / builder.h) // Parser / Builder API (see parser.h / builder.h)
uint8_t GetRecType() const { return RecType; } uint8_t GetRecType() const { return RecType; }
uint32_t GetUniqueId() const { return RecordId; } uint32_t GetUniqueId() const { return RecordId; }
void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; } void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
void ParseHeader(const Data &data, size_t &offset); void ParseHeader(const Data &data, size_t &offset);
skipping to change at line 181 skipping to change at line 184
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
// sorting // sorting
bool operator<(const Calendar &other) const { return StartTime < oth er.StartTime; } bool operator<(const Calendar &other) const { return StartTime < oth er.StartTime; }
// database name // database name
static const char * GetDBName() { return "Calendar"; } static const char * GetDBName() { return "Calendar"; }
static uint8_t GetDefaultRecType() { return 5; } // or 0? static uint8_t GetDefaultRecType() { return 5; } // or 0?
}; };
inline std::ostream& operator<<(std::ostream &os, const Calendar &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Calendar & msg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
/// @} /// @}
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 5 change blocks. 
3 lines changed or deleted 6 lines changed or added


 r_contact.h   r_contact.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_CONTACT_H__ #ifndef __BARRY_RECORD_CONTACT_H__
#define __BARRY_RECORD_CONTACT_H__ #define __BARRY_RECORD_CONTACT_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
// //
// NOTE: All classes here must be container-safe! Perhaps add sorting // NOTE: All classes here must be container-safe! Perhaps add sorting
// operators in the future. // operators in the future.
// //
struct ContactGroupLink struct BXEXPORT ContactGroupLink
{ {
uint32_t Link; uint32_t Link;
uint16_t Unknown; uint16_t Unknown;
ContactGroupLink() : Link(0), Unknown(0) {} ContactGroupLink() : Link(0), Unknown(0) {}
ContactGroupLink(uint32_t link, uint16_t unknown) ContactGroupLink(uint32_t link, uint16_t unknown)
: Link(link), Unknown(unknown) : Link(link), Unknown(unknown)
{} {}
}; };
typedef std::vector<std::string> CategoryList; typedef std::vector<std::string> CategoryList;
/// \addtogroup RecordParserClasses /// \addtogroup RecordParserClasses
/// @{ /// @{
class Contact class BXEXPORT Contact
{ {
public: public:
typedef Barry::CategoryList CategoryList; typedef Barry::CategoryList CategoryList;
typedef ContactGroupLink GroupLink; typedef ContactGroupLink GroupLink;
typedef std::vector<GroupLink> GroupLinksType; typedef std::vector<GroupLink> GroupLinksType;
typedef std::vector<UnknownField> UnknownsType; typedef std::vector<UnknownField> UnknownsType;
typedef std::string EmailType;
typedef std::vector<EmailType> EmailList;
// contact specific data // contact specific data
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
EmailList EmailAddresses;
std::string std::string
Email,
Phone, Phone,
Fax, Fax,
WorkPhone, WorkPhone,
HomePhone, HomePhone,
MobilePhone, MobilePhone,
Pager, Pager,
PIN, PIN,
Radio, Radio,
WorkPhone2, WorkPhone2,
HomePhone2, HomePhone2,
skipping to change at line 120 skipping to change at line 123
public: public:
const unsigned char* ParseField(const unsigned char *begin, const unsigned char* ParseField(const unsigned char *begin,
const unsigned char *end); const unsigned char *end);
public: public:
Contact(); Contact();
~Contact(); ~Contact();
uint32_t GetID() const { return RecordId; } uint32_t GetID() const { return RecordId; }
std::string GetFullName() const; std::string GetFullName() const;
const std::string& GetEmail(unsigned int index = 0) const;
// Parser / Builder API (see parser.h / builder.h) // Parser / Builder API (see parser.h / builder.h)
uint8_t GetRecType() const { return RecType; } uint8_t GetRecType() const { return RecType; }
uint32_t GetUniqueId() const { return RecordId; } uint32_t GetUniqueId() const { return RecordId; }
void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; } void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
void ParseHeader(const Data &data, size_t &offset); void ParseHeader(const Data &data, size_t &offset);
void ParseFields(const Data &data, size_t &offset); void ParseFields(const Data &data, size_t &offset);
void BuildHeader(Data &data, size_t &offset) const; void BuildHeader(Data &data, size_t &offset) const;
void BuildFields(Data &data, size_t &offset) const; void BuildFields(Data &data, size_t &offset) const;
skipping to change at line 151 skipping to change at line 155
// database name // database name
static const char * GetDBName() { return "Address Book"; } static const char * GetDBName() { return "Address Book"; }
static uint8_t GetDefaultRecType() { return 0; } static uint8_t GetDefaultRecType() { return 0; }
// helpers // helpers
static void SplitName(const std::string &full, std::string &first, s td::string &last); static void SplitName(const std::string &full, std::string &first, s td::string &last);
static void CategoryStr2List(const std::string &str, Barry::Category List &list); static void CategoryStr2List(const std::string &str, Barry::Category List &list);
static void CategoryList2Str(const Barry::CategoryList &list, std::s tring &str); static void CategoryList2Str(const Barry::CategoryList &list, std::s tring &str);
}; };
inline std::ostream& operator<< (std::ostream &os, const Contact &contact) { BXEXPORT inline std::ostream& operator<< (std::ostream &os, const Contact & contact) {
contact.Dump(os); contact.Dump(os);
return os; return os;
} }
/// @} /// @}
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 8 change blocks. 
4 lines changed or deleted 8 lines changed or added


 r_folder.h   r_folder.h 
skipping to change at line 26 skipping to change at line 26
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_FOLDER_H__ #ifndef __BARRY_RECORD_FOLDER_H__
#define __BARRY_RECORD_FOLDER_H__ #define __BARRY_RECORD_FOLDER_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
class Folder class BXEXPORT Folder
{ {
public: public:
typedef std::vector<UnknownField> UnknownsType ; typedef std::vector<UnknownField> UnknownsType ;
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
std::string FolderName; std::string FolderName;
uint16_t FolderNumber; // Not unique, used for ordering of subfolders - NOT level uint16_t FolderNumber; // Not unique, used for ordering of subfolders - NOT level
uint16_t FolderLevel; // From parent uint16_t FolderLevel; // From parent
skipping to change at line 87 skipping to change at line 88
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
bool operator<(const Folder &other) const { return FolderName < othe r.FolderName; } bool operator<(const Folder &other) const { return FolderName < othe r.FolderName; }
// database name // database name
static const char * GetDBName() { return "Folders"; } static const char * GetDBName() { return "Folders"; }
static uint8_t GetDefaultRecType() { return 0; } static uint8_t GetDefaultRecType() { return 0; }
}; };
inline std::ostream& operator<<(std::ostream &os, const Folder &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Folder &ms g) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
} // namespace Barry } // namespace Barry
#endif // __BARRY_RECORD_FOLDER_H__ #endif // __BARRY_RECORD_FOLDER_H__
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 r_memo.h   r_memo.h 
skipping to change at line 26 skipping to change at line 26
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_MEMO_H__ #ifndef __BARRY_RECORD_MEMO_H__
#define __BARRY_RECORD_MEMO_H__ #define __BARRY_RECORD_MEMO_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
class Memo class BXEXPORT Memo
{ {
public: public:
typedef std::vector<UnknownField> UnknownsType; typedef std::vector<UnknownField> UnknownsType;
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
uint8_t MemoType; uint8_t MemoType;
std::string Title; std::string Title;
std::string Body; std::string Body;
skipping to change at line 74 skipping to change at line 75
void Clear(); void Clear();
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
bool operator<(const Memo &other) const { return Title < other.Title ; } bool operator<(const Memo &other) const { return Title < other.Title ; }
// database name // database name
static const char * GetDBName() { return "Memos"; } static const char * GetDBName() { return "Memos"; }
static uint8_t GetDefaultRecType() { return 0; } // or 0? static uint8_t GetDefaultRecType() { return 0; } // or 0?
}; };
inline std::ostream& operator<<(std::ostream &os, const Memo &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Memo &msg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 r_message.h   r_message.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_MESSAGE_H__ #ifndef __BARRY_RECORD_MESSAGE_H__
#define __BARRY_RECORD_MESSAGE_H__ #define __BARRY_RECORD_MESSAGE_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
// //
// NOTE: All classes here must be container-safe! Perhaps add sorting // NOTE: All classes here must be container-safe! Perhaps add sorting
// operators in the future. // operators in the future.
// //
/// \addtogroup RecordParserClasses /// \addtogroup RecordParserClasses
/// @{ /// @{
class Message class BXEXPORT Message
{ {
public: public:
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
EmailAddress From; EmailAddress From;
EmailAddress To; EmailAddress To;
EmailAddress Cc; EmailAddress Cc;
EmailAddress Bcc; EmailAddress Bcc;
EmailAddress Sender; EmailAddress Sender;
skipping to change at line 120 skipping to change at line 121
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
// sorting // sorting
bool operator<(const Message &other) const { return Subject < other. Subject; } bool operator<(const Message &other) const { return Subject < other. Subject; }
// database name // database name
static const char * GetDBName() { return "Messages"; } static const char * GetDBName() { return "Messages"; }
static uint8_t GetDefaultRecType() { return 0; } static uint8_t GetDefaultRecType() { return 0; }
}; };
inline std::ostream& operator<<(std::ostream &os, const Message &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Message &m sg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
/// @} /// @}
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 r_pin_message.h   r_pin_message.h 
skipping to change at line 26 skipping to change at line 26
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_PIN_MESSAGE_H__ #ifndef __BARRY_RECORD_PIN_MESSAGE_H__
#define __BARRY_RECORD_PIN_MESSAGE_H__ #define __BARRY_RECORD_PIN_MESSAGE_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
// //
// NOTE: All classes here must be container-safe! Perhaps add sorting // NOTE: All classes here must be container-safe! Perhaps add sorting
// operators in the future. // operators in the future.
// //
/// \addtogroup RecordParserClasses /// \addtogroup RecordParserClasses
/// @{ /// @{
class PINMessage class BXEXPORT PINMessage
{ {
public: public:
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
EmailAddress From; EmailAddress From;
EmailAddress To; EmailAddress To;
EmailAddress Cc; EmailAddress Cc;
EmailAddress Bcc; EmailAddress Bcc;
std::string Subject; std::string Subject;
skipping to change at line 121 skipping to change at line 122
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
// sorting // sorting
bool operator<(const PINMessage &other) const { return Subject < oth er.Subject; } bool operator<(const PINMessage &other) const { return Subject < oth er.Subject; }
// database name // database name
static const char * GetDBName() { return "PIN Messages"; } static const char * GetDBName() { return "PIN Messages"; }
static uint8_t GetDefaultRecType() { return 0; } static uint8_t GetDefaultRecType() { return 0; }
}; };
inline std::ostream& operator<<(std::ostream &os, const PINMessage &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const PINMessage &msg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
/// @} /// @}
} // namespace Barry } // namespace Barry
#endif // __BARRY_RECORD_PIN_MESSAGE_H__ #endif // __BARRY_RECORD_PIN_MESSAGE_H__
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 r_saved_message.h   r_saved_message.h 
skipping to change at line 27 skipping to change at line 27
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_SAVED_MESSAGE_H__ #ifndef __BARRY_RECORD_SAVED_MESSAGE_H__
#define __BARRY_RECORD_SAVED_MESSAGE_H__ #define __BARRY_RECORD_SAVED_MESSAGE_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
// //
// NOTE: All classes here must be container-safe! Perhaps add sorting // NOTE: All classes here must be container-safe! Perhaps add sorting
// operators in the future. // operators in the future.
// //
/// \addtogroup RecordParserClasses /// \addtogroup RecordParserClasses
/// @{ /// @{
class SavedMessage class BXEXPORT SavedMessage
{ {
public: public:
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
EmailAddress From; EmailAddress From;
EmailAddress To; EmailAddress To;
EmailAddress Cc; EmailAddress Cc;
EmailAddress Bcc; EmailAddress Bcc;
EmailAddress Sender; EmailAddress Sender;
skipping to change at line 117 skipping to change at line 118
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
// sorting // sorting
bool operator<(const SavedMessage &other) const { return Subject < o ther.Subject; } bool operator<(const SavedMessage &other) const { return Subject < o ther.Subject; }
// database name // database name
static const char * GetDBName() { return "Saved Email Messages"; } static const char * GetDBName() { return "Saved Email Messages"; }
static uint8_t GetDefaultRecType() { return 3; } static uint8_t GetDefaultRecType() { return 3; }
}; };
inline std::ostream& operator<<(std::ostream &os, const SavedMessage &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const SavedMessa ge &msg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
/// @} /// @}
} // namespace Barry } // namespace Barry
#endif // __BARRY_RECORD_SAVED_MESSAGE_H__ #endif // __BARRY_RECORD_SAVED_MESSAGE_H__
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 r_servicebook.h   r_servicebook.h 
skipping to change at line 26 skipping to change at line 26
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_SERVICEBOOK_H__ #ifndef __BARRY_RECORD_SERVICEBOOK_H__
#define __BARRY_RECORD_SERVICEBOOK_H__ #define __BARRY_RECORD_SERVICEBOOK_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
// //
// NOTE: All classes here must be container-safe! Perhaps add sorting // NOTE: All classes here must be container-safe! Perhaps add sorting
// operators in the future. // operators in the future.
// //
/// \addtogroup RecordParserClasses /// \addtogroup RecordParserClasses
/// @{ /// @{
// This is a packed field, which is a group of fields packed in // This is a packed field, which is a group of fields packed in
// variable length records inside one larger field of a normal record. // variable length records inside one larger field of a normal record.
class ServiceBookConfig class BXEXPORT ServiceBookConfig
{ {
public: public:
typedef std::vector<UnknownField> UnknownsType; typedef std::vector<UnknownField> UnknownsType;
uint8_t Format; uint8_t Format;
UnknownsType Unknowns; UnknownsType Unknowns;
public: public:
const unsigned char* ParseField(const unsigned char *begin, const unsigned char* ParseField(const unsigned char *begin,
skipping to change at line 73 skipping to change at line 74
void ParseHeader(const Data &data, size_t &offset); void ParseHeader(const Data &data, size_t &offset);
void ParseFields(const Data &data, size_t &offset); void ParseFields(const Data &data, size_t &offset);
void BuildHeader(Data &data, size_t &offset) const; void BuildHeader(Data &data, size_t &offset) const;
void BuildFields(Data &data, size_t &offset) const; void BuildFields(Data &data, size_t &offset) const;
void Clear(); void Clear();
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
}; };
inline std::ostream& operator<<(std::ostream &os, const ServiceBookConfig & msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const ServiceBoo kConfig &msg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
class ServiceBook class BXEXPORT ServiceBook
{ {
int NameType, DescType, UniqueIdType; int NameType, DescType, UniqueIdType;
public: public:
typedef std::vector<UnknownField> UnknownsType; typedef std::vector<UnknownField> UnknownsType;
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
std::string Name; std::string Name;
std::string HiddenName; std::string HiddenName;
skipping to change at line 127 skipping to change at line 128
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
// sorting // sorting
bool operator<(const ServiceBook &other) const { return RecordId < R ecordId; } bool operator<(const ServiceBook &other) const { return RecordId < R ecordId; }
// database name // database name
static const char * GetDBName() { return "Service Book"; } static const char * GetDBName() { return "Service Book"; }
static uint8_t GetDefaultRecType() { return 0; } static uint8_t GetDefaultRecType() { return 0; }
}; };
inline std::ostream& operator<<(std::ostream &os, const ServiceBook &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const ServiceBoo k &msg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
/// @} /// @}
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 5 change blocks. 
4 lines changed or deleted 5 lines changed or added


 r_task.h   r_task.h 
skipping to change at line 26 skipping to change at line 26
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_TASK_H__ #ifndef __BARRY_RECORD_TASK_H__
#define __BARRY_RECORD_TASK_H__ #define __BARRY_RECORD_TASK_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
namespace Barry { namespace Barry {
class Task class BXEXPORT Task
{ {
public: public:
typedef std::vector<UnknownField> UnknownsType ; typedef std::vector<UnknownField> UnknownsType ;
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
uint8_t TaskType; uint8_t TaskType;
std::string Summary; std::string Summary;
std::string Notes; std::string Notes;
std::string Categories; std::string Categories;
skipping to change at line 134 skipping to change at line 135
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
bool operator<(const Task &other) const { return Summary < other.Sum mary; } bool operator<(const Task &other) const { return Summary < other.Sum mary; }
// database name // database name
static const char * GetDBName() { return "Tasks"; } static const char * GetDBName() { return "Tasks"; }
static uint8_t GetDefaultRecType() { return 2; } static uint8_t GetDefaultRecType() { return 2; }
}; };
inline std::ostream& operator<<(std::ostream &os, const Task &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Task &msg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 r_timezone.h   r_timezone.h 
skipping to change at line 26 skipping to change at line 26
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_TIMEZONE_H__ #ifndef __BARRY_RECORD_TIMEZONE_H__
#define __BARRY_RECORD_TIMEZONE_H__ #define __BARRY_RECORD_TIMEZONE_H__
#include "dll.h"
#include "record.h" #include "record.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
namespace Barry namespace Barry
{ {
class Timezone class BXEXPORT Timezone
{ {
public: public:
typedef std::vector<UnknownField> UnknownsType ; typedef std::vector<UnknownField> UnknownsType ;
uint8_t RecType; uint8_t RecType;
uint32_t RecordId; uint32_t RecordId;
uint8_t TZType; uint8_t TZType;
uint32_t DSTOffset; uint32_t DSTOffset;
int32_t Index; int32_t Index;
skipping to change at line 82 skipping to change at line 83
void Clear(); void Clear();
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
bool operator<(const Timezone &other) const { return TimeZoneName < other.TimeZoneName; } bool operator<(const Timezone &other) const { return TimeZoneName < other.TimeZoneName; }
// database name // database name
static const char * GetDBName() { return "Time Zones"; } static const char * GetDBName() { return "Time Zones"; }
static uint8_t GetDefaultRecType() { return 2; } static uint8_t GetDefaultRecType() { return 2; }
}; };
inline std::ostream& operator<<(std::ostream &os, const Timezone &msg) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Timezone & msg) {
msg.Dump(os); msg.Dump(os);
return os; return os;
} }
} // namespace Barry } // namespace Barry
#endif /* __BARRY_RECORD_TIMEZONE_H__*/ #endif /* __BARRY_RECORD_TIMEZONE_H__*/
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 record.h   record.h 
skipping to change at line 30 skipping to change at line 30
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_RECORD_H__ #ifndef __BARRY_RECORD_H__
#define __BARRY_RECORD_H__ #define __BARRY_RECORD_H__
#include "dll.h"
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdint.h> #include <stdint.h>
// forward declarations // forward declarations
namespace Barry { class Data; } namespace Barry { class Data; }
namespace Barry { namespace Barry {
// //
// NOTE: All classes here must be container-safe! Perhaps add sorting // NOTE: All classes here must be container-safe! Perhaps add sorting
// operators in the future. // operators in the future.
// //
struct CommandTableCommand struct BXEXPORT CommandTableCommand
{ {
unsigned int Code; unsigned int Code;
std::string Name; std::string Name;
}; };
class CommandTable class BXEXPORT CommandTable
{ {
public: public:
typedef CommandTableCommand Command; typedef CommandTableCommand Command;
typedef std::vector<Command> CommandArrayType; typedef std::vector<Command> CommandArrayType;
CommandArrayType Commands; CommandArrayType Commands;
private: private:
const unsigned char* ParseField(const unsigned char *begin, BXLOCAL const unsigned char* ParseField(const unsigned char *begin,
const unsigned char *end); const unsigned char *end);
public: public:
CommandTable(); CommandTable();
~CommandTable(); ~CommandTable();
void Parse(const Data &data, size_t offset); void Parse(const Data &data, size_t offset);
void Clear(); void Clear();
// returns 0 if unable to find command name, which is safe, since // returns 0 if unable to find command name, which is safe, since
// 0 is a special command that shouldn't be in the table anyway // 0 is a special command that shouldn't be in the table anyway
unsigned int GetCommand(const std::string &name) const; unsigned int GetCommand(const std::string &name) const;
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
}; };
inline std::ostream& operator<< (std::ostream &os, const CommandTable &comm and) { BXEXPORT inline std::ostream& operator<< (std::ostream &os, const CommandTa ble &command) {
command.Dump(os); command.Dump(os);
return os; return os;
} }
struct RecordStateTableState struct BXEXPORT RecordStateTableState
{ {
unsigned int Index; unsigned int Index;
uint32_t RecordId; uint32_t RecordId;
bool Dirty; bool Dirty;
unsigned int RecType; unsigned int RecType;
std::string Unknown2; std::string Unknown2;
}; };
class RecordStateTable class BXEXPORT RecordStateTable
{ {
public: public:
typedef RecordStateTableState State; typedef RecordStateTableState State;
typedef unsigned int IndexType; typedef unsigned int IndexType;
typedef std::map<IndexType, State> StateMapType; typedef std::map<IndexType, State> StateMapType;
StateMapType StateMap; StateMapType StateMap;
private: private:
mutable IndexType m_LastNewRecordId; mutable IndexType m_LastNewRecordId;
private: private:
const unsigned char* ParseField(const unsigned char *begin, BXLOCAL const unsigned char* ParseField(const unsigned char *begin,
const unsigned char *end); const unsigned char *end);
public: public:
RecordStateTable(); RecordStateTable();
~RecordStateTable(); ~RecordStateTable();
void Parse(const Data &data); void Parse(const Data &data);
void Clear(); void Clear();
bool GetIndex(uint32_t RecordId, IndexType *pFoundIndex = 0) const; bool GetIndex(uint32_t RecordId, IndexType *pFoundIndex = 0) const;
uint32_t MakeNewRecordId() const; uint32_t MakeNewRecordId() const;
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
}; };
inline std::ostream& operator<< (std::ostream &os, const RecordStateTable & rst) { BXEXPORT inline std::ostream& operator<< (std::ostream &os, const RecordSta teTable &rst) {
rst.Dump(os); rst.Dump(os);
return os; return os;
} }
struct DatabaseItem struct BXEXPORT DatabaseItem
{ {
unsigned int Number; unsigned int Number;
unsigned int RecordCount; unsigned int RecordCount;
std::string Name; std::string Name;
}; };
class DatabaseDatabase class BXEXPORT DatabaseDatabase
{ {
public: public:
typedef DatabaseItem Database; typedef DatabaseItem Database;
typedef std::vector<Database> DatabaseArrayType; typedef std::vector<Database> DatabaseArrayType;
DatabaseArrayType Databases; DatabaseArrayType Databases;
private: private:
template <class RecordType, class FieldType> template <class RecordType, class FieldType>
void ParseRec(const RecordType &rec, const unsigned char *end); void ParseRec(const RecordType &rec, const unsigned char *end);
skipping to change at line 162 skipping to change at line 163
void Parse(const Data &data); void Parse(const Data &data);
void Clear(); void Clear();
// returns true on success, and fills target // returns true on success, and fills target
bool GetDBNumber(const std::string &name, unsigned int &number) cons t; bool GetDBNumber(const std::string &name, unsigned int &number) cons t;
bool GetDBName(unsigned int number, std::string &name) const; bool GetDBName(unsigned int number, std::string &name) const;
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
}; };
inline std::ostream& operator<<(std::ostream &os, const DatabaseDatabase &d bdb) { BXEXPORT inline std::ostream& operator<<(std::ostream &os, const DatabaseDa tabase &dbdb) {
dbdb.Dump(os); dbdb.Dump(os);
return os; return os;
} }
struct UnknownField struct UnknownData
{
std::string raw_data;
const std::string::value_type* data() const { return raw_data.data()
; }
std::string::size_type size() const { return raw_data.size(); }
void assign(const std::string::value_type *s, std::string::size_type
n)
{ raw_data.assign(s, n); }
};
struct BXEXPORT UnknownField
{ {
uint8_t type; uint8_t type;
std::string data; UnknownData data;
}; };
std::ostream& operator<< (std::ostream &os, const std::vector<UnknownField> &unknowns); BXEXPORT std::ostream& operator<< (std::ostream &os, const std::vector<Unkn ownField> &unknowns);
struct EmailAddress struct BXEXPORT EmailAddress
{ {
std::string Name; std::string Name;
std::string Email; std::string Email;
void clear() void clear()
{ {
Name.clear(); Name.clear();
Email.clear(); Email.clear();
} }
}; };
std::ostream& operator<<(std::ostream &os, const EmailAddress &msga); BXEXPORT std::ostream& operator<<(std::ostream &os, const EmailAddress &msg a);
struct PostalAddress struct BXEXPORT PostalAddress
{ {
std::string std::string
Address1, Address1,
Address2, Address2,
Address3, Address3,
City, City,
Province, Province,
PostalCode, PostalCode,
Country; Country;
std::string GetLabel() const; std::string GetLabel() const;
void Clear(); void Clear();
bool HasData() const { return Address1.size() || Address2.size() || bool HasData() const { return Address1.size() || Address2.size() ||
Address3.size() || City.size() || Province.size() || Address3.size() || City.size() || Province.size() ||
PostalCode.size() || Country.size(); } PostalCode.size() || Country.size(); }
}; };
std::ostream& operator<<(std::ostream &os, const PostalAddress &msga); BXEXPORT std::ostream& operator<<(std::ostream &os, const PostalAddress &ms ga);
/// \addtogroup RecordParserClasses /// \addtogroup RecordParserClasses
/// Parser and data storage classes. These classes take a /// Parser and data storage classes. These classes take a
/// Database Database record and convert them into C++ objects. /// Database Database record and convert them into C++ objects.
/// Each of these classes are safe to be used in standard /// Each of these classes are safe to be used in standard
/// containers, and are meant to be used in conjunction with the /// containers, and are meant to be used in conjunction with the
/// RecordParser<> template when calling Controller::LoadDatabas e(). /// RecordParser<> template when calling Controller::LoadDatabas e().
/// @{ /// @{
/// @} /// @}
 End of changes. 19 change blocks. 
18 lines changed or deleted 31 lines changed or added


 s11n-boost.h   s11n-boost.h 
skipping to change at line 52 skipping to change at line 52
#define BARRY_POD_MAP_VERSION 1000 #define BARRY_POD_MAP_VERSION 1000
// namespace boost::serialization, for the non-intrusive version // namespace boost::serialization, for the non-intrusive version
namespace boost { namespace boost {
namespace serialization { namespace serialization {
template <class ArchiveT> template <class ArchiveT>
void serialize(ArchiveT &ar, Barry::UnknownField &uf, const unsigned int ve r) void serialize(ArchiveT &ar, Barry::UnknownField &uf, const unsigned int ve r)
{ {
ar & make_nvp("type", uf.type); ar & make_nvp("type", uf.type);
ar & make_nvp("data", uf.data); ar & make_nvp("data", uf.data.raw_data);
} }
template <class ArchiveT> template <class ArchiveT>
void serialize(ArchiveT &ar, Barry::Contact::GroupLink &g, const unsigned i nt ver) void serialize(ArchiveT &ar, Barry::Contact::GroupLink &g, const unsigned i nt ver)
{ {
ar & make_nvp("Link", g.Link); ar & make_nvp("Link", g.Link);
ar & make_nvp("Unknown", g.Unknown); ar & make_nvp("Unknown", g.Unknown);
} }
template <class ArchiveT> template <class ArchiveT>
void serialize(ArchiveT &ar, Barry::Contact &c, const unsigned int ver) void serialize(ArchiveT &ar, Barry::Contact &c, const unsigned int ver)
{ {
ar & make_nvp("RecType", c.RecType); ar & make_nvp("RecType", c.RecType);
ar & make_nvp("RecordId", c.RecordId); ar & make_nvp("RecordId", c.RecordId);
ar & make_nvp("Email", c.Email); ar & make_nvp("EmailAddresses", c.EmailAddresses);
ar & make_nvp("Phone", c.Phone); ar & make_nvp("Phone", c.Phone);
ar & make_nvp("Fax", c.Fax); ar & make_nvp("Fax", c.Fax);
ar & make_nvp("WorkPhone", c.WorkPhone); ar & make_nvp("WorkPhone", c.WorkPhone);
ar & make_nvp("HomePhone", c.HomePhone); ar & make_nvp("HomePhone", c.HomePhone);
ar & make_nvp("MobilePhone", c.MobilePhone); ar & make_nvp("MobilePhone", c.MobilePhone);
ar & make_nvp("Pager", c.Pager); ar & make_nvp("Pager", c.Pager);
ar & make_nvp("PIN", c.PIN); ar & make_nvp("PIN", c.PIN);
ar & make_nvp("Radio", c.Radio); ar & make_nvp("Radio", c.Radio);
ar & make_nvp("WorkPhone2", c.WorkPhone2); ar & make_nvp("WorkPhone2", c.WorkPhone2);
ar & make_nvp("HomePhone2", c.HomePhone2); ar & make_nvp("HomePhone2", c.HomePhone2);
skipping to change at line 159 skipping to change at line 159
ar & make_nvp("Unknowns", m.Unknowns); ar & make_nvp("Unknowns", m.Unknowns);
} }
} }
template <class ArchiveT> template <class ArchiveT>
void serialize(ArchiveT &ar, Barry::Calendar &c, const unsigned int ver) void serialize(ArchiveT &ar, Barry::Calendar &c, const unsigned int ver)
{ {
ar & make_nvp("RecType", c.RecType); ar & make_nvp("RecType", c.RecType);
ar & make_nvp("RecordId", c.RecordId); ar & make_nvp("RecordId", c.RecordId);
ar & make_nvp("Recurring", c.Recurring);
ar & make_nvp("AllDayEvent", c.AllDayEvent); ar & make_nvp("AllDayEvent", c.AllDayEvent);
ar & make_nvp("Subject", c.Subject); ar & make_nvp("Subject", c.Subject);
ar & make_nvp("Notes", c.Notes); ar & make_nvp("Notes", c.Notes);
ar & make_nvp("Location", c.Location); ar & make_nvp("Location", c.Location);
ar & make_nvp("NotificationTime", c.NotificationTime); ar & make_nvp("NotificationTime", c.NotificationTime);
ar & make_nvp("StartTime", c.StartTime); ar & make_nvp("StartTime", c.StartTime);
ar & make_nvp("EndTime", c.EndTime); ar & make_nvp("EndTime", c.EndTime);
ar & make_nvp("FreeBusyFlag", c.FreeBusyFlag); ar & make_nvp("FreeBusyFlag", c.FreeBusyFlag);
ar & make_nvp("ClassFlag", c.ClassFlag); ar & make_nvp("ClassFlag", c.ClassFlag);
ar & make_nvp("Recurring", c.Recurring); ar & make_nvp("Recurring", c.Recurring);
ar & make_nvp("RecurringType", c.RecurringType); ar & make_nvp("RecurringType", c.RecurringType);
ar & make_nvp("Interval", c.Interval); ar & make_nvp("Interval", c.Interval);
ar & make_nvp("RecurringEndTime", c.RecurringEndTime); ar & make_nvp("RecurringEndTime", c.RecurringEndTime);
ar & make_nvp("Perpetual", c.Perpetual); ar & make_nvp("Perpetual", c.Perpetual);
ar & make_nvp("TimeZoneCode", c.TimeZoneCode); ar & make_nvp("TimeZoneCode", c.TimeZoneCode);
ar & make_nvp("TimeZoneValid", c.TimeZoneValid);
ar & make_nvp("DayOfWeek", c.DayOfWeek);
ar & make_nvp("WeekOfMonth", c.WeekOfMonth);
ar & make_nvp("DayOfMonth", c.DayOfMonth);
ar & make_nvp("MonthOfYear", c.MonthOfYear);
ar & make_nvp("WeekDays", c.WeekDays);
if( ver < BARRY_POD_MAP_VERSION ) { if( ver < BARRY_POD_MAP_VERSION ) {
ar & make_nvp("Unknowns", c.Unknowns); ar & make_nvp("Unknowns", c.Unknowns);
} }
} }
template <class ArchiveT> template <class ArchiveT>
void serialize(ArchiveT &ar, Barry::ServiceBookConfig &c, const unsigned in t ver) void serialize(ArchiveT &ar, Barry::ServiceBookConfig &c, const unsigned in t ver)
{ {
ar & make_nvp("Format", c.Format); ar & make_nvp("Format", c.Format);
 End of changes. 4 change blocks. 
3 lines changed or deleted 9 lines changed or added


 socket.h   socket.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_SOCKET_H__ #ifndef __BARRY_SOCKET_H__
#define __BARRY_SOCKET_H__ #define __BARRY_SOCKET_H__
#include "dll.h"
#include <stdint.h> #include <stdint.h>
#include <queue>
#include <memory>
#include "router.h"
// forward declarations // forward declarations
namespace Usb { class Device; } namespace Usb { class Device; }
namespace Barry { class Data; class Packet; } namespace Barry {
class Data;
class Packet;
class SocketRoutingQueue;
}
namespace Barry { namespace Barry {
class Socket;
typedef std::auto_ptr<Socket> SocketHandle;
class BXEXPORT SocketZero
{
friend class Socket;
Usb::Device *m_dev;
SocketRoutingQueue *m_queue;
int m_writeEp, m_readEp;
uint8_t m_zeroSocketSequence;
uint32_t m_sequenceId;
// half open socket stata, for passwords
bool m_halfOpen;
uint32_t m_challengeSeed;
unsigned int m_remainingTries;
private:
static void AppendFragment(Data &whole, const Data &fragment);
static unsigned int MakeNextFragment(const Data &whole, Data &fragme
nt,
unsigned int offset = 0);
void CheckSequence(uint16_t socket, const Data &seq);
void SendOpen(uint16_t socket, Data &receive);
void SendPasswordHash(uint16_t socket, const char *password, Data &r
eceive);
// Raw send and receive functions, used for all low level
// communication to the USB level.
void RawSend(Data &send, int timeout = -1);
void RawReceive(Data &receive, int timeout = -1);
protected:
bool SequencePacket(const Data &data);
public:
explicit SocketZero(SocketRoutingQueue &queue, int writeEndpoint,
uint8_t zeroSocketSequenceStart = 0);
SocketZero(Usb::Device &dev, int writeEndpoint, int readEndpoint,
uint8_t zeroSocketSequenceStart = 0);
~SocketZero();
uint8_t GetZeroSocketSequence() const { return m_zeroSocketSequence;
}
void SetRoutingQueue(SocketRoutingQueue &queue);
void UnlinkRoutingQueue();
// Send functions for socket 0 only.
// These functions will overwrite:
// - the zeroSocketSequence byte *inside* the packet
// - the socket number to 0
//
void Send(Data &send, int timeout = -1); // send only
void Send(Data &send, Data &receive, int timeout = -1); // send+recv
void Send(Barry::Packet &packet, int timeout = -1);
// void Receive(Data &receive, int timeout = -1);
// Opens a new socket and returns a Socket object to manage it
SocketHandle Open(uint16_t socket, const char *password = 0);
void Close(Socket &socket);
};
// //
// Socket class // Socket class
// //
/// Encapsulates a "logical socket" in the Blackberry USB protocol. /// Encapsulates a "logical socket" in the Blackberry USB protocol.
/// By default, provides raw send/receive access, as well as packet /// By default, provides raw send/receive access, as well as packet
/// writing on socket 0, which is always open. /// writing on socket 0, which is always open.
/// ///
/// There are Open and Close members to open data sockets which are used /// There are Open and Close members to open data sockets which are used
/// to transfer data to and from the device. /// to transfer data to and from the device.
/// ///
/// The destructor will close any non-0 open sockets automatically. /// The destructor will close any non-0 open sockets automatically.
/// ///
/// Requires an active Usb::Device object to work on. /// Requires an active Usb::Device object to work on.
/// ///
class Socket class BXEXPORT Socket
{ {
Usb::Device &m_dev; friend class SocketZero;
int m_writeEp, m_readEp;
uint16_t m_socket; // defaults to 0, which is valid,
// since socket 0 is always open
// If this is not 0, then class will
// deal with closing automatically.
uint8_t m_zeroSocketSequence;
uint8_t m_flag;
uint32_t m_sequenceId;
// half open socket stata, for passwords SocketZero *m_zero;
bool m_halfOpen; uint16_t m_socket;
uint32_t m_challengeSeed; uint8_t m_closeFlag;
unsigned int m_remainingTries;
private: bool m_registered;
// sends 'send' data to device, and waits for response, using
// "read first, write second" order observed in capture protected:
void AppendFragment(Data &whole, const Data &fragment);
unsigned int MakeNextFragment(const Data &whole, Data &fragment, uns
igned int offset = 0);
void CheckSequence(const Data &seq); void CheckSequence(const Data &seq);
void ForceClosed();
void SendOpen(uint16_t socket, Data &receive); Socket(SocketZero &zero, uint16_t socket, uint8_t closeFlag);
void SendPasswordHash(uint16_t socket, const char *password, Data &r
eceive);
public: public:
Socket(Usb::Device &dev, int writeEndpoint, int readEndpoint,
uint8_t zeroSocketSequenceStart = 0);
~Socket(); ~Socket();
uint16_t GetSocket() const { return m_socket; } uint16_t GetSocket() const { return m_socket; }
uint8_t GetZeroSocketSequence() const { return m_zeroSocketSequence; } uint8_t GetCloseFlag() const { return m_closeFlag; }
void Open(uint16_t socket, const char *password = 0);
void Close(); void Close();
// Send and Receive are available before Open... // Send and Receive are available before Open...
// an unopened socket defaults to socket 0, which you need // an unopened socket defaults to socket 0, which you need
// in order to set the blackberry mode // in order to set the blackberry mode
// The send function will overwrite the zeroSocketSequence byte // The send function will overwrite the zeroSocketSequence byte
// *inside* the packet, if the current m_socket is 0. // *inside* the packet, if the current m_socket is 0.
void Send(Data &send, int timeout = -1); // send only void Send(Data &send, int timeout = -1); // send only
void Send(Data &send, Data &receive, int timeout = -1); // send+recv void Send(Data &send, Data &receive, int timeout = -1); // send+recv
void Send(Barry::Packet &packet, int timeout = -1); void Send(Barry::Packet &packet, int timeout = -1);
skipping to change at line 104 skipping to change at line 161
// sends the send packet down to the device, fragmenting if // sends the send packet down to the device, fragmenting if
// necessary, and returns the response in receive, defragmenting // necessary, and returns the response in receive, defragmenting
// if needed // if needed
// Blocks until response received or timed out in Usb::Device // Blocks until response received or timed out in Usb::Device
void Packet(Data &send, Data &receive, int timeout = -1); void Packet(Data &send, Data &receive, int timeout = -1);
void Packet(Barry::Packet &packet, int timeout = -1); void Packet(Barry::Packet &packet, int timeout = -1);
// some handy wrappers for the Packet() interface // some handy wrappers for the Packet() interface
void NextRecord(Data &receive); void NextRecord(Data &receive);
// Register a callback for incoming data from the device.
// This function assumes that this socket is based on a socketZero
// that has a SocketRoutingQueue, otherwise throws logic_error.
void RegisterInterest(SocketRoutingQueue::SocketDataHandler handler,
void *context);
void UnregisterInterest();
}; };
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 14 change blocks. 
28 lines changed or deleted 93 lines changed or added


 time.h   time.h 
skipping to change at line 27 skipping to change at line 27
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_TIME_H__ #ifndef __BARRY_TIME_H__
#define __BARRY_TIME_H__ #define __BARRY_TIME_H__
#include "dll.h"
#include <time.h> #include <time.h>
#include <stdint.h> #include <stdint.h>
// //
// Calculate the number of minutes between Jan 01, 1900 and Jan 01, 1970 // Calculate the number of minutes between Jan 01, 1900 and Jan 01, 1970
// //
// There are 17 leap years between 1900 and 1970 // There are 17 leap years between 1900 and 1970
// (1969-1900) / 4 = 17.25 // (1969-1900) / 4 = 17.25
// //
// 1900 itself is not a leap year (not divisible by 400) // 1900 itself is not a leap year (not divisible by 400)
skipping to change at line 51 skipping to change at line 52
#define YEAR_COUNT (1970 - 1900) #define YEAR_COUNT (1970 - 1900)
// therefore, the difference between standard C's time and min1900_t's // therefore, the difference between standard C's time and min1900_t's
// time in minutes: // time in minutes:
#define STDC_MIN1900_DIFF (YEAR_COUNT * YEAR_MINUTES + LEAP_YEAR_COUNT * DA Y_MINUTES) #define STDC_MIN1900_DIFF (YEAR_COUNT * YEAR_MINUTES + LEAP_YEAR_COUNT * DA Y_MINUTES)
namespace Barry { namespace Barry {
typedef long min1900_t; typedef long min1900_t;
min1900_t time2min(time_t t); BXEXPORT min1900_t time2min(time_t t);
time_t min2time(min1900_t m); BXEXPORT time_t min2time(min1900_t m);
// FIXME - turn TimeZone into a C typedef and wrap this in extern "C" // FIXME - turn TimeZone into a C typedef and wrap this in extern "C"
// so the data can be used in both C and C++ libraries // so the data can be used in both C and C++ libraries
struct TimeZone struct BXEXPORT TimeZone
{ {
unsigned short Code; unsigned short Code;
signed short HourOffset; signed short HourOffset;
signed short MinOffset; signed short MinOffset;
char *Name; const char *Name;
}; };
// FIXME - put this somewhere for both C and C++ // FIXME - put this somewhere for both C and C++
#define TIME_ZONE_CODE_ERR 0xffff #define TIME_ZONE_CODE_ERR 0xffff
const TimeZone* GetTimeZoneTable(); BXEXPORT const TimeZone* GetTimeZoneTable();
const TimeZone* GetTimeZone(unsigned short Code); BXEXPORT const TimeZone* GetTimeZone(unsigned short Code);
unsigned short GetTimeZoneCode(signed short HourOffset, BXEXPORT unsigned short GetTimeZoneCode(signed short HourOffset,
signed short MinOffset = 0); signed short MinOffset = 0);
// Message time conversion stuff // Message time conversion stuff
time_t DayToDate( unsigned short Day ); BXEXPORT time_t DayToDate( unsigned short Day );
time_t Message2Time(uint16_t r_date, uint16_t r_time); BXEXPORT time_t Message2Time(uint16_t r_date, uint16_t r_time);
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 6 change blocks. 
9 lines changed or deleted 10 lines changed or added


 usbwrap.h   usbwrap.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __SB_USBWRAP_H__ #ifndef __SB_USBWRAP_H__
#define __SB_USBWRAP_H__ #define __SB_USBWRAP_H__
#include "dll.h"
#include <usb.h> #include <usb.h>
#include <vector> #include <vector>
#include <map> #include <map>
#include "error.h" #include "error.h"
#define USBWRAP_DEFAULT_TIMEOUT 30000 #define USBWRAP_DEFAULT_TIMEOUT 30000
namespace Barry { class Data; } namespace Barry { class Data; }
/// Namespace for the libusb-related wrapper classes. This namespace /// Namespace for the libusb-related wrapper classes. This namespace
/// may change in the future. /// may change in the future.
namespace Usb { namespace Usb {
/// \addtogroup exceptions /// \addtogroup exceptions
/// @{ /// @{
/// Thrown on low level USB errors. /// Thrown on low level USB errors.
class Error : public Barry::Error class BXEXPORT Error : public Barry::Error
{ {
int m_libusb_errcode; int m_libusb_errcode;
public: public:
Error(const std::string &str); Error(const std::string &str);
Error(int libusb_errcode, const std::string &str); Error(int libusb_errcode, const std::string &str);
// can return 0 in some case, if unknown error code // can return 0 in some case, if unknown error code
int libusb_errcode() const { return m_libusb_errcode; } int libusb_errcode() const { return m_libusb_errcode; }
}; };
class Timeout : public Error class BXEXPORT Timeout : public Error
{ {
public: public:
Timeout(const std::string &str) : Error(str) {} Timeout(const std::string &str) : Error(str) {}
Timeout(int libusb_errcode, const std::string &str) Timeout(int libusb_errcode, const std::string &str)
: Error(libusb_errcode, str) {} : Error(libusb_errcode, str) {}
}; };
/// @} /// @}
/// Typedefs used by the wrapper class, in the hope to make it /// Typedefs used by the wrapper class, in the hope to make it
/// easier to switch from libusb stable to devel and back. /// easier to switch from libusb stable to devel and back.
typedef struct usb_device* DeviceIDType; typedef struct usb_device* DeviceIDType;
typedef struct usb_dev_handle* DeviceHandleType; typedef struct usb_dev_handle* DeviceHandleType;
class Match class BXEXPORT Match
{ {
private: private:
struct usb_bus *m_busses; struct usb_bus *m_busses;
struct usb_device *m_dev; struct usb_device *m_dev;
int m_vendor, m_product; int m_vendor, m_product;
int m_lasterror; int m_lasterror;
const char *m_busname; const char *m_busname;
const char *m_devname; const char *m_devname;
protected: protected:
static bool ToNum(const char *str, long &num); static bool ToNum(const char *str, long &num);
skipping to change at line 92 skipping to change at line 93
Match(int vendor, int product, Match(int vendor, int product,
const char *busname = 0, const char *devname = 0); const char *busname = 0, const char *devname = 0);
~Match(); ~Match();
// searches for next match, and if found, fills devid with // searches for next match, and if found, fills devid with
// something you can pass on to DeviceDiscover, etc // something you can pass on to DeviceDiscover, etc
// returns true if next is found, false if no more // returns true if next is found, false if no more
bool next_device(Usb::DeviceIDType *devid); bool next_device(Usb::DeviceIDType *devid);
}; };
class Device class BXEXPORT Device
{ {
private: private:
Usb::DeviceIDType m_id; Usb::DeviceIDType m_id;
Usb::DeviceHandleType m_handle; Usb::DeviceHandleType m_handle;
int m_timeout; int m_timeout;
int m_lasterror; int m_lasterror;
public: public:
Device(Usb::DeviceIDType id, int timeout = USBWRAP_DEFAULT_TIMEOUT); Device(Usb::DeviceIDType id, int timeout = USBWRAP_DEFAULT_TIMEOUT);
~Device(); ~Device();
///////////////////////////// /////////////////////////////
// Data access // Data access
Usb::DeviceIDType GetID() const { return m_id; } Usb::DeviceIDType GetID() const { return m_id; }
Usb::DeviceHandleType GetHandle() const { return m_handle; } Usb::DeviceHandleType GetHandle() const { return m_handle; }
int GetLastError() const { return m_lasterror; } int GetLastError() const { return m_lasterror; } //< not thread safe
...
//< use the error code stored in the exceptions to track
//< errors in threaded usage
///////////////////////////// /////////////////////////////
// Device manipulation // Device manipulation
bool SetConfiguration(unsigned char cfg); bool SetConfiguration(unsigned char cfg);
bool ClearHalt(int ep); bool ClearHalt(int ep);
bool Reset(); bool Reset();
///////////////////////////// /////////////////////////////
// IO functions // IO functions
bool BulkRead(int ep, Barry::Data &data, int timeout = -1); bool BulkRead(int ep, Barry::Data &data, int timeout = -1);
bool BulkWrite(int ep, const Barry::Data &data, int timeout = -1); bool BulkWrite(int ep, const Barry::Data &data, int timeout = -1);
bool BulkWrite(int ep, const void *data, size_t size, int timeout = -1); bool BulkWrite(int ep, const void *data, size_t size, int timeout = -1);
bool InterruptRead(int ep, Barry::Data &data, int timeout = -1); bool InterruptRead(int ep, Barry::Data &data, int timeout = -1);
bool InterruptWrite(int ep, const Barry::Data &data, int timeout = - 1); bool InterruptWrite(int ep, const Barry::Data &data, int timeout = - 1);
void BulkDrain(int ep); void BulkDrain(int ep, int timeout = 100);
///////////////////////////// /////////////////////////////
// Combo functions // Combo functions
bool GetConfiguration(unsigned char &cfg); bool GetConfiguration(unsigned char &cfg);
}; };
class Interface class BXEXPORT Interface
{ {
Device &m_dev; Device &m_dev;
int m_iface; int m_iface;
public: public:
Interface(Device &dev, int iface); Interface(Device &dev, int iface);
~Interface(); ~Interface();
}; };
// Map of Endpoint numbers (not indexes) to endpoint descriptors // Map of Endpoint numbers (not indexes) to endpoint descriptors
struct EndpointPair struct BXEXPORT EndpointPair
{ {
unsigned char read; unsigned char read;
unsigned char write; unsigned char write;
unsigned char type; unsigned char type;
EndpointPair() : read(0), write(0), type(0xff) {} EndpointPair() : read(0), write(0), type(0xff) {}
bool IsTypeSet() const { return type != 0xff; } bool IsTypeSet() const { return type != 0xff; }
bool IsComplete() const { return read && write && IsTypeSet(); } bool IsComplete() const { return read && write && IsTypeSet(); }
}; };
class EndpointDiscovery : public std::map<unsigned char, usb_endpoint_descr iptor> class BXEXPORT EndpointDiscovery : public std::map<unsigned char, usb_endpo int_descriptor>
{ {
friend class InterfaceDiscovery; friend class InterfaceDiscovery;
public: public:
typedef std::map<unsigned char, usb_endpoint_descriptor>base_type; typedef std::map<unsigned char, usb_endpoint_descriptor>base_type;
typedef std::vector<EndpointPair> endpoint_arr ay_type; typedef std::vector<EndpointPair> endpoint_arr ay_type;
private: private:
bool m_valid; bool m_valid;
endpoint_array_type m_endpoints; endpoint_array_type m_endpoints;
bool Discover(struct usb_interface_descriptor *interface, int epcoun t); BXLOCAL bool Discover(struct usb_interface_descriptor *interface, in t epcount);
public: public:
EndpointDiscovery() : m_valid(false) {} EndpointDiscovery() : m_valid(false) {}
bool IsValid() const { return m_valid; } bool IsValid() const { return m_valid; }
const endpoint_array_type & GetEndpointPairs() const { return m_endp oints; } const endpoint_array_type & GetEndpointPairs() const { return m_endp oints; }
}; };
// Map of Interface numbers (not indexes) to interface descriptors and endp oint map // Map of Interface numbers (not indexes) to interface descriptors and endp oint map
struct InterfaceDesc struct BXEXPORT InterfaceDesc
{ {
usb_interface_descriptor desc; usb_interface_descriptor desc;
EndpointDiscovery endpoints; EndpointDiscovery endpoints;
}; };
class InterfaceDiscovery : public std::map<int, InterfaceDesc> class BXEXPORT InterfaceDiscovery : public std::map<int, InterfaceDesc>
{ {
public: public:
typedef std::map<int, InterfaceDesc> base_type; typedef std::map<int, InterfaceDesc> base_type;
private: private:
bool m_valid; bool m_valid;
bool DiscoverInterface(struct usb_interface *interface); BXLOCAL bool DiscoverInterface(struct usb_interface *interface);
public: public:
InterfaceDiscovery() : m_valid(false) {} InterfaceDiscovery() : m_valid(false) {}
bool Discover(Usb::DeviceIDType devid, int cfgidx, int ifcount); bool Discover(Usb::DeviceIDType devid, int cfgidx, int ifcount);
bool IsValid() const { return m_valid; } bool IsValid() const { return m_valid; }
}; };
// Map of Config numbers (not indexes) to config descriptors and interface map // Map of Config numbers (not indexes) to config descriptors and interface map
struct ConfigDesc struct BXEXPORT ConfigDesc
{ {
usb_config_descriptor desc; usb_config_descriptor desc;
InterfaceDiscovery interfaces; InterfaceDiscovery interfaces;
}; };
class ConfigDiscovery : public std::map<unsigned char, ConfigDesc> class BXEXPORT ConfigDiscovery : public std::map<unsigned char, ConfigDesc>
{ {
public: public:
typedef std::map<unsigned char, ConfigDesc> base_type; typedef std::map<unsigned char, ConfigDesc> base_type;
private: private:
bool m_valid; bool m_valid;
public: public:
ConfigDiscovery() : m_valid(false) {} ConfigDiscovery() : m_valid(false) {}
bool Discover(Usb::DeviceIDType devid, int cfgcount); bool Discover(Usb::DeviceIDType devid, int cfgcount);
bool IsValid() const { return m_valid; } bool IsValid() const { return m_valid; }
}; };
// Discovers all configurations, interfaces, and endpoints for a given devi ce // Discovers all configurations, interfaces, and endpoints for a given devi ce
class DeviceDiscovery class BXEXPORT DeviceDiscovery
{ {
bool m_valid; bool m_valid;
public: public:
usb_device_descriptor desc; usb_device_descriptor desc;
ConfigDiscovery configs; ConfigDiscovery configs;
public: public:
DeviceDiscovery(Usb::DeviceIDType devid); DeviceDiscovery(Usb::DeviceIDType devid);
 End of changes. 17 change blocks. 
16 lines changed or deleted 20 lines changed or added


 version.h   version.h 
skipping to change at line 25 skipping to change at line 25
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the See the GNU General Public License in the COPYING file at the
root directory of this project for more details. root directory of this project for more details.
*/ */
#ifndef __BARRY_VERSION_H__ #ifndef __BARRY_VERSION_H__
#define __BARRY_VERSION_H__ #define __BARRY_VERSION_H__
#include "dll.h"
namespace Barry { namespace Barry {
const char* Version(int &major, int &minor); BXEXPORT const char* Version(int &major, int &minor);
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 2 change blocks. 
1 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/