| controller.h | | controller.h | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 105 | |
| const std::auto_ptr<PrivateControllerData> m_priv; | | const std::auto_ptr<PrivateControllerData> m_priv; | |
| | | | |
| private: | | private: | |
| Controller(const Controller& rhs); // prevent copying | | Controller(const Controller& rhs); // prevent copying | |
| void SetupUsb(const ProbeResult &device); | | void SetupUsb(const ProbeResult &device); | |
| | | | |
| protected: | | protected: | |
| uint16_t SelectMode(ModeType mode); // returns mode socket | | uint16_t SelectMode(ModeType mode); // returns mode socket | |
| uint16_t SelectMode(ModeType mode, const char *explicitModeName); //
returns mode socket | | uint16_t SelectMode(ModeType mode, const char *explicitModeName); //
returns mode socket | |
| SocketHandle OpenSocket(uint16_t socket, const char *password = 0); | | SocketHandle OpenSocket(uint16_t socket, const char *password = 0); | |
|
| | | SocketHandle OpenSocket( | |
| | | SocketRoutingQueue::SocketDataHandlerPtr handler, | |
| | | uint16_t socket, const char *password = 0); | |
| PrivateControllerData* GetPrivate() { return m_priv.get(); } | | PrivateControllerData* GetPrivate() { return m_priv.get(); } | |
| | | | |
| public: | | public: | |
| explicit Controller(const ProbeResult &device, | | explicit Controller(const ProbeResult &device, | |
| int default_timeout = USBWRAP_DEFAULT_TIMEOUT); | | int default_timeout = USBWRAP_DEFAULT_TIMEOUT); | |
| Controller(const ProbeResult &device, SocketRoutingQueue &queue, | | Controller(const ProbeResult &device, SocketRoutingQueue &queue, | |
| int default_timeout = USBWRAP_DEFAULT_TIMEOUT); | | int default_timeout = USBWRAP_DEFAULT_TIMEOUT); | |
| ~Controller(); | | ~Controller(); | |
| | | | |
| bool HasQueue() const; | | bool HasQueue() const; | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 3 lines changed or added | |
|
| ldif.h | | ldif.h | |
| | | | |
| skipping to change at line 139 | | skipping to change at line 139 | |
| std::string m_cn, m_displayName, m_sn, m_givenName; | | std::string m_cn, m_displayName, m_sn, m_givenName; | |
| | | | |
| // heuristics hooking - saves each found value in the variable | | // heuristics hooking - saves each found value in the variable | |
| // pointed at by var | | // pointed at by var | |
| void Hook(const std::string &ldifname, std::string *var); | | void Hook(const std::string &ldifname, std::string *var); | |
| | | | |
| public: | | public: | |
| explicit ContactLdif(const std::string &baseDN); | | explicit ContactLdif(const std::string &baseDN); | |
| virtual ~ContactLdif(); | | virtual ~ContactLdif(); | |
| | | | |
|
| const NameToFunc* GetFieldNames() const { return FieldMap; } | | const NameToFunc* GetFieldNames() const; | |
| const NameToFunc* GetField(const std::string &fieldname) const; | | const NameToFunc* GetField(const std::string &fieldname) const; | |
| std::string GetFieldReadName(GetFunctionType read) const; | | std::string GetFieldReadName(GetFunctionType read) const; | |
| std::string GetFieldWriteName(SetFunctionType write) const; | | std::string GetFieldWriteName(SetFunctionType write) const; | |
| | | | |
| bool Map(const LdifAttribute &ldifname, const std::string &readField
, | | bool Map(const LdifAttribute &ldifname, const std::string &readField
, | |
| const std::string &writeField); | | const std::string &writeField); | |
| void Map(const LdifAttribute &ldifname, GetFunctionType read, | | void Map(const LdifAttribute &ldifname, GetFunctionType read, | |
| SetFunctionType write); | | SetFunctionType write); | |
| void Unmap(const LdifAttribute &ldifname); | | void Unmap(const LdifAttribute &ldifname); | |
| | | | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| m_raw_channel.h | | m_raw_channel.h | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 112 | |
| // or using Receive(). | | // or using Receive(). | |
| void HandleReceivedData(Data &data); | | void HandleReceivedData(Data &data); | |
| | | | |
| // Not intended for use by users of this class. | | // Not intended for use by users of this class. | |
| void HandleError(Barry::Error &data); | | void HandleError(Barry::Error &data); | |
| | | | |
| // Not intended for use by users of this class. | | // Not intended for use by users of this class. | |
| // This method is called by the internals of | | // This method is called by the internals of | |
| // Barry when setting up a connection. | | // Barry when setting up a connection. | |
| void OnOpen(); | | void OnOpen(); | |
|
| | | | |
| | | // Not intended for use by users of this class. | |
| | | // This method is called by the internals of | |
| | | // Barry when setting up a connection. | |
| | | SocketRoutingQueue::SocketDataHandlerPtr GetHandler(); | |
| public: | | public: | |
| // Creates a raw channel in non-callback mode. | | // Creates a raw channel in non-callback mode. | |
| // This requires all data to be sent and received | | // This requires all data to be sent and received | |
| // via calls to Send and Receive. | | // via calls to Send and Receive. | |
| // As there are no notifications of data being | | // As there are no notifications of data being | |
| // available to send or receive, this is only recommended | | // available to send or receive, this is only recommended | |
| // for use with synchronous protocols over the channel. | | // for use with synchronous protocols over the channel. | |
| // | | // | |
| // Will throw a Barry::Error if the provided controller | | // Will throw a Barry::Error if the provided controller | |
| // doesn't have a routing queue set. | | // doesn't have a routing queue set. | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 5 lines changed or added | |
|
| router.h | | router.h | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
| class DataHandle; | | class DataHandle; | |
| | | | |
| class BXEXPORT SocketRoutingQueue | | class BXEXPORT SocketRoutingQueue | |
| { | | { | |
| friend class DataHandle; | | friend class DataHandle; | |
| | | | |
| public: | | public: | |
|
| | | // When registering interest in socket packets | |
| | | // this type is used to indicate what type of | |
| | | // packets are desired. | |
| | | enum InterestType | |
| | | { | |
| | | DataPackets = 0x1, | |
| | | SequencePackets = 0x2, | |
| | | SequenceAndDataPackets = DataPackets | SequencePackets | |
| | | }; | |
| | | | |
| // Interface class for socket data callbacks | | // Interface class for socket data callbacks | |
| // See RegisterInterest() for more information. | | // See RegisterInterest() for more information. | |
| class BXEXPORT SocketDataHandler | | class BXEXPORT SocketDataHandler | |
| { | | { | |
| public: | | public: | |
| // Called when data is received on the socket | | // Called when data is received on the socket | |
| // for which interest has been registered. | | // for which interest has been registered. | |
| // | | // | |
| // The lifetime of the data parameter is only valid | | // The lifetime of the data parameter is only valid | |
| // for the duration of this method call. | | // for the duration of this method call. | |
| | | | |
| skipping to change at line 88 | | skipping to change at line 98 | |
| virtual void DataReceived(Data& data) | | virtual void DataReceived(Data& data) | |
| { | | { | |
| m_callback(m_context, &data); | | m_callback(m_context, &data); | |
| } | | } | |
| }; | | }; | |
| | | | |
| struct QueueEntry | | struct QueueEntry | |
| { | | { | |
| SocketDataHandlerPtr m_handler; | | SocketDataHandlerPtr m_handler; | |
| DataQueue m_queue; | | DataQueue m_queue; | |
|
| | | InterestType m_type; | |
| | | | |
|
| QueueEntry(SocketDataHandlerPtr h) | | QueueEntry(SocketDataHandlerPtr h, InterestType t) | |
| : m_handler(h) | | : m_handler(h) | |
|
| | | , m_type(t) | |
| {} | | {} | |
| }; | | }; | |
| typedef std::tr1::shared_ptr<QueueEntry> QueueEntryPtr; | | typedef std::tr1::shared_ptr<QueueEntry> QueueEntryPtr; | |
| typedef uint16_t SocketId; | | typedef uint16_t SocketId; | |
| typedef std::map<SocketId, QueueEntryPtr> SocketQueueMap; | | typedef std::map<SocketId, QueueEntryPtr> SocketQueueMap; | |
| | | | |
| private: | | private: | |
| Usb::Device * volatile m_dev; | | Usb::Device * volatile m_dev; | |
| volatile int m_writeEp, m_readEp; | | volatile int m_writeEp, m_readEp; | |
| | | | |
| | | | |
| skipping to change at line 188 | | skipping to change at line 200 | |
| // Blocks until timeout or data is available. | | // Blocks until timeout or data is available. | |
| // Returns false (or null pointer) on timeout and no data. | | // Returns false (or null pointer) on timeout and no data. | |
| // With the return version of the function, there is no | | // With the return version of the function, there is no | |
| // copying performed. | | // copying performed. | |
| // | | // | |
| // Timeout is in milliseconds. Default timeout set by constructor | | // Timeout is in milliseconds. Default timeout set by constructor | |
| // is used if set to -1. | | // is used if set to -1. | |
| bool DefaultRead(Data &receive, int timeout = -1); | | bool DefaultRead(Data &receive, int timeout = -1); | |
| DataHandle DefaultRead(int timeout = -1); | | DataHandle DefaultRead(int timeout = -1); | |
| | | | |
|
| | | // Internal registration of interest in data from a certain socket, | |
| | | // filtered by a type. NOTE: most code should not use this function | |
| | | , | |
| | | // but use RegisterInterest() instead, since registering with the | |
| | | // wrong type could cause Socket::SyncSend() to malfunction. | |
| | | void RegisterInterestAndType(SocketId socket, | |
| | | SocketDataHandlerPtr handler, InterestType type); | |
| | | | |
| // Register an interest in data from a certain socket. To read | | // Register an interest in data from a certain socket. To read | |
| // from that socket, use the SocketRead() function from then on. | | // from that socket, use the SocketRead() function from then on. | |
| // Any non-registered socket goes in the default queue | | // Any non-registered socket goes in the default queue | |
| // and must be read by DefaultRead() | | // and must be read by DefaultRead() | |
| // If not null, handler is called when new data is read. It will | | // If not null, handler is called when new data is read. It will | |
| // be called in the same thread instance that DoRead() is called fro
m. | | // be called in the same thread instance that DoRead() is called fro
m. | |
| // Handler is passed the DataQueue Data object, and so no | | // Handler is passed the DataQueue Data object, and so no | |
| // copying is done. Once the handler returns, the data is | | // copying is done. Once the handler returns, the data is | |
| // considered processed and not added to the interested queue, | | // considered processed and not added to the interested queue, | |
| // but instead returned to m_free. | | // but instead returned to m_free. | |
|
| | | // | |
| | | // This simply calls RegisterInterestAndType(socket,handler,type) | |
| | | // with type set to SequenceAndDataPackets. Most code should use | |
| | | // this function. | |
| void RegisterInterest(SocketId socket, SocketDataHandlerPtr handler)
; | | void RegisterInterest(SocketId socket, SocketDataHandlerPtr handler)
; | |
| | | | |
| // Unregisters interest in data from the given socket, and discards | | // Unregisters interest in data from the given socket, and discards | |
| // any existing data in its interest queue. Any new incoming data | | // any existing data in its interest queue. Any new incoming data | |
| // for this socket will be placed in the default queue. | | // for this socket will be placed in the default queue. | |
| void UnregisterInterest(SocketId socket); | | void UnregisterInterest(SocketId socket); | |
| | | | |
|
| | | // Changes the type of data that a client is interested in for a | |
| | | // certain socket. | |
| | | // Interest in the socket must have previously been registered by a | |
| | | // call to RegisterInterest() or RegisterInterestAndType(). | |
| | | void ChangeInterest(SocketId socket, InterestType type); | |
| | | | |
| // Reads data from the interested socket cache. Can only read | | // Reads data from the interested socket cache. Can only read | |
| // from sockets that have been previously registered. | | // from sockets that have been previously registered. | |
| // Blocks until timeout or data is available. | | // Blocks until timeout or data is available. | |
| // Returns false (or null pointer) on timeout and no data. | | // Returns false (or null pointer) on timeout and no data. | |
| // With the return version of the function, there is no | | // With the return version of the function, there is no | |
| // copying performed. | | // copying performed. | |
| // | | // | |
| // Timeout is in milliseconds. Default timeout set by constructor | | // Timeout is in milliseconds. Default timeout set by constructor | |
| // is used if set to -1. | | // is used if set to -1. | |
| bool SocketRead(SocketId socket, Data &receive, int timeout = -1); | | bool SocketRead(SocketId socket, Data &receive, int timeout = -1); | |
| | | | |
End of changes. 7 change blocks. |
| 1 lines changed or deleted | | 31 lines changed or added | |
|
| socket.h | | socket.h | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 112 | |
| // - 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); | |
|
| | | // Opens a new socket and returns a Socket object to manage it | |
| | | // Registers the provided handler interested in socket data. | |
| | | // This avoids the race where calling RegisterInterest immediately | |
| | | // on the returned SocketHandle can still miss incoming data. | |
| | | SocketHandle Open( | |
| | | Barry::SocketRoutingQueue::SocketDataHandlerPtr handler, | |
| | | uint16_t socket, const char *password = 0); | |
| void Close(Socket &socket); | | void Close(Socket &socket); | |
| }; | | }; | |
| | | | |
| class BXEXPORT SocketBase | | class BXEXPORT SocketBase | |
| { | | { | |
| bool m_resetOnClose; | | bool m_resetOnClose; | |
| | | | |
| protected: | | protected: | |
| void CheckSequence(const Data &seq); | | void CheckSequence(const Data &seq); | |
| | | | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 150 | |
| virtual void Close() = 0; | | virtual void Close() = 0; | |
| | | | |
| // FIXME - do I need RawSend? Or just a good fragmenter? | | // FIXME - do I need RawSend? Or just a good fragmenter? | |
| virtual void RawSend(Data &send, int timeout = -1) = 0; | | virtual void RawSend(Data &send, int timeout = -1) = 0; | |
| virtual void SyncSend(Data &send, int timeout = -1) = 0; | | virtual void SyncSend(Data &send, int timeout = -1) = 0; | |
| virtual void Receive(Data &receive, int timeout = -1) = 0; | | virtual void Receive(Data &receive, int timeout = -1) = 0; | |
| | | | |
| virtual void RegisterInterest(Barry::SocketRoutingQueue::SocketDataH
andlerPtr handler = Barry::SocketRoutingQueue::SocketDataHandlerPtr()) = 0; | | virtual void RegisterInterest(Barry::SocketRoutingQueue::SocketDataH
andlerPtr handler = Barry::SocketRoutingQueue::SocketDataHandlerPtr()) = 0; | |
| virtual void UnregisterInterest() = 0; | | virtual void UnregisterInterest() = 0; | |
| | | | |
|
| | | // Used to notify the socket when the connection is being opened | |
| | | virtual void Opening(Barry::SocketRoutingQueue::SocketDataHandlerPtr | |
| | | handler) = 0; | |
| | | // Used to notify the socket when the connection has been successful | |
| | | ly opened | |
| | | virtual void Opened() = 0; | |
| | | | |
| void ResetOnClose(bool reset = true) { m_resetOnClose = reset; } | | void ResetOnClose(bool reset = true) { m_resetOnClose = reset; } | |
| bool IsResetOnClose() const { return m_resetOnClose; } | | bool IsResetOnClose() const { return m_resetOnClose; } | |
| | | | |
| // | | // | |
| // Convenience functions that just call the virtuals above | | // Convenience functions that just call the virtuals above | |
| // | | // | |
| void DBFragSend(Data &send, int timeout = -1); | | void DBFragSend(Data &send, int timeout = -1); | |
| void Send(Data &send, Data &receive, int timeout = -1); | | void Send(Data &send, Data &receive, int timeout = -1); | |
| void Send(Barry::Packet &packet, int timeout = -1); | | void Send(Barry::Packet &packet, int timeout = -1); | |
| | | | |
| | | | |
| skipping to change at line 241 | | skipping to change at line 253 | |
| void Receive(Data &receive, int timeout = -1); | | void Receive(Data &receive, int timeout = -1); | |
| | | | |
| // 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. | |
| // It also assumes that nothing has been registered before. | | // It also assumes that nothing has been registered before. | |
| // If you wish to re-register, call UnregisterInterest() first, | | // If you wish to re-register, call UnregisterInterest() first, | |
| // which is safe to call as many times as you like. | | // which is safe to call as many times as you like. | |
| void RegisterInterest(Barry::SocketRoutingQueue::SocketDataHandlerPt
r handler = Barry::SocketRoutingQueue::SocketDataHandlerPtr()); | | void RegisterInterest(Barry::SocketRoutingQueue::SocketDataHandlerPt
r handler = Barry::SocketRoutingQueue::SocketDataHandlerPtr()); | |
| void UnregisterInterest() { LocalUnregisterInterest(); } | | void UnregisterInterest() { LocalUnregisterInterest(); } | |
|
| | | | |
| | | void Opening(Barry::SocketRoutingQueue::SocketDataHandlerPtr handler | |
| | | ); | |
| | | void Opened(); | |
| }; | | }; | |
| | | | |
| } // namespace Barry | | } // namespace Barry | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 0 lines changed or deleted | | 18 lines changed or added | |
|