BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Public Member Functions | Protected Member Functions
BeeeOn::AbstractHTTPScanner Class Referenceabstract

The abstract class contains core of HTTP scanning of network. Derivated classes will have to implement methods to prepare HTTP request and if the response is from right device. More...

#include <AbstractHTTPScanner.h>

Inheritance diagram for BeeeOn::AbstractHTTPScanner:
BeeeOn::Loggable BeeeOn::VPTHTTPScanner

Public Member Functions

 AbstractHTTPScanner (const std::string &path, uint16_t port, const Poco::Net::IPAddress &minNetMask)
 
std::vector
< Poco::Net::SocketAddress > 
scan (const uint32_t maxResponseLength)
 It executes the scan of proper network interfaces. More...
 
void cancel ()
 
void setPath (const std::string &path)
 
void setPort (Poco::UInt16 port)
 
void setMinNetMask (const Poco::Net::IPAddress &minNetMask)
 
void setPingTimeout (const Poco::Timespan &pingTimeout)
 
void setHTTPTimeout (const Poco::Timespan &httpTimeout)
 
void setBlackList (const std::set< std::string > &set)
 
std::string path ()
 
Poco::UInt16 port ()
 

Protected Member Functions

virtual void prepareRequest (Poco::Net::HTTPRequest &request)=0
 
virtual bool isValidResponse (const std::string &response)=0
 It defines if the response is valid or not. More...
 
void probeInterface (StopControl::Run &run, const Poco::Net::NetworkInterface &interface, std::vector< Poco::Net::SocketAddress > &devices, const Poco::Int64 maxResponseLength)
 It explores network interface. More...
 
void probeAddressRange (StopControl::Run &run, const IPAddressRange &range, std::vector< Poco::Net::SocketAddress > &devices, const Poco::Int64 maxResponseLength)
 It explores IP address range. More...
 
HTTPEntireResponse sendRequest (const Poco::Net::SocketAddress &socketAddress, const Poco::Int64 maxResponseLength)
 It sends HTTP request. More...
 
bool addressIncompatible (const Poco::Net::NetworkInterface::AddressTuple &addressTuple) const
 
std::vector
< Poco::Net::NetworkInterface > 
listNetworkInterfaces ()
 
- Protected Member Functions inherited from BeeeOn::Loggable
void setupLogger (Poco::Logger *logger=0) const
 
Poco::Logger & logger () const
 
 Loggable (const ClassInfo &info)
 
 Loggable (const std::type_info &info)
 

Additional Inherited Members

- Static Protected Member Functions inherited from BeeeOn::Loggable
static Poco::Logger & forMethod (const char *name)
 
static Poco::Logger & forClass (const ClassInfo &info)
 
static Poco::Logger & forClass (const std::type_info &info)
 
template<typename T >
static Poco::Logger & forInstance (const T *i)
 
static void configureSimple (Poco::Logger &logger, const std::string &level)
 
static void logException (Poco::Logger &logger, const Poco::Message::Priority priority, const Poco::Exception &e, const char *file, size_t line)
 

Detailed Description

The abstract class contains core of HTTP scanning of network. Derivated classes will have to implement methods to prepare HTTP request and if the response is from right device.

Constructor & Destructor Documentation

BeeeOn::AbstractHTTPScanner::AbstractHTTPScanner ( const std::string &  path,
uint16_t  port,
const Poco::Net::IPAddress &  minNetMask 
)
Parameters
pathDefines path of HTTP request.
portDefines receiver's port.
minNetMaskDefines minimal range of exploring IP address.

Member Function Documentation

virtual bool BeeeOn::AbstractHTTPScanner::isValidResponse ( const std::string &  response)
protectedpure virtual

It defines if the response is valid or not.

Parameters
responseResponse message.
Returns
If the response is valid or not.

Implemented in BeeeOn::VPTHTTPScanner.

vector< NetworkInterface > AbstractHTTPScanner::listNetworkInterfaces ( )
protected
Returns
Vector of active network interfaces.
void AbstractHTTPScanner::probeAddressRange ( StopControl::Run run,
const IPAddressRange range,
std::vector< Poco::Net::SocketAddress > &  devices,
const Poco::Int64  maxResponseLength 
)
protected

It explores IP address range.

Parameters
rangeExploring IP address range.
devicesStructure where are found devices saved.
maxResponseLengthDefines maximal length of response message which will be process.
void AbstractHTTPScanner::probeInterface ( StopControl::Run run,
const Poco::Net::NetworkInterface &  interface,
std::vector< Poco::Net::SocketAddress > &  devices,
const Poco::Int64  maxResponseLength 
)
protected

It explores network interface.

Parameters
interafceExploring interface.
devicesStructure where are found devices saved.
maxResponseLengthDefines maximal length of response message which will be process.
vector< SocketAddress > AbstractHTTPScanner::scan ( const uint32_t  maxResponseLength)

It executes the scan of proper network interfaces.

Parameters
maxResponseLengthDefines maximal length of response message which will be process.
Returns
Vector of SocketAddress belongs to found devices.
HTTPEntireResponse AbstractHTTPScanner::sendRequest ( const Poco::Net::SocketAddress &  socketAddress,
const Poco::Int64  maxResponseLength 
)
protected

It sends HTTP request.

Parameters
socketAddressAddress of receiver.
maxResponseLengthDefines maximal length of response message which will be process.
Returns
HTTP response.

The documentation for this class was generated from the following files: