Bredbandskollen CLI  1.2
Asynchronous network task engine
rpingtask.h
1 // Copyright (c) 2018 IIS (The Internet Foundation in Sweden)
2 // Written by Göran Andersson <initgoran@gmail.com>
3 
4 #pragma once
5 
6 #include "measurementtask.h"
7 
8 class RpingTask : public MeasurementTask {
9 public:
10  RpingTask(const std::string &label, const std::string &ticket_string,
11  const HttpHost &server,
12  unsigned int no_conn = 1, unsigned int max_conn = 20,
13  double duration = 25.0) :
14  MeasurementTask(label, ticket_string, server,
15  no_conn, max_conn, duration)
16  {
17  }
18  void newRequest(HttpClientConnection *) override;
20  return false;
21  }
22  bool websocketUpgrade(HttpClientConnection *) override;
23  bool wsTextMessage(HttpConnection *conn,
24  const std::string &msg) override;
25  void calc_local_result();
26 private:
27  std::vector<double> samples;
28  unsigned int max_roundtrips = 100;
29  bool sent_challenge = false;
30 };
HTTP/1.1 client protocol.
Definition: httpclientconnection.h:39
Definition: httpconnection.h:11
The host name and port number of a HTTP host.
Definition: httphost.h:17
std::string label() const
Return the object's log label.
Definition: logger.h:251
Definition: measurementtask.h:9
Definition: rpingtask.h:8
bool requestComplete(HttpClientConnection *) override
Called when response has been fully read.
Definition: rpingtask.h:19
bool websocketUpgrade(HttpClientConnection *) override
Called after succesful websocket upgrade.
Definition: rpingtask.cpp:57
void newRequest(HttpClientConnection *) override
Initiate next request, or ignore to close connection.
Definition: rpingtask.cpp:7
bool wsTextMessage(HttpConnection *conn, const std::string &msg) override
Incoming websocket text message. Return false to kill connection.
Definition: rpingtask.cpp:11