
/*---------------------------------------------------------------------------*/
/* set_certificate_handler.h                                                 */
/* copyright (c) innovaphone 2016                                            */
/*                                                                           */
/*---------------------------------------------------------------------------*/

class SetCertificateHandler {
private:
    IWebserverMessage * webserverMessageSend;
    IInstanceLog * const log;
    class Webserver * const webserver;
    char * hostName;
    char * password;
    byte * certBuffer;
    size_t certSize;
    byte * curBufPos;
    size_t dataToRead;

public:
    SetCertificateHandler(class Webserver * webserver, IWebserverMessage * webserverMessageSend, IInstanceLog * const log);
    virtual ~SetCertificateHandler();

    virtual void HandleMessage(dword msgState, byte * dataBuffer, size_t len);

    byte * DataBuffer() { return this->curBufPos; }
    size_t DataBufferSize() { return this->dataToRead > WS_MAX_DATA_SIZE ? WS_MAX_DATA_SIZE : this->dataToRead; }
};