You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASIC_TNSPORT_HEADERS__
  2. #define __BASIC_TNSPORT_HEADERS__
  3. #include "basicLogCollection.h"
  4. #include "basicMutex.h"
  5. #include <algorithm>
  6. #include <vector>
  7. #ifdef DEBUG
  8. // #ifndef DUBUG_COMMUNICATION
  9. // #define DUBUG_COMMUNICATION
  10. // #endif
  11. #endif
  12. class protocolParser;
  13. typedef std::vector<protocolParser *> parseQueue;
  14. class basicTransport
  15. {
  16. private:
  17. basicLogCollection * m_pLog;
  18. protected:
  19. parseQueue m_vParsers;
  20. basicMutex m_mQueueProtectorMutex;
  21. basicMutex m_mBufferProtectorMutex;
  22. CONNECTION_STATUS m_eConnectionStatus;
  23. public:
  24. basicTransport();
  25. ~basicTransport();
  26. virtual bool sendData(unsigned char * Data, int DataSize)
  27. {
  28. return true;
  29. }
  30. virtual bool reconnect(void)
  31. {
  32. return false;
  33. }
  34. bool addRecipient(protocolParser * ProtoParser);
  35. bool removeRecipient(protocolParser * ProtoParser);
  36. bool getStatus(void)
  37. {
  38. return m_eConnectionStatus == CS_CONNECTED;
  39. }
  40. void setConnectionStatus(CONNECTION_STATUS ES);
  41. CONNECTION_STATUS getConnectionStatus(void);
  42. virtual int getRawHandle(void)
  43. {
  44. return -1;
  45. }
  46. };
  47. #endif