Inheritance diagram for enet::Http:
enet::HttpClient enet::HttpServer

Public Types

using Observer = std::function< void(std::vector< uint8_t > &)>
 
using ObserverRaw = std::function< void(enet::Tcp &)>
 
using ObserverRequest = std::function< void(const enet::HttpRequest &)>
 
using ObserverAnswer = std::function< void(const enet::HttpAnswer &)>
 

Public Member Functions

 Http (enet::Tcp _connection, bool _isServer=false)
 
bool getServerState ()
 
bool isServer ()
 
const enet::HttpRequestgetRequestHeader ()
 
const enet::HttpAnswergetAnswerHeader ()
 
void start ()
 
void stop (bool _inThread=false)
 
bool isAlive () const
 
template<class CLASS_TYPE >
void connect (CLASS_TYPE *_class, void(CLASS_TYPE::*_func)(std::vector< uint8_t > &))
 
void connect (Observer _func)
 
template<class CLASS_TYPE >
void connectRaw (CLASS_TYPE *_class, void(CLASS_TYPE::*_func)(enet::Tcp &))
 
void connectRaw (ObserverRaw _func)
 
int32_t write (const void *_data, int32_t _len)
 
int32_t write (const std::string &_data, bool _writeBackSlashZero=true)
 
template<class T >
int32_t write (const std::vector< T > &_data)
 

Public Attributes

Observer m_observer
 
ObserverRaw m_observerRaw
 

Protected Member Functions

void setRequestHeader (const enet::HttpRequest &_req)
 
void setAnswerHeader (const enet::HttpAnswer &_req)
 

Protected Attributes

enet::HttpRequest m_requestHeader
 
enet::HttpAnswer m_answerHeader
 
enet::Tcp m_connection
 
bool m_headerIsSend
 
std::thread * m_thread
 
bool m_threadRunning
 
std::vector< uint8_t > m_temporaryBuffer
 
ObserverRequest m_observerRequest
 
ObserverAnswer m_observerAnswer
 

Member Typedef Documentation

§ Observer

using enet::Http::Observer = std::function<void(std::vector<uint8_t>&)>

Define an Observer: function pointer.

§ ObserverAnswer

using enet::Http::ObserverAnswer = std::function<void(const enet::HttpAnswer&)>

Define an Observer: function pointer.

§ ObserverRaw

using enet::Http::ObserverRaw = std::function<void(enet::Tcp&)>

Define an Observer: function pointer.

§ ObserverRequest

using enet::Http::ObserverRequest = std::function<void(const enet::HttpRequest&)>

Define an Observer: function pointer.

Member Function Documentation

§ connect()

template<class CLASS_TYPE >
void enet::Http::connect ( CLASS_TYPE *  _class,
void(CLASS_TYPE::*)(std::vector< uint8_t > &)  _func 
)
inline

Connect an function member on the signal with the shared_ptr object.

Parameters
[in]_classshared_ptr Object on whe we need to call ==> the object is get in keeped in weak_ptr.
[in]_funcFunction to call.
[in]_argsArgument optinnal the user want to add.

§ connectRaw()

template<class CLASS_TYPE >
void enet::Http::connectRaw ( CLASS_TYPE *  _class,
void(CLASS_TYPE::*)(enet::Tcp &)  _func 
)
inline

Connect an function member on the signal with the shared_ptr object.

Parameters
[in]_classshared_ptr Object on whe we need to call ==> the object is get in keeped in weak_ptr.
[in]_funcFunction to call.
[in]_argsArgument optinnal the user want to add.

§ write() [1/3]

int32_t enet::Http::write ( const void *  _data,
int32_t  _len 
)

Write a chunk of data on the socket.

Parameters
[in]_datapointer on the data might be write
[in]_lenSize that must be written socket
Returns
>0 byte size on the socket write
-1 an error occured.

§ write() [2/3]

int32_t enet::Http::write ( const std::string &  _data,
bool  _writeBackSlashZero = true 
)
inline

Write a chunk of data on the socket.

Parameters
[in]_dataString to rite on the soccket
[in]_writeBackSlashZeroif false, the \0 is not write
Returns
>0 byte size on the socket write
-1 an error occured.

§ write() [3/3]

template<class T >
int32_t enet::Http::write ( const std::vector< T > &  _data)
inline

Write a chunk of data on the socket.

Parameters
[in]_dataString to rite on the soccket
[in]_writeBackSlashZeroif false, the \0 is not write
Returns
>0 T element write on the socket
-1 an error occured.

The documentation for this class was generated from the following file:
  • framework/atria-soft/enet/enet/Http.hpp