You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

QDnsServer.h 956B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // Created by robin on 1/31/18.
  3. //
  4. #ifndef QDNSAGG_QDNSSERVER_H
  5. #define QDNSAGG_QDNSSERVER_H
  6. #include <QtCore/QObject>
  7. #include <dns-base/QDnsPacket.h>
  8. #include <QtNetwork/QHostAddress>
  9. #include <functional>
  10. namespace QDns
  11. {
  12. namespace Server
  13. {
  14. class QDnsServer : public QObject
  15. {
  16. Q_OBJECT
  17. public:
  18. struct SendAnswerParams
  19. {
  20. QDns::Base::QDnsPacket answer;
  21. };
  22. struct OnRequestParams
  23. {
  24. QDns::Base::QDnsPacket query;
  25. QHostAddress senderAddress;
  26. quint16 senderPort;
  27. std::function<void(SendAnswerParams)> sendAnswer;
  28. };
  29. signals:
  30. void onRequest(OnRequestParams params); // TODO add onError
  31. public slots:
  32. virtual bool start(const QHostAddress& host, quint16 port) = 0;
  33. };
  34. }
  35. }
  36. #endif //QDNSAGG_QDNSSERVER_H