Teonet library
0.4.7
|
#include <teonet.hpp>
Inherited by MyTeonet, MyTeonet, MyTeonet, MyTeonet, and MyTeonet.
Data Structures | |
class | CQue |
Teonet CQue callback function. More... | |
class | LogReader |
class | TeoDB |
Public Types | |
typedef void(* | teoEventsCb )(Teonet &teo, teoEvents event, void *data, size_t data_len, void *user_data) |
Teonet event callback. More... | |
typedef ksnCQueData | cqueData |
typedef ksnCQueCallback | cqueCallback |
Teonet CQue data structure. More... | |
Public Member Functions | |
ksnetEvMgrClass * | getKe () const |
Teonet class version. More... | |
Teonet (int argc, char **argv, teoEventsCb event_cb=NULL, int options=READ_ALL, int port=0, void *user_data=NULL) | |
Teonet constructor. More... | |
virtual | ~Teonet () |
Teonet simple destructor. More... | |
void | setAppType (const char *type) |
Set Teonet application type. More... | |
void | setAppVersion (const char *version) |
Set Teonet application version. More... | |
int | run () |
Start Teonet Event Manager and network communication. More... | |
void | BroadcastSend (const char *to, uint8_t cmd, void *data, size_t data_len) const |
Send command by name to peer. More... | |
ksnet_arp_data * | sendTo (const char *to, uint8_t cmd, void *data, size_t data_len) const |
ksnet_arp_data * | sendTo (const char *to, uint8_t cmd, const std::string &data) const |
void | sendToA (const char *to, uint8_t cmd, void *data, size_t data_len) const |
Send command by name to peer(asynchronously) More... | |
void | sendToA (const char *to, uint8_t cmd, const std::string &data) const |
void | sendAnswerTo (teo::teoPacket *rd, const char *name, void *data, size_t data_len) const |
Sent teonet command to peer or l0 client depend of input rd. More... | |
void | sendAnswerTo (teo::teoPacket *rd, const char *name, const std::string &data) const |
void | sendAnswerToA (teo::teoPacket *rd, uint8_t cmd, void *data, size_t data_len) const |
Sent teonet command to peer or l0 client depend of input rd (asynchronously) More... | |
void | sendAnswerToA (teo::teoPacket *rd, uint8_t cmd, const std::string &data) const |
int | sendEchoTo (const char *to, void *data=NULL, size_t data_len=0) const |
Send ECHO command to peer. More... | |
int | sendToL0 (const char *addr, int port, const char *cname, size_t cname_length, uint8_t cmd, void *data, size_t data_len) const |
Send data to L0 client. More... | |
int | sendToL0 (const char *addr, int port, const std::string &cname, uint8_t cmd, void *data, size_t data_len) const |
int | sendToL0 (const char *addr, int port, const std::string &cname, uint8_t cmd, const std::string &data) const |
int | sendToL0 (teoL0Client *l0cli, uint8_t cmd, void *data, size_t data_len) const |
Send data to L0 client with the teoL0Client structure. More... | |
void | sendToL0A (const char *addr, int port, const char *cname, size_t cname_length, uint8_t cmd, void *data, size_t data_len) const |
Send data to L0 client. More... | |
int | sendEchoToL0 (const char *addr, int port, const char *cname, size_t cname_length, void *data, size_t data_len) const |
Send ECHO command to L0 client. More... | |
int | sendEchoToL0A (const char *addr, int port, const char *cname, size_t cname_length, void *data, size_t data_len) const |
int | sendEchoToL0 (teoL0Client *l0cli, void *data, size_t data_len) const |
Send ECHO command to L0 client with teoL0Client structure. More... | |
int | sendEchoToL0A (teoL0Client *l0cli, void *data, size_t data_len) const |
void | subscribe (const char *peer_name, uint16_t ev) const |
void | subscribeA (const char *peer_name, uint16_t ev) const |
void | sendToSscr (uint16_t ev, void *data, size_t data_length, uint8_t cmd=0) const |
void | sendToSscr (uint16_t ev, const std::string &data, uint8_t cmd=0) const |
void | sendToSscrA (uint16_t ev, const std::string &data, uint8_t cmd=0) const |
void | setCustomTimer (double time_interval=2.00) |
Set custom timer interval. More... | |
const char * | getClassVersion () const |
Get this class version. More... | |
const char * | getHostName () const |
Return host name. More... | |
const char * | getParam (int parm_number) const |
Get additional application command line parameter defined in teoAppParam. More... | |
double | getTime () const |
Get KSNet event manager time. More... | |
const std::string | getPath () |
Get path to teonet data folder. More... | |
void | stop () |
Stop Teonet event manager. More... | |
teo::teoPacket * | getPacket (void *data) const |
Cast data to teo::teoPacket. More... | |
void | metricCounter (const std::string &name, int value) |
Send counter metric. More... | |
void | metricCounter (const std::string &name, double value) |
Send counter metric. More... | |
void | metricMs (const std::string &name, double value) |
Send time(ms) metric. More... | |
void | metricGauge (const std::string &name, int value) |
Send gauge metric. More... | |
void | metricGauge (const std::string &name, double value) |
Send gauge metric. More... | |
virtual void | eventCb (teo::teoEvents event, void *data, size_t data_len, void *user_data) |
Virtual Teonet event callback. More... | |
virtual void | cqueueCb (uint32_t id, int type, void *data) |
template<typename... Arguments> | |
std::string | formatMessage (const char *format, const Arguments &...args) |
CQue::cquePtr | getCQueP () |
CQue class factory(maker) More... | |
CQue & | getCQueR () |
CQue class factory(maker) More... | |
template<typename T > | |
T | getCQue () |
CQue class factory(maker) More... | |
Static Public Member Functions | |
static const char * | getTeonetVersion () |
Get Teonet library version. More... | |
static teo::teoAppParam * | appParam (std::vector< const char * > params, std::vector< const char * > params_description) |
Create Application parameters. More... | |
typedef ksnCQueData teo::Teonet::cqueData |
typedef void(* teo::Teonet::teoEventsCb)(Teonet &teo, teoEvents event, void *data, size_t data_len, void *user_data) |
Teonet event callback.
|
inline |
Teonet constructor.
Initialize KSNet Event Manager and network and set new default port
argc | Number of applications arguments (from main) |
argv | Applications arguments array (from main) |
event_cb | Events callback function called when an event happens |
options | Options set: READ_OPTIONS - read options from command line parameters; READ_CONFIGURATION - read options from configuration file |
port | Set default port number if non 0 |
user_data | Pointer to user data or NULL if absent |
References data, eventCb(), ksnetEvMgrInitPort(), and ksnetEvMgrClass::teo_class.
|
inlinevirtual |
Teonet simple destructor.
|
inlinestatic |
Create Application parameters.
params | |
params_description |
References ksnetEvMgrAppParam::app_argc, ksnetEvMgrAppParam::app_argv, and ksnetEvMgrAppParam::app_descr.
|
inline |
Send command by name to peer.
kc | Pointer to ksnCoreClass |
to | Peer name to send to |
cmd | Command |
data | Commands data |
data_len | Commands data length |
References ksnetEvMgrClass::kc, and teoBroadcastSend().
|
inlinevirtual |
|
inlinevirtual |
|
inline |
References free(), and ksnet_formatMessage().
|
inline |
Get this class version.
|
inline |
CQue class factory(maker)
|
inline |
|
inline |
CQue class factory(maker)
References getCQueP().
Referenced by event_cb().
|
inline |
|
inline |
Teonet class version.
Referenced by teo::Teonet::TeoDB::getKe(), getParam(), and teo::Teonet::LogReader::open().
|
inline |
Cast data to teo::teoPacket.
data | Pointer to data |
References data.
Referenced by event_cb(), and teo::Teonet::TeoDB::process().
|
inline |
Get additional application command line parameter defined in teoAppParam.
parm_number | Number of application parameter (started from 1) |
References teonet_cfg::app_argv, getKe(), and ksnetEvMgrClass::teo_cfg.
|
inline |
Get path to teonet data folder.
References free(), and getDataPath().
|
inlinestatic |
|
inline |
Get KSNet event manager time.
ke | Pointer to ksnetEvMgrClass |
References ksnetEvMgrGetTime().
|
inline |
Send counter metric.
name | Metric name |
value | Metric counter value |
References teoMetricCounter(), and ksnetEvMgrClass::tm.
|
inline |
Send counter metric.
name | Metric name |
value | Metric counter value |
References teoMetricCounterf(), and ksnetEvMgrClass::tm.
|
inline |
Send gauge metric.
name | Metric name |
value | Metric gauge value |
References teoMetricGauge(), and ksnetEvMgrClass::tm.
|
inline |
Send gauge metric.
name | Metric name |
value | Metric gauge value |
References teoMetricGaugef(), and ksnetEvMgrClass::tm.
|
inline |
Send time(ms) metric.
name | Metric name |
value | Metric ms value |
References teoMetricMs(), and ksnetEvMgrClass::tm.
|
inline |
Start Teonet Event Manager and network communication.
References ksnetEvMgrRun().
|
inline |
Sent teonet command to peer or l0 client depend of input rd.
ke | Pointer to ksnetEvMgrClass |
rd | Pointer to rd |
name | Name to send to |
data | |
data_len |
References sendCmdAnswerTo.
Referenced by sendAnswerTo().
|
inline |
References sendAnswerTo().
|
inline |
Sent teonet command to peer or l0 client depend of input rd (asynchronously)
ke | Pointer to ksnetEvMgrClass |
rd | Pointer to rd |
name | Name to send to |
data | |
data_len |
References sendCmdAnswerToBinaryA().
|
inline |
References sendCmdAnswerToBinaryA().
|
inline |
Send ECHO command to peer.
to | Peer name to send to |
cmd | Command |
data | Commands data |
data_len | Commands data length |
References data, ksnetEvMgrClass::kc, ksnCoreClass::kco, and ksnCommandSendCmdEcho().
|
inline |
Send ECHO command to L0 client.
addr | IP address of remote peer |
port | Port of remote peer |
cname | L0 client name (include trailing zero) |
cname_length | Length of the L0 client name |
cmd | Command |
data | Data |
data_len | Data length |
References ksnLNullSendEchoToL0().
Referenced by sendEchoToL0().
|
inline |
Send ECHO command to L0 client with teoL0Client structure.
l0cli | Pointer to teoL0Client |
data | Data |
data_len | Data length |
References teo::teoL0Client::addr, teo::teoL0Client::name, teo::teoL0Client::name_len, teo::teoL0Client::port, and sendEchoToL0().
|
inline |
References ksnLNullSendEchoToL0A().
Referenced by sendEchoToL0A().
|
inline |
|
inline |
References ksnetEvMgrClass::kc, and ksnCoreSendCmdto().
Referenced by sendTo().
|
inline |
References sendTo().
|
inline |
Send command by name to peer(asynchronously)
kc | Pointer to ksnCoreClass |
to | Peer name to send to |
cmd | Command |
data | Commands data |
data_len | Commands data length |
References ksnCoreSendCmdtoA().
Referenced by sendToA().
|
inline |
References sendToA().
|
inline |
Send data to L0 client.
Usually it is an answer to request from L0 client
addr | IP address of remote peer |
port | Port of remote peer |
cname | L0 client name (include trailing zero) |
cname_length | Length of the L0 client name |
cmd | Command |
data | Data |
data_len | Data length |
References ksnLNullSendToL0().
Referenced by sendToL0().
|
inline |
References data, and sendToL0().
|
inline |
References sendToL0().
|
inline |
Send data to L0 client with the teoL0Client structure.
l0cli | Pointer to teoL0Client |
cmd | Command |
data | Data |
data_len | Data length |
References teo::teoL0Client::addr, teo::teoL0Client::name, teo::teoL0Client::name_len, teo::teoL0Client::port, and sendToL0().
|
inline |
Send data to L0 client.
Usually it is an answer to request from L0 client(asynchronously)
addr | IP address of remote peer |
port | Port of remote peer |
cname | L0 client name (include trailing zero) |
cname_length | Length of the L0 client name |
cmd | Command |
data | Data |
data_len | Data length |
References ksnCorePacketData::addr, ksnCorePacketData::from, ksnCorePacketData::from_len, ksnCorePacketData::l0_f, ksnCorePacketData::port, rd, and sendCmdAnswerToBinaryA().
|
inline |
References ksnetEvMgrClass::kc, ksnCoreClass::kco, ksnCommandClass::ksscr, and teoSScrSend().
Referenced by sendToSscr().
|
inline |
References sendToSscr().
|
inline |
References teoSScrSendA().
|
inline |
|
inline |
Set Teonet application version.
version | Application version string |
References teoSetAppVersion().
|
inline |
Set custom timer interval.
time_interval |
References ksnetEvMgrSetCustomTimer().
|
inline |
Stop Teonet event manager.
References ksnetEvMgrStop().
Referenced by event_cb().
|
inline |
References ksnetEvMgrClass::kc, ksnCoreClass::kco, ksnCommandClass::ksscr, and teoSScrSubscribe().
|
inline |
References ksnetEvMgrClass::kc, ksnCoreClass::kco, ksnCommandClass::ksscr, and teoSScrSubscribeA().