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.

52 lines
1.5 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. if (!Package)return false;
  27. return false;
  28. }
  29. public:
  30. // Constructor
  31. protocolHTTP();
  32. explicit protocolHTTP(config_setting_t * Settings);
  33. // ToDo: change Serial to BaseClass of some kind of socket
  34. // protocolHTTP( clientPort *SocketTransport, config_setting_t *Settings = NULL );
  35. // Destructor
  36. virtual ~protocolHTTP();
  37. bool loadSettings(config_setting_t * Settings);
  38. bool issueGet(CSTR URL);
  39. bool issuePost(CSTR URL, char * Buffer, int & BufferSize);
  40. /*virtual bool init(){ return true; };*/
  41. static void * requestFinished(void *, void *);
  42. };
  43. #endif