| builder.h | | builder.h | |
| /// | | /// | |
| /// \file builder.h | | /// \file builder.h | |
| /// Virtual protocol packet builder wrapper | | /// Virtual protocol packet builder wrapper | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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. | |
| | | | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| 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 "dll.h" | | #include "dll.h" | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
|
| | | // forward declarations | |
| | | class IConverter; | |
| | | | |
| // | | // | |
| // 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 BXEXPORT Builder | | class BXEXPORT Builder | |
| { | | { | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 65 | |
| /// Called before BuildFields() in order to build the header | | /// Called before BuildFields() in order to build the header | |
| /// for this record. Store the raw data in data, at the | | /// for this record. Store the raw data in data, at the | |
| /// offset given in offset. When finished, update offset to | | /// offset given in offset. When finished, update offset to | |
| /// point to the next spot to put new data. | | /// point to the next spot to put new data. | |
| virtual void BuildHeader(Data &data, size_t &offset) = 0; | | virtual void BuildHeader(Data &data, size_t &offset) = 0; | |
| | | | |
| /// Called to build the record field data. Store the raw data | | /// Called to build the record field data. Store the raw data | |
| /// in data, using offset to know where to write. Be sure to | | /// in data, using offset to know where to write. Be sure to | |
| /// update offset, and be sure to adjust the size of the data | | /// update offset, and be sure to adjust the size of the data | |
| /// packet (possibly with Data::ReleaseBuffer()). | | /// packet (possibly with Data::ReleaseBuffer()). | |
|
| virtual void BuildFields(Data &data, size_t &offset) = 0; | | virtual void BuildFields(Data &data, size_t &offset, | |
| | | const IConverter *ic) = 0; | |
| }; | | }; | |
| | | | |
| // | | // | |
| // RecordBuilder template class | | // RecordBuilder template class | |
| // | | // | |
| /// Template class for easy creation of specific protocol packet builder | | /// Template class for easy creation of specific protocol packet builder | |
| /// objects. This template takes the following template arguments: | | /// objects. This template takes the following template arguments: | |
| /// | | /// | |
| /// - RecordT: One of the record classes in record.h | | /// - RecordT: One of the record classes in record.h | |
| /// - StorageT: A custom storage functor class. An object of this type | | /// - StorageT: A custom storage functor class. An object of this type | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 136 | |
| return m_rec.GetUniqueId(); | | return m_rec.GetUniqueId(); | |
| } | | } | |
| | | | |
| /// Functor member called by Controller::SaveDatabase() during | | /// Functor member called by Controller::SaveDatabase() during | |
| /// processing. | | /// processing. | |
| virtual void BuildHeader(Data &data, size_t &offset) | | virtual void BuildHeader(Data &data, size_t &offset) | |
| { | | { | |
| m_rec.BuildHeader(data, offset); | | m_rec.BuildHeader(data, offset); | |
| } | | } | |
| | | | |
|
| virtual void BuildFields(Data &data, size_t &offset) | | virtual void BuildFields(Data &data, size_t &offset, const IConverte
r *ic) | |
| { | | { | |
|
| m_rec.BuildFields(data, offset); | | m_rec.BuildFields(data, offset, ic); | |
| } | | } | |
| }; | | }; | |
| | | | |
| // | | // | |
| // RecordFetch template class | | // RecordFetch template class | |
| // | | // | |
| /// Generic record fetch class, to help with using records without | | /// Generic record fetch class, to help with using records without | |
| /// builder classes. | | /// builder classes. | |
| /// | | /// | |
| template <class RecordT> | | template <class RecordT> | |
| | | | |
End of changes. 5 change blocks. |
| 4 lines changed or deleted | | 8 lines changed or added | |
|
| error.h | | error.h | |
| /// | | /// | |
| /// \file error.h | | /// \file error.h | |
| /// Common exception classes for the Barry library | | /// Common exception classes for the Barry library | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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 "dll.h" | |
| #include <stdexcept> | | #include <stdexcept> | |
|
| | | #include <stdint.h> | |
| | | | |
| 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. | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 101 | |
| // BadSize | | // BadSize | |
| // | | // | |
| /// Unexpected packet size, or not enough data. | | /// Unexpected packet size, or not enough data. | |
| /// | | /// | |
| class BXEXPORT 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; | |
| | | | |
|
| | | BXLOCAL static std::string GetMsg(const char *msg, unsigned int d, u
nsigned int r); | |
| BXLOCAL static std::string GetMsg(unsigned int p, unsigned int d, un
signed int r); | | BXLOCAL static std::string GetMsg(unsigned int p, unsigned int d, un
signed int r); | |
| | | | |
| public: | | public: | |
|
| | | BadSize(const char *msg, unsigned int data_size, unsigned int requir | |
| | | ed_size) | |
| | | : Barry::Error(GetMsg(msg, data_size, required_size)) | |
| | | , m_packet_size(0) | |
| | | , m_data_buf_size(data_size) | |
| | | , m_required_size(required_size) | |
| | | {} | |
| 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 | | : Barry::Error(GetMsg(packet_size, data_buf_size, required_s | |
| ize)), | | 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 | | // ErrnoError | |
| // | | // | |
| /// System error that provides an errno error code. | | /// System error that provides an errno error code. | |
| /// | | /// | |
|
| class ErrnoError : public Barry::Error | | class BXEXPORT ErrnoError : public Barry::Error | |
| { | | { | |
| int m_errno; | | int m_errno; | |
| | | | |
| static std::string GetMsg(const std::string &msg, int err); | | static std::string GetMsg(const std::string &msg, int err); | |
| | | | |
| public: | | public: | |
| ErrnoError(const std::string &msg, int err) | | ErrnoError(const std::string &msg, int err) | |
| : Barry::Error(GetMsg(msg, err)) | | : Barry::Error(GetMsg(msg, err)) | |
| , m_errno(err) | | , m_errno(err) | |
| {} | | {} | |
| | | | |
| int error_code() const { return m_errno; } | | int error_code() const { return m_errno; } | |
| }; | | }; | |
| | | | |
|
| | | // | |
| | | // BadPackedFormat | |
| | | // | |
| | | /// Thrown by record classes that don't recognize a given packed format cod | |
| | | e. | |
| | | /// This exception is mostly handled internally, but is published here | |
| | | /// just in case it escapes. | |
| | | /// | |
| | | class BXEXPORT BadPackedFormat : public Barry::Error | |
| | | { | |
| | | uint8_t m_format; | |
| | | | |
| | | public: | |
| | | BadPackedFormat(uint8_t format) | |
| | | : Barry::Error("Bad packed format - internal exception") | |
| | | , m_format(format) | |
| | | {} | |
| | | | |
| | | uint8_t format() const { return m_format; } | |
| | | }; | |
| | | | |
| | | // | |
| | | // BadPacket | |
| | | // | |
| | | /// Thrown by the socket class if a packet command's response indicates | |
| | | /// an error. Some commands may be able to recover inside the library, | |
| | | /// so a special exception is used, that includes the response code. | |
| | | /// | |
| | | class BXEXPORT BadPacket : public Barry::Error | |
| | | { | |
| | | uint8_t m_response; | |
| | | | |
| | | public: | |
| | | BadPacket(uint8_t response, const std::string &msg) | |
| | | : Barry::Error(msg) | |
| | | , m_response(response) | |
| | | {} | |
| | | | |
| | | uint8_t response() const { return m_response; } | |
| | | }; | |
| | | | |
| /// @} | | /// @} | |
| | | | |
| } // namespace Barry | | } // namespace Barry | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 7 lines changed or deleted | | 57 lines changed or added | |
|
| ldif.h | | ldif.h | |
| /// | | /// | |
| /// \file ldif.h | | /// \file ldif.h | |
| /// Routines for reading and writing LDAP LDIF data. | | /// Routines for reading and writing LDAP LDIF data. | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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. | |
| | | | |
| | | | |
| skipping to change at line 168 | | skipping to change at line 168 | |
| virtual std::string Fax(const Barry::Contact &con) const; | | virtual std::string Fax(const Barry::Contact &con) const; | |
| virtual std::string WorkPhone(const Barry::Contact &con) const; | | virtual std::string WorkPhone(const Barry::Contact &con) const; | |
| virtual std::string HomePhone(const Barry::Contact &con) const; | | virtual std::string HomePhone(const Barry::Contact &con) const; | |
| virtual std::string MobilePhone(const Barry::Contact &con) const; | | virtual std::string MobilePhone(const Barry::Contact &con) const; | |
| virtual std::string Pager(const Barry::Contact &con) const; | | virtual std::string Pager(const Barry::Contact &con) const; | |
| virtual std::string PIN(const Barry::Contact &con) const; | | virtual std::string PIN(const Barry::Contact &con) const; | |
| virtual std::string FirstName(const Barry::Contact &con) const; | | virtual std::string FirstName(const Barry::Contact &con) const; | |
| virtual std::string LastName(const Barry::Contact &con) const; | | virtual std::string LastName(const Barry::Contact &con) const; | |
| virtual std::string Company(const Barry::Contact &con) const; | | virtual std::string Company(const Barry::Contact &con) const; | |
| virtual std::string DefaultCommunicationsMethod(const Barry::Contact
&con) const; | | virtual std::string DefaultCommunicationsMethod(const Barry::Contact
&con) const; | |
|
| virtual std::string Address1(const Barry::Contact &con) const; | | virtual std::string WorkAddress1(const Barry::Contact &con) const; | |
| virtual std::string Address2(const Barry::Contact &con) const; | | virtual std::string WorkAddress2(const Barry::Contact &con) const; | |
| virtual std::string Address3(const Barry::Contact &con) const; | | virtual std::string WorkAddress3(const Barry::Contact &con) const; | |
| virtual std::string City(const Barry::Contact &con) const; | | virtual std::string WorkCity(const Barry::Contact &con) const; | |
| virtual std::string Province(const Barry::Contact &con) const; | | virtual std::string WorkProvince(const Barry::Contact &con) const; | |
| virtual std::string PostalCode(const Barry::Contact &con) const; | | virtual std::string WorkPostalCode(const Barry::Contact &con) const; | |
| virtual std::string Country(const Barry::Contact &con) const; | | virtual std::string WorkCountry(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 WorkPostalAddress(const Barry::Contact &con) con | |
| | | st; | |
| | | virtual std::string HomePostalAddress(const Barry::Contact &con) con | |
| | | st; | |
| 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 | | // Array modifier functions for above Access functions | |
| // | | // | |
| | | | |
| virtual bool IsArrayFunc(GetFunctionType getf) const; | | virtual bool IsArrayFunc(GetFunctionType getf) const; | |
| void ClearArrayState() const; | | void ClearArrayState() const; | |
| | | | |
| | | | |
| skipping to change at line 206 | | skipping to change at line 207 | |
| 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; | |
| virtual void SetPIN(Barry::Contact &con, const std::string &val) con
st; | | virtual void SetPIN(Barry::Contact &con, const std::string &val) con
st; | |
| virtual void SetFirstName(Barry::Contact &con, const std::string &va
l) const; | | virtual void SetFirstName(Barry::Contact &con, const std::string &va
l) const; | |
| virtual void SetLastName(Barry::Contact &con, const std::string &val
) const; | | virtual void SetLastName(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetCompany(Barry::Contact &con, const std::string &val)
const; | | virtual void SetCompany(Barry::Contact &con, const std::string &val)
const; | |
| virtual void SetDefaultCommunicationsMethod(Barry::Contact &con, con
st std::string &val) const; | | virtual void SetDefaultCommunicationsMethod(Barry::Contact &con, con
st std::string &val) const; | |
|
| virtual void SetAddress1(Barry::Contact &con, const std::string &val | | virtual void SetWorkAddress1(Barry::Contact &con, const std::string | |
| ) const; | | &val) const; | |
| virtual void SetAddress2(Barry::Contact &con, const std::string &val | | virtual void SetWorkAddress2(Barry::Contact &con, const std::string | |
| ) const; | | &val) const; | |
| virtual void SetAddress3(Barry::Contact &con, const std::string &val | | virtual void SetWorkAddress3(Barry::Contact &con, const std::string | |
| ) const; | | &val) const; | |
| virtual void SetCity(Barry::Contact &con, const std::string &val) co | | virtual void SetWorkCity(Barry::Contact &con, const std::string &val | |
| nst; | | ) const; | |
| virtual void SetProvince(Barry::Contact &con, const std::string &val | | virtual void SetWorkProvince(Barry::Contact &con, const std::string | |
| ) const; | | &val) const; | |
| virtual void SetPostalCode(Barry::Contact &con, const std::string &v | | virtual void SetWorkPostalCode(Barry::Contact &con, const std::strin | |
| al) const; | | g &val) const; | |
| virtual void SetCountry(Barry::Contact &con, const std::string &val) | | virtual void SetWorkCountry(Barry::Contact &con, const std::string & | |
| const; | | val) const; | |
| virtual void SetJobTitle(Barry::Contact &con, const std::string &val
) const; | | virtual void SetJobTitle(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetPublicKey(Barry::Contact &con, const std::string &va
l) const; | | virtual void SetPublicKey(Barry::Contact &con, const std::string &va
l) const; | |
| virtual void SetNotes(Barry::Contact &con, const std::string &val) c
onst; | | virtual void SetNotes(Barry::Contact &con, const std::string &val) c
onst; | |
|
| virtual void SetPostalAddress(Barry::Contact &con, const std::string | | virtual void SetWorkPostalAddress(Barry::Contact &con, const std::st | |
| &val) const; | | ring &val) const; | |
| | | virtual void SetHomePostalAddress(Barry::Contact &con, const std::st | |
| | | ring &val) const; | |
| virtual void SetFullName(Barry::Contact &con, const std::string &val
) const; | | virtual void SetFullName(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetFQDN(Barry::Contact &con, const std::string &val) co
nst; | | virtual void SetFQDN(Barry::Contact &con, const std::string &val) co
nst; | |
| | | | |
| // | | // | |
| // Name heuristics | | // Name heuristics | |
| // | | // | |
| | | | |
| virtual void ClearHeuristics(); | | virtual void ClearHeuristics(); | |
| virtual bool RunHeuristics(Barry::Contact &con); | | virtual bool RunHeuristics(Barry::Contact &con); | |
| | | | |
| | | | |
End of changes. 5 change blocks. |
| 25 lines changed or deleted | | 30 lines changed or added | |
|
| m_desktop.h | | m_desktop.h | |
| /// | | /// | |
| /// \file m_desktop.h | | /// \file m_desktop.h | |
| /// Mode class for the Desktop mode | | /// Mode class for the Desktop mode | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2007, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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_M_DESKTOP_H__ | | #ifndef __BARRY_M_DESKTOP_H__ | |
| #define __BARRY_M_DESKTOP_H__ | | #define __BARRY_M_DESKTOP_H__ | |
| | | | |
| #include "dll.h" | | #include "dll.h" | |
|
| | | #include "m_mode_base.h" | |
| #include "socket.h" | | #include "socket.h" | |
| #include "record.h" | | #include "record.h" | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
| // forward declarations | | // forward declarations | |
| class Parser; | | class Parser; | |
| class Builder; | | class Builder; | |
|
| class Controller; | | class IConverter; | |
| | | | |
| namespace Mode { | | namespace Mode { | |
| | | | |
| // | | // | |
| // Desktop class | | // Desktop class | |
| // | | // | |
| /// The main interface class to the device databases. | | /// The main interface class to the device databases. | |
| /// | | /// | |
| /// To use this class, use the following steps: | | /// To use this class, use the following steps: | |
| /// | | /// | |
| /// - Create a Controller object (see Controller class for more details) | | /// - Create a Controller object (see Controller class for more details) | |
| /// - Create this Mode::Desktop object, passing in the Controller | | /// - Create this Mode::Desktop object, passing in the Controller | |
| /// object during construction | | /// object during construction | |
| /// - Call Open() to open database socket and finish constructing. | | /// - Call Open() to open database socket and finish constructing. | |
| /// - 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 | |
| /// - Call LoadDatabase() to retrieve and store a database | | /// - Call LoadDatabase() to retrieve and store a database | |
| /// | | /// | |
|
| class BXEXPORT Desktop | | class BXEXPORT Desktop : public Mode | |
| { | | { | |
| public: | | public: | |
| enum CommandType { Unknown, DatabaseAccess }; | | enum CommandType { Unknown, DatabaseAccess }; | |
| | | | |
| private: | | private: | |
|
| Controller &m_con; | | | |
| | | | |
| SocketHandle m_socket; | | | |
| | | | |
| CommandTable m_commandTable; | | CommandTable m_commandTable; | |
| DatabaseDatabase m_dbdb; | | DatabaseDatabase m_dbdb; | |
| | | | |
|
| uint16_t m_ModeSocket; // socket recommended by dev | | // external objects (optional, can be null) | |
| ice | | const IConverter *m_ic; | |
| // when mode was selected | | | |
| | | | |
| protected: | | protected: | |
| void LoadCommandTable(); | | void LoadCommandTable(); | |
| void LoadDBDB(); | | void LoadDBDB(); | |
| | | | |
|
| | | ////////////////////////////////// | |
| | | // overrides | |
| | | | |
| | | virtual void OnOpen(); | |
| | | | |
| public: | | public: | |
| Desktop(Controller &con); | | Desktop(Controller &con); | |
|
| | | Desktop(Controller &con, const IConverter &ic); | |
| ~Desktop(); | | ~Desktop(); | |
| | | | |
| ////////////////////////////////// | | ////////////////////////////////// | |
|
| // primary operations - required before anything else | | | |
| | | | |
| void Open(const char *password = 0); | | | |
| void RetryPassword(const char *password); | | | |
| | | | |
| ////////////////////////////////// | | | |
| // meta access | | // meta access | |
| | | | |
| /// Returns DatabaseDatabase object for this connection. | | /// Returns DatabaseDatabase object for this connection. | |
| /// Must call Open() first, which loads the DBDB. | | /// Must call Open() first, which loads the DBDB. | |
| 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; | |
| unsigned int GetDBCommand(CommandType ct); | | unsigned int GetDBCommand(CommandType ct); | |
| | | | |
|
| | | void SetIConverter(const IConverter &ic); | |
| | | | |
| ////////////////////////////////// | | ////////////////////////////////// | |
| // 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); | |
| void SetRecord(unsigned int dbId, unsigned int stateTableIndex, Buil
der &build); | | void SetRecord(unsigned int dbId, unsigned int stateTableIndex, Buil
der &build); | |
| void ClearDirty(unsigned int dbId, unsigned int stateTableIndex); | | void ClearDirty(unsigned int dbId, unsigned int stateTableIndex); | |
| void DeleteRecord(unsigned int dbId, unsigned int stateTableIndex); | | void DeleteRecord(unsigned int dbId, unsigned int stateTableIndex); | |
| | | | |
| // pure load/save operations | | // pure load/save operations | |
| void LoadDatabase(unsigned int dbId, Parser &parser); | | void LoadDatabase(unsigned int dbId, Parser &parser); | |
|
| | | void ClearDatabase(unsigned int dbId); | |
| void SaveDatabase(unsigned int dbId, Builder &builder); | | void SaveDatabase(unsigned int dbId, Builder &builder); | |
| | | | |
| template <class RecordT, class StorageT> void LoadDatabaseByType(Sto
rageT &store); | | template <class RecordT, class StorageT> void LoadDatabaseByType(Sto
rageT &store); | |
| template <class RecordT, class StorageT> void SaveDatabaseByType(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 LoadDatabaseByName(const std::string
&name, StorageT &store); | |
| template <class StorageT> void SaveDatabaseByName(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); | | template <class RecordT> void AddRecordByType(uint32_t recordId, con
st RecordT &rec); | |
| | | | |
| | | | |
End of changes. 11 change blocks. |
| 16 lines changed or deleted | | 15 lines changed or added | |
|
| parser.h | | parser.h | |
| /// | | /// | |
| /// \file parser.h | | /// \file parser.h | |
| /// Virtual parser wrapper | | /// Virtual parser wrapper | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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. | |
| | | | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| | | | |
| #ifndef __BARRY_PARSER_H__ | | #ifndef __BARRY_PARSER_H__ | |
| #define __BARRY_PARSER_H__ | | #define __BARRY_PARSER_H__ | |
| | | | |
| #include "dll.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; | |
| | | class IConverter; | |
| | | } | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
|
| // also acts as a null parser | | | |
| // | | // | |
| // Parser class | | // Parser class | |
| // | | // | |
|
| /// Base class for the parser hierarchy. If in debug mode, this | | /// Base class for the parser hierarchy. | |
| /// class can be used as a null parser. Call Init() and the protocol | | | |
| /// 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. | |
| /// | | /// | |
|
| | | /// This class is kept as a pure abstract class, in order to make sure | |
| | | /// that the compiler will catch any API changes, for code derived | |
| | | /// from it. | |
| | | /// | |
| class BXEXPORT 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() = 0; | |
| | | | |
| | | /// Stores the IDs | |
| | | virtual void SetIds(uint8_t RecType, uint32_t UniqueId) = 0; | |
| | | | |
| | | /// Called to parse the header portion of the raw data packet. | |
| | | /// data contains the entire packet, and offset contains the | |
| | | /// location at which to start parsing. | |
| | | virtual void ParseHeader(const Data &data, size_t &offset) = 0; | |
| | | | |
| | | /// Called to parse sub fields in the raw data packet. | |
| | | /// The same data is passed as was passed in ParseHeader, | |
| | | /// only the offset will be updated if it was advanced during | |
| | | /// the header parsing. | |
| | | virtual void ParseFields(const Data &data, size_t &offset, | |
| | | const IConverter *ic) = 0; | |
| | | | |
| | | /// Called at the very end of record parsing, and used to | |
| | | /// store the final packet somewhere, either in memory, disk, etc. | |
| | | virtual void Store() = 0; | |
| | | }; | |
| | | | |
| | | // | |
| | | // NullParser class | |
| | | // | |
| | | /// If in debug mode, this class can be used as a null parser. | |
| | | /// Call Init() and the protocol will be dumped to stdout and | |
| | | /// no parsing will be done. | |
| | | /// | |
| | | /// Do NOT derive your own personal parser classes from this, | |
| | | /// unless you are perfectly confident that you will catch | |
| | | /// future API changes on the devel tree without the compiler's | |
| | | /// help. | |
| | | /// | |
| | | class BXEXPORT NullParser : public Parser | |
| | | { | |
| | | public: | |
| | | NullParser() {} | |
| | | virtual ~NullParser() {} | |
| | | | |
| | | /// 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) {} | |
| | | | |
| /// Called to parse the header portion of the raw data packet. | | /// Called to parse the header portion of the raw data packet. | |
| /// data contains the entire packet, and offset contains the | | /// data contains the entire packet, and offset contains the | |
| /// location at which to start parsing. | | /// location at which to start parsing. | |
| virtual void ParseHeader(const Data &data, size_t &offset) {} | | virtual void ParseHeader(const Data &data, size_t &offset) {} | |
| | | | |
| /// Called to parse sub fields in the raw data packet. | | /// Called to parse sub fields in the raw data packet. | |
| /// The same data is passed as was passed in ParseHeader, | | /// The same data is passed as was passed in ParseHeader, | |
| /// only the offset will be updated if it was advanced during | | /// only the offset will be updated if it was advanced during | |
| /// the header parsing. | | /// the header parsing. | |
|
| virtual void ParseFields(const Data &data, size_t &offset) {} | | virtual void ParseFields(const Data &data, size_t &offset, | |
| | | const IConverter *ic) {} | |
| | | | |
| /// Called at the very end of record parsing, and used to | | /// Called at the very end of record parsing, and used to | |
| /// store the final packet somewhere, either in memory, disk, etc. | | /// store the final packet somewhere, either in memory, disk, etc. | |
| virtual void Store() {} | | virtual void Store() {} | |
| }; | | }; | |
| | | | |
| // | | // | |
| // RecordParser template class | | // RecordParser template class | |
| // | | // | |
| /// Template class for easy creation of specific parser objects. This temp
late | | /// Template class for easy creation of specific parser objects. This temp
late | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 195 | |
| virtual void SetIds(uint8_t RecType, uint32_t UniqueId) | | virtual void SetIds(uint8_t RecType, uint32_t UniqueId) | |
| { | | { | |
| m_rec.SetIds(RecType, UniqueId); | | m_rec.SetIds(RecType, UniqueId); | |
| } | | } | |
| | | | |
| virtual void ParseHeader(const Data &data, size_t &offset) | | virtual void ParseHeader(const Data &data, size_t &offset) | |
| { | | { | |
| m_rec.ParseHeader(data, offset); | | m_rec.ParseHeader(data, offset); | |
| } | | } | |
| | | | |
|
| virtual void ParseFields(const Data &data, size_t &offset) | | virtual void ParseFields(const Data &data, size_t &offset, | |
| | | const IConverter *ic) | |
| { | | { | |
|
| m_rec.ParseFields(data, offset); | | m_rec.ParseFields(data, offset, ic); | |
| } | | } | |
| | | | |
| virtual void Store() | | virtual void Store() | |
| { | | { | |
| (*m_store)(m_rec); | | (*m_store)(m_rec); | |
| } | | } | |
| }; | | }; | |
| | | | |
| } // namespace Barry | | } // namespace Barry | |
| | | | |
| | | | |
End of changes. 9 change blocks. |
| 9 lines changed or deleted | | 56 lines changed or added | |
|
| protocol.h | | protocol.h | |
| /// | | /// | |
| /// \file protocol.h | | /// \file protocol.h | |
| /// USB Blackberry bulk protocol API constants | | /// USB Blackberry bulk protocol API constants | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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_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_ECHO 0x01 | |
| | | #define SB_COMMAND_ECHO_REPLY 0x02 | |
| | | #define SB_COMMAND_RESET 0x03 | |
| | | #define SB_COMMAND_RESET_REPLY 0x04 | |
| #define SB_COMMAND_FETCH_ATTRIBUTE 0x05 | | #define SB_COMMAND_FETCH_ATTRIBUTE 0x05 | |
| #define SB_COMMAND_FETCHED_ATTRIBUTE 0x06 | | #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_CHALLENGE 0x0e | |
| #define SB_COMMAND_PASSWORD 0x0f | | #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_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 | |
| | | | |
|
| | | // JavaLoader commands | |
| | | #define SB_COMMAND_JL_HELLO 0x64 // This could be a general A | |
| | | CK in both directions | |
| | | #define SB_COMMAND_JL_HELLO_ACK 0x65 // From device after | |
| | | host HELLO | |
| | | #define SB_COMMAND_JL_GOODBYE 0x8d | |
| | | #define SB_COMMAND_JL_SET_UNKNOWN1 0x70 // Initial sequence, 0 | |
| | | #define SB_COMMAND_JL_SET_COD_FILENAME 0x80 | |
| | | #define SB_COMMAND_JL_SET_COD_SIZE 0x67 // Always big endian | |
| | | #define SB_COMMAND_JL_SEND_DATA 0x68 | |
| | | #define SB_COMMAND_JL_SET_TIME 0x7c | |
| | | #define SB_COMMAND_JL_GET_SCREENSHOT 0x87 | |
| | | #define SB_COMMAND_JL_DEVICE_INFO 0x71 | |
| | | #define SB_COMMAND_JL_OS_METRICS 0x78 | |
| | | #define SB_COMMAND_JL_BOOTROM_METRICS 0x79 | |
| | | #define SB_COMMAND_JL_GET_DIRECTORY 0x6d | |
| | | #define SB_COMMAND_JL_GET_DATA_ENTRY 0x6e // Used for both DIR and SCR | |
| | | EENSHOT | |
| | | #define SB_COMMAND_JL_GET_SUBDIR 0x7f | |
| | | #define SB_COMMAND_JL_GET_SUBDIR_ENTRY 0x7d | |
| | | #define SB_COMMAND_JL_ERASE 0x69 | |
| | | #define SB_COMMAND_JL_FORCE_ERASE 0x7b | |
| | | #define SB_COMMAND_JL_UNKNOWN3 0x63 | |
| | | #define SB_COMMAND_JL_GET_LOG 0x73 | |
| | | #define SB_COMMAND_JL_GET_LOG_ENTRY 0x74 | |
| | | #define SB_COMMAND_JL_CLEAR_LOG 0x88 | |
| | | #define SB_COMMAND_JL_SAVE_MODULE 0x7e | |
| | | #define SB_COMMAND_JL_WIPE_APPS 0x6a | |
| | | #define SB_COMMAND_JL_WIPE_FS 0x6b | |
| | | #define SB_COMMAND_JL_LOG_STRACES 0x8e | |
| | | #define SB_COMMAND_JL_RESET_FACTORY 0x91 | |
| | | | |
| | | // JavaLoader response | |
| | | #define SB_COMMAND_JL_ACK 0x64 | |
| | | #define SB_COMMAND_JL_READY 0x01 | |
| | | #define SB_COMMAND_JL_RESET_REQUIRED 0x78 // Occurs after GOODBYE when | |
| | | handheld reset is required | |
| | | #define SB_COMMAND_JL_COD_IN_USE 0x6c // Perhaps "BUSY" is also a | |
| | | good name? | |
| | | #define SB_COMMAND_JL_COD_NOT_FOUND 0x69 | |
| | | #define SB_COMMAND_JL_NOT_SUPPORTED 0x71 // Occurs when device does n | |
| | | ot support a command | |
| | | | |
| | | // JavaLoader data | |
| | | #define SB_DATA_JL_SUCCESS 0x64 // Device has accepted the d | |
| | | ata packet | |
| | | #define SB_DATA_JL_INVALID 0x68 // Device returns this code | |
| | | if the application isn't valid. | |
| | | | |
| // mode constants | | // mode constants | |
| #define SB_MODE_REQUEST_SOCKET 0x00ff | | #define SB_MODE_REQUEST_SOCKET 0x00ff | |
| | | | |
| // object and attribute ID codes (for ZeroPacket::GetAttribute()) | | // object and attribute ID codes (for ZeroPacket::GetAttribute()) | |
| // meanings for most of these are unknown | | // meanings for most of these are unknown | |
| #define SB_OBJECT_INITIAL_UNKNOWN 0x14 | | #define SB_OBJECT_INITIAL_UNKNOWN 0x14 | |
| #define SB_ATTR_INITIAL_UNKNOWN 0x01 | | #define SB_ATTR_INITIAL_UNKNOWN 0x01 | |
| #define SB_OBJECT_PROFILE 0x08 | | #define SB_OBJECT_PROFILE 0x08 | |
| #define SB_ATTR_PROFILE_DESC 0x02 | | #define SB_ATTR_PROFILE_DESC 0x02 | |
| #define SB_ATTR_PROFILE_PIN 0x04 | | #define SB_ATTR_PROFILE_PIN 0x04 | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 54 lines changed or added | |
|
| r_calendar.h | | r_calendar.h | |
| /// | | /// | |
| /// \file r_calendar.h | | /// \file r_calendar.h | |
| /// Blackberry database record parser class for calndar records. | | /// Blackberry database record parser class for calndar records. | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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 "dll.h" | |
| #include "record.h" | | #include "record.h" | |
|
| | | #include "r_recur_base.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 { | |
| | | | |
|
| | | // forward declarations | |
| | | class IConverter; | |
| | | | |
| // | | // | |
| // 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 BXEXPORT Calendar | | class BXEXPORT Calendar : public RecurBase | |
| { | | { | |
| 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; | |
| std::string Notes; | | std::string Notes; | |
| std::string Location; | | std::string Location; | |
| time_t NotificationTime; // 0 means notification is off | | time_t NotificationTime; // 0 means notification is off | |
| time_t StartTime; | | time_t StartTime; | |
| time_t EndTime; | | time_t EndTime; | |
|
| | | EmailAddressList Organizer; | |
| | | EmailAddressList AcceptedBy; | |
| | | EmailAddressList Invited; // list of invited people (e | |
| | | mail a | |
| | | | |
| /// | | /// | |
| /// Free Busy Flag | | /// Free Busy Flag | |
| /// | | /// | |
| /// This lists the available settings found in the device. | | /// This lists the available settings found in the device. | |
| /// This list is based on information from MS Outlook 2007 | | /// This list is based on information from MS Outlook 2007 | |
| /// (Free ==0 and Busy == 2) | | /// (Free ==0 and Busy == 2) | |
| /// This is FBTYPE in RFC2445 and is defined as | | /// This is FBTYPE in RFC2445 and is defined as | |
| /// FREE, BUSY, BUSY-UNAVAILABLE and BUSY-TENTATIVE | | /// FREE, BUSY, BUSY-UNAVAILABLE and BUSY-TENTATIVE | |
| /// | | /// | |
| | | | |
| skipping to change at line 93 | | skipping to change at line 100 | |
| /// RFC2445 CLASS is PUBLIC, PRIVATE, CONFIDENTIAL | | /// RFC2445 CLASS is PUBLIC, PRIVATE, CONFIDENTIAL | |
| /// | | /// | |
| enum ClassFlagType { | | enum ClassFlagType { | |
| Public = 0, | | Public = 0, | |
| Confidential, | | Confidential, | |
| Private | | Private | |
| }; | | }; | |
| | | | |
| ClassFlagType ClassFlag; | | ClassFlagType ClassFlag; | |
| | | | |
|
| /// | | | |
| /// Recurring data | | | |
| /// | | | |
| /// Note: interval can be used on all of these recurring types to | | | |
| /// make it happen "every other time" or more, etc. | | | |
| /// | | | |
| enum RecurringCodeType { | | | |
| Day = 1, //< eg. every day | | | |
| //< set: nothing | | | |
| MonthByDate = 3, //< eg. every month on the 12th | | | |
| //< set: DayOfMonth | | | |
| MonthByDay = 4, //< eg. every month on 3rd Wed | | | |
| //< set: DayOfWeek and WeekOfMonth | | | |
| YearByDate = 5, //< eg. every year on March 5 | | | |
| //< set: DayOfMonth and MonthOfYear | | | |
| YearByDay = 6, //< eg. every year on 3rd Wed of Jan | | | |
| //< set: DayOfWeek, WeekOfMonth, and | | | |
| //< MonthOfYear | | | |
| Week = 12 //< eg. every week on Mon and Fri | | | |
| //< set: WeekDays | | | |
| }; | | | |
| | | | |
| bool Recurring; | | | |
| RecurringCodeType RecurringType; | | | |
| unsigned short Interval; // must be >= 1 | | | |
| time_t RecurringEndTime; // only pertains if Recurring is tru | | | |
| e | | | |
| // sets the date and time when | | | |
| // recurrence of this appointment | | | |
| // should no longer occur | | | |
| // If a perpetual appointment, this | | | |
| // is 0xFFFFFFFF in the low level da | | | |
| ta | | | |
| // Instead, set the following flag. | | | |
| 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 | | bool TimeZoneValid; // true if the record contained a | |
| // time zone code | | // time zone code | |
| | | | |
|
| unsigned short // recurring details, depending on t | | | |
| ype | | | |
| DayOfWeek, // 0-6 | | | |
| WeekOfMonth, // 1-5 | | | |
| DayOfMonth, // 1-31 | | | |
| MonthOfYear; // 1-12 | | | |
| unsigned char WeekDays; // bitmask, bit 0 = sunday | | | |
| | | | |
| // FIXME - put these somewhere usable by both C and C++ | | | |
| #define CAL_WD_SUN 0x01 | | | |
| #define CAL_WD_MON 0x02 | | | |
| #define CAL_WD_TUE 0x04 | | | |
| #define CAL_WD_WED 0x08 | | | |
| #define CAL_WD_THU 0x10 | | | |
| #define CAL_WD_FRI 0x20 | | | |
| #define CAL_WD_SAT 0x40 | | | |
| | | | |
| // unknown | | // unknown | |
| UnknownsType Unknowns; | | UnknownsType Unknowns; | |
| | | | |
|
| | | protected: | |
| | | static FreeBusyFlagType FreeBusyFlagProto2Rec(uint8_t f); | |
| | | static uint8_t FreeBusyFlagRec2Proto(FreeBusyFlagType f); | |
| | | | |
| | | static ClassFlagType ClassFlagProto2Rec(uint8_t f); | |
| | | static uint8_t ClassFlagRec2Proto(ClassFlagType f); | |
| | | | |
| 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, const IConverter *ic = 0); | |
| void ParseRecurrenceData(const 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); | |
|
| void ParseFields(const Data &data, size_t &offset); | | void ParseFields(const Data &data, size_t &offset, const IConverter
*ic = 0); | |
| 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 IConverter *ic =
0) const; | |
| | | | |
| void Clear(); | | void Clear(); | |
| | | | |
| 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"; } | |
| | | | |
End of changes. 11 change blocks. |
| 59 lines changed or deleted | | 20 lines changed or added | |
|
| r_contact.h | | r_contact.h | |
| /// | | /// | |
| /// \file r_contact.h | | /// \file r_contact.h | |
| /// Blackberry database record parser class for contact records. | | /// Blackberry database record parser class for contact records. | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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. | |
| | | | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #include "dll.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 { | |
| | | | |
|
| | | // forward declarations | |
| | | class IConverter; | |
| | | | |
| // | | // | |
| // 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 BXEXPORT 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; | | | |
| | | | |
| /// \addtogroup RecordParserClasses | | /// \addtogroup RecordParserClasses | |
| /// @{ | | /// @{ | |
| | | | |
|
| | | // | |
| | | // Contact record class | |
| | | // | |
| | | /// Represents a single record in the Address Book Blackberry database. | |
| | | /// | |
| class BXEXPORT 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::string EmailType; | |
| typedef std::vector<EmailType> EmailList; | | typedef std::vector<EmailType> EmailList; | |
| | | | |
|
| | | // | |
| | | // Record fields | |
| | | // | |
| | | | |
| // contact specific data | | // contact specific data | |
| uint8_t RecType; | | uint8_t RecType; | |
| uint32_t RecordId; | | uint32_t RecordId; | |
| EmailList EmailAddresses; | | EmailList EmailAddresses; | |
|
| | | | |
| | | /// This field, Phone, is deprecated. It is possible | |
| | | /// to write to this field to the Blackberry, | |
| | | /// but modern devices won't let you add it | |
| | | /// through their GUIs. This field only seems | |
| | | /// to exist on the 7750. While other devices | |
| | | /// accept the field and display it, it is | |
| | | /// not accessible by default. | |
| | | std::string Phone; | |
| | | | |
| std::string | | std::string | |
|
| Phone, | | | |
| Fax, | | Fax, | |
| WorkPhone, | | WorkPhone, | |
| HomePhone, | | HomePhone, | |
| MobilePhone, | | MobilePhone, | |
| Pager, | | Pager, | |
| PIN, | | PIN, | |
| Radio, | | Radio, | |
| WorkPhone2, | | WorkPhone2, | |
| HomePhone2, | | HomePhone2, | |
| OtherPhone, | | OtherPhone, | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 134 | |
| // two categories, not only by this library, but by the | | // two categories, not only by this library, but by the | |
| // device itself. | | // device itself. | |
| CategoryList Categories; | | CategoryList Categories; | |
| | | | |
| GroupLinksType GroupLinks; | | GroupLinksType GroupLinks; | |
| UnknownsType Unknowns; | | UnknownsType Unknowns; | |
| | | | |
| private: | | private: | |
| bool m_FirstNameSeen; | | bool m_FirstNameSeen; | |
| | | | |
|
| //protected: | | | |
| 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, const IConverter *ic = 0); | |
| | | | |
| 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; | | 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, const IConverter
*ic = 0); | |
| 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 IConverter *ic =
0) const; | |
| | | | |
| void Clear(); // erase everything | | void Clear(); // erase everything | |
| | | | |
| void Dump(std::ostream &os) const; | | void Dump(std::ostream &os) const; | |
| | | | |
| // 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"; } | |
| 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 CategoryList2Str(const Barry::CategoryList &list, std::s | | | |
| tring &str); | | | |
| }; | | }; | |
| | | | |
| BXEXPORT 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 | |
| | | | |
End of changes. 12 change blocks. |
| 12 lines changed or deleted | | 26 lines changed or added | |
|
| r_servicebook.h | | r_servicebook.h | |
| /// | | /// | |
| /// \file r_servicebook.h | | /// \file r_servicebook.h | |
| /// Blackberry database record parser class for the | | /// Blackberry database record parser class for the | |
| /// Service Book record. | | /// Service Book record. | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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. | |
| | | | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| #include "dll.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 { | |
| | | | |
|
| | | // forward declarations | |
| | | class IConverter; | |
| | | | |
| // | | // | |
| // 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. | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 60 | |
| { | | { | |
| 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, | |
|
| const unsigned char *end); | | const unsigned char *end, const IConverter *ic = 0); | |
| | | | |
| public: | | public: | |
| ServiceBookConfig(); | | ServiceBookConfig(); | |
| ~ServiceBookConfig(); | | ~ServiceBookConfig(); | |
| | | | |
| // Parser / Builder API (see parser.h / builder.h) | | // Parser / Builder API (see parser.h / builder.h) | |
| 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, const IConverter
*ic = 0); | |
| 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 IConverter *ic =
0) const; | |
| | | | |
| void Clear(); | | void Clear(); | |
| | | | |
| void Dump(std::ostream &os) const; | | void Dump(std::ostream &os) const; | |
| }; | | }; | |
| | | | |
| BXEXPORT inline std::ostream& operator<<(std::ostream &os, const ServiceBoo
kConfig &msg) { | | BXEXPORT inline std::ostream& operator<<(std::ostream &os, const ServiceBoo
kConfig &msg) { | |
| msg.Dump(os); | | msg.Dump(os); | |
| return os; | | return os; | |
| } | | } | |
| | | | |
|
| | | class ServiceBookData; | |
| | | | |
| class BXEXPORT ServiceBook | | class BXEXPORT ServiceBook | |
| { | | { | |
|
| int NameType, DescType, UniqueIdType; | | ServiceBookData *m_data; | |
| | | | |
| 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; | |
| std::string Description; | | std::string Description; | |
| std::string DSID; | | std::string DSID; | |
| std::string BesDomain; | | std::string BesDomain; | |
| std::string UniqueId; | | std::string UniqueId; | |
| std::string ContentId; | | std::string ContentId; | |
| ServiceBookConfig Config; | | ServiceBookConfig Config; | |
| | | | |
| 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, const IConverter *ic = 0); | |
| | | | |
| public: | | public: | |
| ServiceBook(); | | ServiceBook(); | |
| ~ServiceBook(); | | ~ServiceBook(); | |
| | | | |
| // 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, const IConverter
*ic = 0); | |
| 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 IConverter *ic =
0) const; | |
| | | | |
| void Clear(); | | void Clear(); | |
| | | | |
| 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"; } | |
| | | | |
End of changes. 10 change blocks. |
| 8 lines changed or deleted | | 13 lines changed or added | |
|
| r_task.h | | r_task.h | |
| /// | | /// | |
| /// \file r_task.h | | /// \file r_task.h | |
| /// Record parsing class for the task database. | | /// Record parsing class for the task database. | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| Copyright (C) 2007, Brian Edginton | | Copyright (C) 2007, Brian Edginton | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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 "dll.h" | |
| #include "record.h" | | #include "record.h" | |
|
| | | #include "r_recur_base.h" | |
| #include <vector> | | #include <vector> | |
| #include <string> | | #include <string> | |
| #include <stdint.h> | | #include <stdint.h> | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
|
| class BXEXPORT Task | | // forward declarations | |
| | | class IConverter; | |
| | | | |
| | | class BXEXPORT Task : public RecurBase | |
| { | | { | |
| 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; | | | |
| std::string Summary; | | std::string Summary; | |
| std::string Notes; | | std::string Notes; | |
|
| std::string Categories; | | CategoryList Categories; | |
| std::string UID; | | std::string UID; | |
| | | | |
| time_t StartTime; | | time_t StartTime; | |
| time_t DueTime; | | time_t DueTime; | |
| time_t AlarmTime; | | time_t AlarmTime; | |
|
| int TimeZoneCode; | | unsigned short TimeZoneCode; | |
| | | bool TimeZoneValid; // true if the record contained a | |
| | | // time zone code | |
| | | | |
| enum AlarmFlagType | | enum AlarmFlagType | |
| { | | { | |
| Date = 1, | | Date = 1, | |
| Relative | | Relative | |
| }; | | }; | |
| AlarmFlagType AlarmType; | | AlarmFlagType AlarmType; | |
| | | | |
|
| unsigned short Interval; | | | |
| enum RecurringCodeType { | | | |
| Day = 1, //< eg. every day | | | |
| //< set: nothing | | | |
| MonthByDate = 3, //< eg. every month on the 12th | | | |
| //< set: DayOfMonth | | | |
| MonthByDay = 4, //< eg. every month on 3rd Wed | | | |
| //< set: DayOfWeek and WeekOfMonth | | | |
| YearByDate = 5, //< eg. every year on March 5 | | | |
| //< set: DayOfMonth and MonthOfYear | | | |
| YearByDay = 6, //< eg. every year on 3rd Wed of Jan | | | |
| //< set: DayOfWeek, WeekOfMonth, and | | | |
| //< MonthOfYear | | | |
| Week = 12 //< eg. every week on Mon and Fri | | | |
| //< set: WeekDays | | | |
| }; | | | |
| RecurringCodeType RecurringType; | | | |
| time_t RecurringEndTime; | | | |
| unsigned short // recurring details, depending on t | | | |
| ype | | | |
| DayOfWeek, // 0-6 | | | |
| WeekOfMonth, // 1-5 | | | |
| DayOfMonth, // 1-31 | | | |
| MonthOfYear; // 1-12 | | | |
| unsigned char WeekDays; // bitmask, bit 0 = sunday | | | |
| | | | |
| int ClassType; | | | |
| enum PriorityFlagType | | enum PriorityFlagType | |
| { | | { | |
| High = 0, | | High = 0, | |
| Normal, | | Normal, | |
| Low | | Low | |
| }; | | }; | |
| PriorityFlagType PriorityFlag; | | PriorityFlagType PriorityFlag; | |
| | | | |
| enum StatusFlagType | | enum StatusFlagType | |
| { | | { | |
| NotStarted = 0, | | NotStarted = 0, | |
| InProgress, | | InProgress, | |
| Completed, | | Completed, | |
| Waiting, | | Waiting, | |
| Deferred | | Deferred | |
| }; | | }; | |
| StatusFlagType StatusFlag; | | StatusFlagType StatusFlag; | |
| | | | |
|
| bool Recurring; | | | |
| bool Perpetual; | | | |
| bool DueDateFlag; // true if due date is set | | bool DueDateFlag; // true if due date is set | |
| | | | |
|
| | | // unknown | |
| UnknownsType Unknowns; | | UnknownsType Unknowns; | |
| | | | |
|
| | | protected: | |
| | | static AlarmFlagType AlarmProto2Rec(uint8_t a); | |
| | | static uint8_t AlarmRec2Proto(AlarmFlagType a); | |
| | | | |
| | | static PriorityFlagType PriorityProto2Rec(uint8_t p); | |
| | | static uint8_t PriorityRec2Proto(PriorityFlagType p); | |
| | | | |
| | | static StatusFlagType StatusProto2Rec(uint8_t s); | |
| | | static uint8_t StatusRec2Proto(StatusFlagType s); | |
| | | | |
| public: | | public: | |
| Task(); | | Task(); | |
| ~Task(); | | ~Task(); | |
| | | | |
| const unsigned char* ParseField(const unsigned char *begin, | | const unsigned char* ParseField(const unsigned char *begin, | |
|
| const unsigned char *end); | | const unsigned char *end, const IConverter *ic = 0); | |
| void ParseRecurrenceData(const void *data); | | | |
| void BuildRecurrenceData(void *data); | | | |
| 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, const IConverter
*ic = 0); | |
| void BuildHeader(Data &data, size_t &offset) const; | | void BuildHeader(Data &data, size_t &offset) const; | |
|
| | | void BuildFields(Data &data, size_t &offset, const IConverter *ic =
0) const; | |
| | | | |
| void Clear(); | | void Clear(); | |
| | | | |
| 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; } | |
| | | | |
| | | | |
End of changes. 14 change blocks. |
| 40 lines changed or deleted | | 26 lines changed or added | |
|
| s11n-boost.h | | s11n-boost.h | |
| /// | | /// | |
| /// \file s11n-boost.h | | /// \file s11n-boost.h | |
| /// Non-intrusive versions of serialization functions for the | | /// Non-intrusive versions of serialization functions for the | |
| /// record classes. These template functions make it possible | | /// record classes. These template functions make it possible | |
| /// to use the record classes with the Boost::Serialization | | /// to use the record classes with the Boost::Serialization | |
| /// library. | | /// library. | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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. | |
| | | | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 63 | |
| } | | } | |
| | | | |
| 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::CategoryList &cl, const unsigned int ve | |
| | | r) | |
| | | { | |
| | | std::vector<std::string> &sl = cl; | |
| | | ar & make_nvp("CategoryList", sl); | |
| | | } | |
| | | | |
| | | 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("EmailAddresses", c.EmailAddresses); | | 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); | |
| | | | |
| skipping to change at line 145 | | skipping to change at line 152 | |
| ar & make_nvp("MessageReplyTo", m.MessageReplyTo); | | ar & make_nvp("MessageReplyTo", m.MessageReplyTo); | |
| ar & make_nvp("MessageDateSent", m.MessageDateSent); | | ar & make_nvp("MessageDateSent", m.MessageDateSent); | |
| ar & make_nvp("MessageDateReceived", m.MessageDateReceived); | | ar & make_nvp("MessageDateReceived", m.MessageDateReceived); | |
| | | | |
| ar & make_nvp("MessageTruncated", m.MessageTruncated); | | ar & make_nvp("MessageTruncated", m.MessageTruncated); | |
| ar & make_nvp("MessageRead", m.MessageRead); | | ar & make_nvp("MessageRead", m.MessageRead); | |
| ar & make_nvp("MessageReply", m.MessageReply); | | ar & make_nvp("MessageReply", m.MessageReply); | |
| ar & make_nvp("MessageSaved", m.MessageSaved); | | ar & make_nvp("MessageSaved", m.MessageSaved); | |
| ar & make_nvp("MessageSavedDeleted", m.MessageSavedDeleted); | | ar & make_nvp("MessageSavedDeleted", m.MessageSavedDeleted); | |
| | | | |
|
| ar & make_nvp("MessagePriority", m.MessagePriority); | | ar & make_nvp("MessagePriority", m.Priority); | |
| ar & make_nvp("MessageSensitivity", m.MessageSensitivity); | | ar & make_nvp("MessageSensitivity", m.Sensitivity); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| 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); | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 176 | |
| 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("Organizer", c.Organizer); | |
| | | ar & make_nvp("AcceptedBy", c.AcceptedBy); | |
| | | ar & make_nvp("Invited", c.Invited); | |
| | | | |
| 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("TimeZoneValid", c.TimeZoneValid); | |
| | | | |
| skipping to change at line 192 | | skipping to change at line 203 | |
| ar & make_nvp("DayOfMonth", c.DayOfMonth); | | ar & make_nvp("DayOfMonth", c.DayOfMonth); | |
| ar & make_nvp("MonthOfYear", c.MonthOfYear); | | ar & make_nvp("MonthOfYear", c.MonthOfYear); | |
| ar & make_nvp("WeekDays", c.WeekDays); | | 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::CallLog &c, const unsigned int ver) | |
| | | { | |
| | | ar & make_nvp("RecType", c.RecType); | |
| | | ar & make_nvp("RecordId", c.RecordId); | |
| | | | |
| | | ar & make_nvp("Duration", c.Duration); | |
| | | ar & make_nvp("Timestamp", c.Timestamp); | |
| | | ar & make_nvp("ContactName", c.ContactName); | |
| | | ar & make_nvp("PhoneNumber", c.PhoneNumber); | |
| | | | |
| | | ar & make_nvp("DirectionFlag", c.DirectionFlag); | |
| | | ar & make_nvp("StatusFlag", c.StatusFlag); | |
| | | ar & make_nvp("PhoneTypeFlag", c.PhoneTypeFlag); | |
| | | ar & make_nvp("PhoneInfoFlag", c.PhoneInfoFlag); | |
| | | | |
| | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| | | ar & make_nvp("Unknowns", c.Unknowns); | |
| | | } | |
| | | } | |
| | | | |
| | | 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); | |
| | | | |
| 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> | |
| | | | |
| skipping to change at line 227 | | skipping to change at line 259 | |
| ar & make_nvp("Unknowns", c.Unknowns); | | ar & make_nvp("Unknowns", c.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
| template <class ArchiveT> | | template <class ArchiveT> | |
| void serialize(ArchiveT &ar, Barry::Memo &m, const unsigned int ver) | | void serialize(ArchiveT &ar, Barry::Memo &m, const unsigned int ver) | |
| { | | { | |
| ar & make_nvp("RecType", m.RecType); | | ar & make_nvp("RecType", m.RecType); | |
| ar & make_nvp("RecordId", m.RecordId); | | ar & make_nvp("RecordId", m.RecordId); | |
| | | | |
|
| ar & make_nvp("MemoType", m.MemoType); | | | |
| ar & make_nvp("Title", m.Title); | | ar & make_nvp("Title", m.Title); | |
| ar & make_nvp("Body", m.Body); | | ar & make_nvp("Body", m.Body); | |
|
| ar & make_nvp("Category", m.Category); | | ar & make_nvp("Categories", m.Categories); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| ar & make_nvp( "Unknowns", m.Unknowns); | | ar & make_nvp( "Unknowns", m.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
| template <class ArchiveT> | | template <class ArchiveT> | |
| void serialize(ArchiveT &ar, Barry::Task &t, const unsigned int ver) | | void serialize(ArchiveT &ar, Barry::Task &t, const unsigned int ver) | |
| { | | { | |
| ar & make_nvp("RecType", t.RecType); | | ar & make_nvp("RecType", t.RecType); | |
| ar & make_nvp("RecordId", t.RecordId); | | ar & make_nvp("RecordId", t.RecordId); | |
| | | | |
|
| ar & make_nvp("TaskType", t.TaskType); | | | |
| ar & make_nvp("Summary", t.Summary); | | ar & make_nvp("Summary", t.Summary); | |
| ar & make_nvp("Notes", t.Notes); | | ar & make_nvp("Notes", t.Notes); | |
| ar & make_nvp("Categories", t.Categories); | | ar & make_nvp("Categories", t.Categories); | |
| ar & make_nvp("UID", t.UID); | | ar & make_nvp("UID", t.UID); | |
| | | | |
| ar & make_nvp("StartTime", t.StartTime); | | ar & make_nvp("StartTime", t.StartTime); | |
| ar & make_nvp("DueTime", t.DueTime); | | ar & make_nvp("DueTime", t.DueTime); | |
| ar & make_nvp("AlarmTime", t.AlarmTime); | | ar & make_nvp("AlarmTime", t.AlarmTime); | |
| | | | |
| ar & make_nvp("TimeZoneCode", t.TimeZoneCode); | | ar & make_nvp("TimeZoneCode", t.TimeZoneCode); | |
|
| | | ar & make_nvp("TimeZoneValid", t.TimeZoneValid); | |
| | | | |
| ar & make_nvp("AlarmType", t.AlarmType); | | ar & make_nvp("AlarmType", t.AlarmType); | |
| ar & make_nvp("Interval", t.Interval); | | ar & make_nvp("Interval", t.Interval); | |
| ar & make_nvp("RecurringType", t.RecurringType); | | ar & make_nvp("RecurringType", t.RecurringType); | |
| ar & make_nvp("RecurringEndTime", t.RecurringEndTime); | | ar & make_nvp("RecurringEndTime", t.RecurringEndTime); | |
| ar & make_nvp("DayOfWeek", t.DayOfWeek); | | ar & make_nvp("DayOfWeek", t.DayOfWeek); | |
| ar & make_nvp("WeekOfMonth", t.WeekOfMonth); | | ar & make_nvp("WeekOfMonth", t.WeekOfMonth); | |
| ar & make_nvp("DayOfMonth", t.DayOfMonth); | | ar & make_nvp("DayOfMonth", t.DayOfMonth); | |
| ar & make_nvp("MonthOfYear", t.MonthOfYear); | | ar & make_nvp("MonthOfYear", t.MonthOfYear); | |
| ar & make_nvp("WeekDays", t.WeekDays); | | ar & make_nvp("WeekDays", t.WeekDays); | |
| | | | |
|
| ar & make_nvp("ClassType", t.ClassType); | | | |
| ar & make_nvp("PriorityFlag", t.PriorityFlag); | | ar & make_nvp("PriorityFlag", t.PriorityFlag); | |
| ar & make_nvp("StatusFlag", t.StatusFlag); | | ar & make_nvp("StatusFlag", t.StatusFlag); | |
| ar & make_nvp("Recurring", t.Recurring); | | ar & make_nvp("Recurring", t.Recurring); | |
| ar & make_nvp("Perpetual", t.Perpetual); | | ar & make_nvp("Perpetual", t.Perpetual); | |
| ar & make_nvp("DueDateFlag", t.DueDateFlag); | | ar & make_nvp("DueDateFlag", t.DueDateFlag); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| ar & make_nvp( "Unknowns", t.Unknowns); | | ar & make_nvp( "Unknowns", t.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 330 | |
| ar & make_nvp("MessageReplyTo", p.MessageReplyTo); | | ar & make_nvp("MessageReplyTo", p.MessageReplyTo); | |
| ar & make_nvp("MessageDateSent", p.MessageDateSent); | | ar & make_nvp("MessageDateSent", p.MessageDateSent); | |
| ar & make_nvp("MessageDateReceived", p.MessageDateReceived); | | ar & make_nvp("MessageDateReceived", p.MessageDateReceived); | |
| | | | |
| ar & make_nvp("MessageTruncated", p.MessageTruncated); | | ar & make_nvp("MessageTruncated", p.MessageTruncated); | |
| ar & make_nvp("MessageRead", p.MessageRead); | | ar & make_nvp("MessageRead", p.MessageRead); | |
| ar & make_nvp("MessageReply", p.MessageReply); | | ar & make_nvp("MessageReply", p.MessageReply); | |
| ar & make_nvp("MessageSaved", p.MessageSaved); | | ar & make_nvp("MessageSaved", p.MessageSaved); | |
| ar & make_nvp("MessageSavedDeleted", p.MessageSavedDeleted); | | ar & make_nvp("MessageSavedDeleted", p.MessageSavedDeleted); | |
| | | | |
|
| ar & make_nvp("MessagePriority", p.MessagePriority); | | ar & make_nvp("MessagePriority", p.Priority); | |
| ar & make_nvp("MessageSensitivity", p.MessageSensitivity); | | ar & make_nvp("MessageSensitivity", p.Sensitivity); | |
| | | | |
| if(ver < BARRY_POD_MAP_VERSION) { | | if(ver < BARRY_POD_MAP_VERSION) { | |
| ar & make_nvp("Unknowns", p.Unknowns); | | ar & make_nvp("Unknowns", p.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
| template <class ArchiveT> | | template <class ArchiveT> | |
| void serialize(ArchiveT &ar, Barry::SavedMessage &m, const unsigned int ver
) | | void serialize(ArchiveT &ar, Barry::SavedMessage &m, const unsigned int ver
) | |
| { | | { | |
| ar & make_nvp("RecType", m.RecType); | | ar & make_nvp("RecType", m.RecType); | |
| | | | |
| skipping to change at line 334 | | skipping to change at line 364 | |
| ar & make_nvp("MessageReplyTo", m.MessageReplyTo); | | ar & make_nvp("MessageReplyTo", m.MessageReplyTo); | |
| ar & make_nvp("MessageDateSent", m.MessageDateSent); | | ar & make_nvp("MessageDateSent", m.MessageDateSent); | |
| ar & make_nvp("MessageDateReceived", m.MessageDateReceived); | | ar & make_nvp("MessageDateReceived", m.MessageDateReceived); | |
| | | | |
| ar & make_nvp("MessageTruncated", m.MessageTruncated); | | ar & make_nvp("MessageTruncated", m.MessageTruncated); | |
| ar & make_nvp("MessageRead", m.MessageRead); | | ar & make_nvp("MessageRead", m.MessageRead); | |
| ar & make_nvp("MessageReply", m.MessageReply); | | ar & make_nvp("MessageReply", m.MessageReply); | |
| ar & make_nvp("MessageSaved", m.MessageSaved); | | ar & make_nvp("MessageSaved", m.MessageSaved); | |
| ar & make_nvp("MessageSavedDeleted", m.MessageSavedDeleted); | | ar & make_nvp("MessageSavedDeleted", m.MessageSavedDeleted); | |
| | | | |
|
| ar & make_nvp("MessagePriority", m.MessagePriority); | | ar & make_nvp("MessagePriority", m.Priority); | |
| ar & make_nvp("MessageSensitivity", m.MessageSensitivity); | | ar & make_nvp("MessageSensitivity", m.Sensitivity); | |
| | | | |
| | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| | | ar & make_nvp("Unknowns", m.Unknowns); | |
| | | } | |
| | | } | |
| | | | |
| | | template <class ArchiveT> | |
| | | void serialize(ArchiveT &ar, Barry::Sms &m, const unsigned int ver) | |
| | | { | |
| | | ar & make_nvp("RecType", m.RecType); | |
| | | ar & make_nvp("RecordId", m.RecordId); | |
| | | | |
| | | ar & make_nvp("MessageStatus", m.MessageStatus); | |
| | | ar & make_nvp("DeliveryStatus", m.DeliveryStatus); | |
| | | | |
| | | ar & make_nvp("IsNew", m.IsNew); | |
| | | ar & make_nvp("NewConversation", m.NewConversation); | |
| | | ar & make_nvp("Saved", m.Saved); | |
| | | ar & make_nvp("Deleted", m.Deleted); | |
| | | ar & make_nvp("Opened", m.Opened); | |
| | | | |
| | | ar & make_nvp("Timestamp", m.Timestamp); | |
| | | ar & make_nvp("ServiceCenterTimestamp", m.ServiceCenterTimestamp); | |
| | | | |
| | | ar & make_nvp("DataCodingScheme", m.DataCodingScheme); | |
| | | ar & make_nvp("ErrorId", m.ErrorId); | |
| | | | |
| | | ar & make_nvp("Addresses", m.Addresses); | |
| | | ar & make_nvp("Body", m.Body); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| ar & make_nvp("Unknowns", m.Unknowns); | | ar & make_nvp("Unknowns", m.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
| template <class ArchiveT> | | template <class ArchiveT> | |
| void serialize(ArchiveT &ar, Barry::Folder &f, const unsigned int ver) | | void serialize(ArchiveT &ar, Barry::Folder &f, const unsigned int ver) | |
| { | | { | |
| ar & make_nvp("RecType", f.RecType); | | ar & make_nvp("RecType", f.RecType); | |
| ar & make_nvp("RecordId", f.RecordId); | | ar & make_nvp("RecordId", f.RecordId); | |
| | | | |
|
| ar & make_nvp("FolderName", f.FolderName); | | ar & make_nvp("FolderName", f.Name); | |
| ar & make_nvp("FolderNumber", f.FolderNumber); | | ar & make_nvp("FolderNumber", f.Number); | |
| ar & make_nvp("FolderLevel", f.FolderLevel); | | ar & make_nvp("FolderLevel", f.Level); | |
| ar & make_nvp("FolderType", f.FolderType); | | ar & make_nvp("FolderType", f.Type); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| ar & make_nvp( "Unknowns", f.Unknowns); | | ar & make_nvp( "Unknowns", f.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
| template <class ArchiveT> | | template <class ArchiveT> | |
| void serialize(ArchiveT &ar, Barry::Timezone &t, const unsigned int ver) | | void serialize(ArchiveT &ar, Barry::Timezone &t, const unsigned int ver) | |
| { | | { | |
| ar & make_nvp("RecType", t.RecType); | | ar & make_nvp("RecType", t.RecType); | |
| | | | |
End of changes. 13 change blocks. |
| 15 lines changed or deleted | | 75 lines changed or added | |
|
| socket.h | | socket.h | |
| /// | | /// | |
| /// \file socket.h | | /// \file socket.h | |
| /// Class wrapper to encapsulate the Blackberry USB logical sock
et | | /// Class wrapper to encapsulate the Blackberry USB logical sock
et | |
| /// | | /// | |
| | | | |
| /* | | /* | |
|
| Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| 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. | |
| | | | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| #include <stdint.h> | | #include <stdint.h> | |
| #include <queue> | | #include <queue> | |
| #include <memory> | | #include <memory> | |
| #include "router.h" | | #include "router.h" | |
| | | | |
| // forward declarations | | // forward declarations | |
| namespace Usb { class Device; } | | namespace Usb { class Device; } | |
| namespace Barry { | | namespace Barry { | |
| class Data; | | class Data; | |
| class Packet; | | class Packet; | |
|
| | | class JLPacket; | |
| class SocketRoutingQueue; | | class SocketRoutingQueue; | |
| } | | } | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
| class Socket; | | class Socket; | |
| typedef std::auto_ptr<Socket> SocketHandle; | | typedef std::auto_ptr<Socket> SocketHandle; | |
| | | | |
| class BXEXPORT SocketZero | | class BXEXPORT SocketZero | |
| { | | { | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 61 | |
| int m_writeEp, m_readEp; | | int m_writeEp, m_readEp; | |
| uint8_t m_zeroSocketSequence; | | uint8_t m_zeroSocketSequence; | |
| | | | |
| uint32_t m_sequenceId; | | uint32_t m_sequenceId; | |
| | | | |
| // half open socket stata, for passwords | | // half open socket stata, for passwords | |
| bool m_halfOpen; | | bool m_halfOpen; | |
| uint32_t m_challengeSeed; | | uint32_t m_challengeSeed; | |
| unsigned int m_remainingTries; | | unsigned int m_remainingTries; | |
| | | | |
|
| | | bool m_hideSequencePacket; | |
| | | | |
| | | bool m_resetOnClose; | |
| | | | |
| private: | | private: | |
| static void AppendFragment(Data &whole, const Data &fragment); | | static void AppendFragment(Data &whole, const Data &fragment); | |
| static unsigned int MakeNextFragment(const Data &whole, Data &fragme
nt, | | static unsigned int MakeNextFragment(const Data &whole, Data &fragme
nt, | |
| unsigned int offset = 0); | | unsigned int offset = 0); | |
| void CheckSequence(uint16_t socket, const Data &seq); | | void CheckSequence(uint16_t socket, const Data &seq); | |
| | | | |
| void SendOpen(uint16_t socket, Data &receive); | | void SendOpen(uint16_t socket, Data &receive); | |
| void SendPasswordHash(uint16_t socket, const char *password, Data &r
eceive); | | void SendPasswordHash(uint16_t socket, const char *password, Data &r
eceive); | |
| | | | |
| // Raw send and receive functions, used for all low level | | // Raw send and receive functions, used for all low level | |
| // communication to the USB level. | | // communication to the USB level. | |
| void RawSend(Data &send, int timeout = -1); | | void RawSend(Data &send, int timeout = -1); | |
| void RawReceive(Data &receive, int timeout = -1); | | void RawReceive(Data &receive, int timeout = -1); | |
| | | | |
| protected: | | protected: | |
| bool SequencePacket(const Data &data); | | bool SequencePacket(const Data &data); | |
|
| | | bool IsSequencePacketHidden() { return m_hideSequencePacket; } | |
| | | | |
| public: | | public: | |
|
| | | void SetResetOnClose(bool flag) { m_resetOnClose = flag; } | |
| | | void HideSequencePacket(bool flag) { m_hideSequencePacket = flag; } | |
| explicit SocketZero(SocketRoutingQueue &queue, int writeEndpoint, | | explicit SocketZero(SocketRoutingQueue &queue, int writeEndpoint, | |
| uint8_t zeroSocketSequenceStart = 0); | | uint8_t zeroSocketSequenceStart = 0); | |
| SocketZero(Usb::Device &dev, int writeEndpoint, int readEndpoint, | | SocketZero(Usb::Device &dev, int writeEndpoint, int readEndpoint, | |
| uint8_t zeroSocketSequenceStart = 0); | | uint8_t zeroSocketSequenceStart = 0); | |
| ~SocketZero(); | | ~SocketZero(); | |
| | | | |
| uint8_t GetZeroSocketSequence() const { return m_zeroSocketSequence;
} | | uint8_t GetZeroSocketSequence() const { return m_zeroSocketSequence;
} | |
| | | | |
| void SetRoutingQueue(SocketRoutingQueue &queue); | | void SetRoutingQueue(SocketRoutingQueue &queue); | |
| void UnlinkRoutingQueue(); | | void UnlinkRoutingQueue(); | |
| | | | |
| // Send functions for socket 0 only. | | // Send functions for socket 0 only. | |
| // These functions will overwrite: | | // These functions will overwrite: | |
| // - the zeroSocketSequence byte *inside* the packet | | // - the zeroSocketSequence byte *inside* the packet | |
| // - the socket number to 0 | | // - the socket number to 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); | |
|
| // void Receive(Data &receive, int timeout = -1); | | void Receive(Data &receive, int timeout = -1); | |
| | | | |
| // Opens a new socket and returns a Socket object to manage it | | // Opens a new socket and returns a Socket object to manage it | |
| SocketHandle Open(uint16_t socket, const char *password = 0); | | SocketHandle Open(uint16_t socket, const char *password = 0); | |
| void Close(Socket &socket); | | 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. | |
| | | | |
| skipping to change at line 158 | | skipping to change at line 166 | |
| 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); | |
| void Receive(Data &receive, 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 | |
| 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); | |
|
| | | void Packet(Barry::JLPacket &packet, int timeout = -1); | |
| | | | |
| | | // Use this function to send data packet instead of Packet function | |
| | | // Indeed, Packet function is used to send command (and not data) | |
| | | void PacketData(Data &send, Data &receive, 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. | | // Register a callback for incoming data from the device. | |
| // This function assumes that this socket is based on a socketZero | | // This function assumes that this socket is based on a socketZero | |
| // that has a SocketRoutingQueue, otherwise throws logic_error. | | // that has a SocketRoutingQueue, otherwise throws logic_error. | |
| void RegisterInterest(SocketRoutingQueue::SocketDataHandler handler,
void *context); | | void RegisterInterest(SocketRoutingQueue::SocketDataHandler handler,
void *context); | |
| void UnregisterInterest(); | | void UnregisterInterest(); | |
|
| | | | |
| | | // This function is quickly written | |
| | | // It's very durty :( (but it's usefull to test...) | |
| | | void HideSequencePacket(bool flag) { m_zero->HideSequencePacket(flag | |
| | | ); } | |
| }; | | }; | |
| | | | |
| } // namespace Barry | | } // namespace Barry | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 8 change blocks. |
| 2 lines changed or deleted | | 20 lines changed or added | |
|