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.

51 lines
1.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __PROTOCOL_HTTP_STREAM_HEADER__
  2. #define __PROTOCOL_HTTP_STREAM_HEADER__
  3. #include "../../components/base/basicSettingsProvider.h"
  4. #include "../../components/base/basicTransport.h"
  5. #include "../../data/curl/curlRequestsManager.h"
  6. #include "../../data/net/clientPort.h"
  7. #include "protocol.h"
  8. #define HTTP_PROTOCOL_CONTENT_SETTINGS "CURL_POST_CONTENT_TYPE"
  9. /**
  10. * TODO: Add class description
  11. *
  12. * @author gagua
  13. */
  14. class protocolHTTP /*: public protocolParser */
  15. {
  16. protected:
  17. basicLogCollection * m_pLog;
  18. curlRequestsManager * m_pHttpAccessManager;
  19. CSTR m_pCurlPostType;
  20. config_setting_t * m_pSettings;
  21. // clientPort *m_oDataTransport;
  22. // int packetChecker(unsigned char *Buffer, size_t BufferSize);
  23. // protocolPackage *packetExtractor(unsigned char *Buffer, size_t BufferSize);
  24. virtual bool packetHandler(protocolPackage * Package)
  25. {
  26. return false;
  27. }
  28. public:
  29. // Constructor
  30. protocolHTTP();
  31. explicit protocolHTTP(config_setting_t * Settings);
  32. // ToDo: change Serial to BaseClass of some kind of socket
  33. // protocolHTTP( clientPort *SocketTransport, config_setting_t *Settings = NULL );
  34. // Destructor
  35. virtual ~protocolHTTP();
  36. bool loadSettings(config_setting_t * Settings);
  37. bool issueGet(CSTR URL);
  38. bool issuePost(CSTR URL, char * Buffer, int & BufferSize);
  39. /*virtual bool init(){ return true; };*/
  40. static void * requestFinished(void *, void *);
  41. };
  42. #endif