barry.h   barry.h 
skipping to change at line 41 skipping to change at line 41
#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 "socket.h" #include "socket.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 "controller.h" #include "controller.h"
#include "controllertmpl.h" #include "controllertmpl.h"
#include "version.h" #include "version.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>
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 common.h   common.h 
skipping to change at line 27 skipping to change at line 27
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__
#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 0x0006 #define PRODUCT_RIM_PEARL 0x0006
#define BLACKBERRY_INTERFACE 0
#define BLACKBERRY_CONFIGURATION 1 #define BLACKBERRY_CONFIGURATION 1
#define BLACKBERRY_DB_CLASS 0xff
namespace Barry { namespace Barry {
void Init(bool data_dump_mode = false); void Init(bool data_dump_mode = false);
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 3 change blocks. 
1 lines changed or deleted 2 lines changed or added


 controller.h   controller.h 
skipping to change at line 38 skipping to change at line 38
#include "record.h" #include "record.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 Parser;
class Builder; class Builder;
class DBPacket;
// //
// 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.
/// ///
/// 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
skipping to change at line 60 skipping to change at line 61
/// - Call OpenMode() to select the desired mode. This will fill all /// - Call OpenMode() to select the desired mode. This will fill all
/// internal data structures for that mode, such as the /// internal data structures for that mode, such as the
/// Database Database in Desktop mode. /// Database Database in Desktop mode.
/// NOTE: only Desktop mode is currently implemented. /// NOTE: only Desktop mode is currently implemented.
/// - Call GetDBDB() to get the device's database database /// - Call GetDBDB() to get the device's database database
/// - Call GetDBID() to get a database ID by name /// - Call GetDBID() to get a database ID by name
/// - In Desktop mode, call LoadDatabase() to retrieve and store a datab ase /// - In Desktop mode, call LoadDatabase() to retrieve and store a datab ase
/// ///
class Controller class Controller
{ {
friend class Barry::Packet; friend class Barry::DBPacket;
public: public:
/// Handheld mode type /// Handheld mode type
enum ModeType { enum ModeType {
Unspecified, //< default on start up Unspecified, //< default on start up
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
}; };
skipping to change at line 85 skipping to change at line 86
Usb::Interface *m_iface; Usb::Interface *m_iface;
uint32_t m_pin; uint32_t m_pin;
Socket m_socket; Socket m_socket;
CommandTable m_commandTable; CommandTable m_commandTable;
DatabaseDatabase m_dbdb; DatabaseDatabase m_dbdb;
ModeType m_mode; ModeType m_mode;
uint16_t m_modeSocket; // socket recommended by dev
ice
// when mode was selected
protected: protected:
void SelectMode(ModeType mode, uint16_t &socket, uint8_t &flag); void SelectMode(ModeType mode);
unsigned int GetCommand(CommandType ct); unsigned int GetCommand(CommandType ct);
void LoadCommandTable(); void LoadCommandTable();
void LoadDBDB(); void LoadDBDB();
public: public:
Controller(const ProbeResult &device); Controller(const ProbeResult &device);
~Controller(); ~Controller();
////////////////////////////////// //////////////////////////////////
// meta access // meta access
/// Returns DatabaseDatabase object for this connection. /// Returns DatabaseDatabase object for this connection.
/// Must call OpenMode() to select Desktop mode first /// Must call OpenMode() to select Desktop mode first
const DatabaseDatabase& GetDBDB() const { return m_dbdb; } const DatabaseDatabase& GetDBDB() const { return m_dbdb; }
unsigned int GetDBID(const std::string &name) const; unsigned int GetDBID(const std::string &name) const;
////////////////////////////////// //////////////////////////////////
// general operations // general operations
void OpenMode(ModeType mode); void OpenMode(ModeType mode, const char *password = 0);
void RetryPassword(const char *password);
////////////////////////////////// //////////////////////////////////
// Desktop mode - database specific // Desktop mode - database specific
// dirty flag related functions, for sync operations // dirty flag related functions, for sync operations
void GetRecordStateTable(unsigned int dbId, RecordStateTable &result ); void GetRecordStateTable(unsigned int dbId, RecordStateTable &result );
void AddRecord(unsigned int dbId, Builder &build); // RecordId is void AddRecord(unsigned int dbId, Builder &build); // RecordId is
// retrieved from build, and duplicate IDs are allowed, // retrieved from build, and duplicate IDs are allowed,
// but *not* recommended! // but *not* recommended!
void GetRecord(unsigned int dbId, unsigned int stateTableIndex, Pars er &parser); void GetRecord(unsigned int dbId, unsigned int stateTableIndex, Pars er &parser);
 End of changes. 5 change blocks. 
3 lines changed or deleted 9 lines changed or added


 controllertmpl.h   controllertmpl.h 
skipping to change at line 60 skipping to change at line 60
template <class StorageT> template <class StorageT>
void Controller::LoadDatabaseByName(const std::string &name, StorageT &stor e) void Controller::LoadDatabaseByName(const std::string &name, StorageT &stor e)
{ {
if( name == Contact::GetDBName() ) if( name == Contact::GetDBName() )
LoadDatabaseByType<Contact>(store); LoadDatabaseByType<Contact>(store);
else if( name == Message::GetDBName() ) else if( name == Message::GetDBName() )
LoadDatabaseByType<Message>(store); LoadDatabaseByType<Message>(store);
else if( name == Calendar::GetDBName() ) else if( name == Calendar::GetDBName() )
LoadDatabaseByType<Calendar>(store); LoadDatabaseByType<Calendar>(store);
else else
throw BError("Unknown database name in LoadDatabaseByName: " + name); throw Error("Unknown database name in LoadDatabaseByName: " + name);
} }
template <class StorageT> template <class StorageT>
void Controller::SaveDatabaseByName(const std::string &name, StorageT &stor e) void Controller::SaveDatabaseByName(const std::string &name, StorageT &stor e)
{ {
if( name == Contact::GetDBName() ) if( name == Contact::GetDBName() )
SaveDatabaseByType<Contact>(store); SaveDatabaseByType<Contact>(store);
else if( name == Message::GetDBName() ) else if( name == Message::GetDBName() )
SaveDatabaseByType<Message>(store); SaveDatabaseByType<Message>(store);
else if( name == Calendar::GetDBName() ) else if( name == Calendar::GetDBName() )
SaveDatabaseByType<Calendar>(store); SaveDatabaseByType<Calendar>(store);
else else
throw BError("Unknown database name in SaveDatabaseByName: " + name); throw Error("Unknown database name in SaveDatabaseByName: " + name);
} }
template <class RecordT> template <class RecordT>
void Controller::AddRecordByType(uint32_t recordId, const RecordT &rec) void Controller::AddRecordByType(uint32_t recordId, const RecordT &rec)
{ {
unsigned int dbId = this->GetDBID( RecordT::GetDBName() ); unsigned int dbId = this->GetDBID( RecordT::GetDBName() );
// FIXME - I know this is a convenience template, but it still // FIXME - I know this is a convenience template, but it still
// hurts making a temporary copy just to set the record ID... // hurts making a temporary copy just to set the record ID...
// create a better API for this. // create a better API for this.
RecordT r = rec; RecordT r = rec;
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 data.h   data.h 
skipping to change at line 68 skipping to change at line 68
int GetEndpoint() const { return m_endpoint; } int GetEndpoint() const { return m_endpoint; }
const unsigned char * GetData() const { return m_external ? m_extern alData : m_data; } const unsigned char * GetData() const { return m_external ? m_extern alData : m_data; }
size_t GetSize() const { return m_datasize; } size_t GetSize() const { return m_datasize; }
unsigned char * GetBuffer(size_t requiredsize = 0); unsigned char * GetBuffer(size_t requiredsize = 0);
size_t GetBufSize() const { return m_bufsize; } size_t GetBufSize() const { return m_bufsize; }
void ReleaseBuffer(int datasize = -1); void ReleaseBuffer(int datasize = -1);
void AppendHexString(const char *str);
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); std::istream& operator>> (std::istream &is, Data &data);
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 error.h   error.h 
skipping to change at line 33 skipping to change at line 33
#define __BARRY_ERROR_H__ #define __BARRY_ERROR_H__
#include <stdexcept> #include <stdexcept>
namespace Barry { namespace Barry {
/// \addtogroup exceptions /// \addtogroup exceptions
/// @{ /// @{
// //
// BError class // Error class
// //
/// Currently the only Barry exception class, and planned to be the base cl /// The base class for any future derived exceptions.
ass /// Can be thrown on any protocol error.
/// for any future derived exceptions. Thrown on any protocol error.
/// ///
class BError : public std::runtime_error class Error : public std::runtime_error
{ {
public: public:
BError(const std::string &str) : std::runtime_error(str) {} Error(const std::string &str) : std::runtime_error(str) {}
BError(int libusb_errno, const std::string &str); Error(int libusb_errno, const std::string &str);
};
//
// BadPassword
//
/// A bad or unknown password when talking to the device.
/// Can be thrown in the following instances:
///
/// - no password provided and the device requests one
/// - device rejected the available password
/// - too few remaining tries left... Barry will refuse to keep
/// trying passwords if there are fewer than
/// 6 tries remaining
///
///
class BadPassword : public Barry::Error
{
int m_remaining_tries;
public:
BadPassword(const std::string &str, int remaining_tries)
: Barry::Error(str),
m_remaining_tries(remaining_tries)
{}
int remaining_tries() const { return m_remaining_tries; }
}; };
/// @} /// @}
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 4 change blocks. 
7 lines changed or deleted 31 lines changed or added


 probe.h   probe.h 
skipping to change at line 35 skipping to change at line 35
#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 ProbeResult
{ {
Usb::DeviceIDType m_dev; Usb::DeviceIDType m_dev;
unsigned char m_interface;
uint32_t m_pin; uint32_t m_pin;
Usb::EndpointPair m_ep; Usb::EndpointPair m_ep;
uint8_t m_zeroSocketSequence;
}; };
std::ostream& operator<< (std::ostream &os, const ProbeResult &pr); std::ostream& operator<< (std::ostream &os, const ProbeResult &pr);
class Probe class Probe
{ {
std::vector<ProbeResult> m_results; std::vector<ProbeResult> m_results;
bool Parse(const Data &data, ProbeResult &result); bool Parse(const Data &data, ProbeResult &result);
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 protocol.h   protocol.h 
skipping to change at line 26 skipping to change at line 26
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_PROTOCOL_H__ #ifndef __BARRY_PROTOCOL_H__
#define __BARRY_PROTOCOL_H__ #define __BARRY_PROTOCOL_H__
// packet commands (Packet.command: has response codes too) // packet commands (Packet.command: has response codes too)
#define SB_COMMAND_FETCH_ATTRIBUTE 0x05
#define SB_COMMAND_FETCHED_ATTRIBUTE 0x06
#define SB_COMMAND_SELECT_MODE 0x07 #define SB_COMMAND_SELECT_MODE 0x07
#define SB_COMMAND_MODE_SELECTED 0x08 #define SB_COMMAND_MODE_SELECTED 0x08
#define SB_COMMAND_OPEN_SOCKET 0x0a #define SB_COMMAND_OPEN_SOCKET 0x0a
#define SB_COMMAND_CLOSE_SOCKET 0x0b #define SB_COMMAND_CLOSE_SOCKET 0x0b
#define SB_COMMAND_CLOSED_SOCKET 0x0c #define SB_COMMAND_CLOSED_SOCKET 0x0c
#define SB_COMMAND_PASSWORD_CHALLENGE 0x0e
#define SB_COMMAND_PASSWORD 0x0f
#define SB_COMMAND_OPENED_SOCKET 0x10 #define SB_COMMAND_OPENED_SOCKET 0x10
#define SB_COMMAND_PASSWORD_FAILED 0x11
#define SB_COMMAND_SEQUENCE_HANDSHAKE 0x13 #define SB_COMMAND_SEQUENCE_HANDSHAKE 0x13
#define SB_COMMAND_DB_DATA 0x40 #define SB_COMMAND_DB_DATA 0x40
#define SB_COMMAND_DB_FRAGMENTED 0x60 #define SB_COMMAND_DB_FRAGMENTED 0x60
#define SB_COMMAND_DB_DONE 0x41 #define SB_COMMAND_DB_DONE 0x41
// mode constants // mode constants
#define SB_MODE_REQUEST_SOCKET 0x00ff #define SB_MODE_REQUEST_SOCKET 0x00ff
// object and attribute ID codes (for ZeroPacket::GetAttribute())
// meanings for most of these are unknown
#define SB_OBJECT_INITIAL_UNKNOWN 0x14
#define SB_ATTR_INITIAL_UNKNOWN 0x01
#define SB_OBJECT_PROFILE 0x08
#define SB_ATTR_PROFILE_PIN 0x04
#define SB_OBJECT_SOCKET_UNKNOWN 0x04
// param command parameters // param command parameters
//#define SB_PARAM_DEFAULT 0xff //#define SB_PARAM_DEFAULT 0xff
// DB Operation Command // DB Operation Command
#define SB_DBOP_SET_RECORD 0x41 #define SB_DBOP_SET_RECORD 0x41
#define SB_DBOP_CLEAR_DATABASE 0x43 #define SB_DBOP_CLEAR_DATABASE 0x43
#define SB_DBOP_GET_DBDB 0x4a #define SB_DBOP_GET_DBDB 0x4a
#define SB_DBOP_OLD_GET_DBDB 0x4c #define SB_DBOP_OLD_GET_DBDB 0x4c
#define SB_DBOP_GET_COUNT 0x4e #define SB_DBOP_GET_COUNT 0x4e
#define SB_DBOP_GET_RECORDS 0x4f #define SB_DBOP_GET_RECORDS 0x4f
 End of changes. 4 change blocks. 
0 lines changed or deleted 13 lines changed or added


 record.h   record.h 
skipping to change at line 246 skipping to change at line 246
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;
void Clear(); // erase everything void Clear(); // erase everything
void Dump(std::ostream &os) const; void Dump(std::ostream &os) const;
void DumpLdif(std::ostream &os, const std::string &baseDN) const;
bool ReadLdif(std::istream &is); // returns true on success
// sorting - put group links at the end // sorting - put group links at the end
bool operator<(const Contact &other) const { bool operator<(const Contact &other) const {
return GroupLinks.size() == 0 && other.GroupLinks.size() > 0 ; return GroupLinks.size() == 0 && other.GroupLinks.size() > 0 ;
// // testing - put group links at the top // // testing - put group links at the top
// return GroupLinks.size() > 0 && other.GroupLinks.size() == 0 ; // return GroupLinks.size() > 0 && other.GroupLinks.size() == 0 ;
} }
// database name // database name
static const char * GetDBName() { return "Address Book"; } static const char * GetDBName() { return "Address Book"; }
 End of changes. 1 change blocks. 
2 lines changed or deleted 0 lines changed or added


 socket.h   socket.h 
skipping to change at line 55 skipping to change at line 55
/// Requires an active Usb::Device object to work on. /// Requires an active Usb::Device object to work on.
/// ///
class Socket class Socket
{ {
Usb::Device &m_dev; Usb::Device &m_dev;
int m_writeEp, m_readEp; int m_writeEp, m_readEp;
uint16_t m_socket; // defaults to 0, which is valid, uint16_t m_socket; // defaults to 0, which is valid,
// since socket 0 is always open // since socket 0 is always open
// If this is not 0, then class will // If this is not 0, then class will
// deal with closing automatically. // deal with closing automatically.
uint8_t m_zeroSocketSequence;
uint8_t m_flag; uint8_t m_flag;
uint32_t m_sequenceId; uint32_t m_sequenceId;
int m_lastStatus; // half open socket stata, for passwords
bool m_halfOpen;
uint32_t m_challengeSeed;
unsigned int m_remainingTries;
private: private:
// sends 'send' data to device, and waits for response, using // sends 'send' data to device, and waits for response, using
// "read first, write second" order observed in capture // "read first, write second" order observed in capture
void AppendFragment(Data &whole, const Data &fragment); void AppendFragment(Data &whole, const Data &fragment);
unsigned int MakeNextFragment(const Data &whole, Data &fragment, uns igned int offset = 0); unsigned int MakeNextFragment(const Data &whole, Data &fragment, uns igned int offset = 0);
void CheckSequence(const Data &seq); void CheckSequence(const Data &seq);
void SendOpen(uint16_t socket, Data &receive);
void SendPasswordHash(uint16_t socket, const char *password, Data &r
eceive);
public: public:
Socket(Usb::Device &dev, int writeEndpoint, int readEndpoint); Socket(Usb::Device &dev, int writeEndpoint, int readEndpoint,
uint8_t zeroSocketSequenceStart = 0);
~Socket(); ~Socket();
int GetLastStatus() const { return m_lastStatus; }
uint16_t GetSocket() const { return m_socket; } uint16_t GetSocket() const { return m_socket; }
uint8_t GetZeroSocketSequence() const { return m_zeroSocketSequence; }
void Open(uint16_t socket, uint8_t flag); 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
bool Send(const Data &send, Data &receive, int timeout = -1); // The send function will overwrite the zeroSocketSequence byte
bool Receive(Data &receive, int timeout = -1); // *inside* the packet, if the current m_socket is 0.
void Send(Data &send, Data &receive, int timeout = -1);
void Send(Barry::Packet &packet, int timeout = -1);
void Receive(Data &receive, int timeout = -1);
// 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
bool Packet(const Data &send, Data &receive, int timeout = -1); void Packet(Data &send, Data &receive, int timeout = -1);
bool 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
bool NextRecord(Data &receive); void NextRecord(Data &receive);
}; };
} // namespace Barry } // namespace Barry
#endif #endif
 End of changes. 10 change blocks. 
9 lines changed or deleted 21 lines changed or added


 usbwrap.h   usbwrap.h 
skipping to change at line 28 skipping to change at line 28
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 <usb.h> #include <usb.h>
#include <vector> #include <vector>
#include <map> #include <map>
#include <stdexcept> #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 UsbError : public std::runtime_error class Error : public Barry::Error
{ {
public: public:
UsbError(const std::string &str) : std::runtime_error(str) {} Error(const std::string &str) : Barry::Error(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 Match
skipping to change at line 107 skipping to change at line 107
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);
}; };
class Interface class 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)
: m_dev(dev), m_iface(iface) : m_dev(dev), m_iface(iface)
{ {
if( usb_claim_interface(dev.GetHandle(), iface) < 0 ) if( usb_claim_interface(dev.GetHandle(), iface) < 0 )
throw UsbError("claim interface failed"); throw Error("claim interface failed");
} }
~Interface() ~Interface()
{ {
usb_release_interface(m_dev.GetHandle(), m_iface); usb_release_interface(m_dev.GetHandle(), m_iface);
} }
}; };
// Map of Endpoint numbers (not indexes) to endpoint descriptors // Map of Endpoint numbers (not indexes) to endpoint descriptors
struct EndpointPair struct EndpointPair
 End of changes. 5 change blocks. 
4 lines changed or deleted 6 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/