diff options
Diffstat (limited to 'src/uaLookup.hpp')
-rw-r--r-- | src/uaLookup.hpp | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/src/uaLookup.hpp b/src/uaLookup.hpp index 5529a40..9714253 100644 --- a/src/uaLookup.hpp +++ b/src/uaLookup.hpp @@ -1,34 +1,21 @@ #pragma once -#include "util.hpp" +#include "curlOp.hpp" +#include "logTypes.hpp" +#include <connection_fwd.h> #include <curl/curl.h> #include <memory> -#include <stdexcept> -#include <string> namespace WebStat { - class CurlError : public std::runtime_error { + class UserAgentLookupOperation : public CurlOperation { public: - explicit CurlError(CURLcode code, const char * msg) : std::runtime_error {msg}, code(code) { } + UserAgentLookupOperation(Crc32Value entityId); - CURLcode code; - }; - - using CurlPtr = std::unique_ptr<CURL, DeleteWith<&curl_easy_cleanup>>; - using CurlMimePtr = std::unique_ptr<curl_mime, DeleteWith<&curl_mime_free>>; - using CurlErrorBuf = std::array<char, CURL_ERROR_SIZE>; - using CurlMultiPtr = std::unique_ptr<CURLM, DeleteWith<&curl_multi_cleanup>>; - - class CurlOperation { - public: - CurlOperation(); - void addForm(const char * name, std::string_view data); + void whenComplete(DB::Connection *) const override; - CurlPtr hnd; - CurlMimePtr mime; - CurlErrorBuf err; - std::string result; + Crc32Value entityId; }; - std::unique_ptr<CurlOperation> curlGetUserAgentDetail(std::string_view uas, const char * baseUrl); + std::unique_ptr<CurlOperation> curlGetUserAgentDetail( + Crc32Value entityId, std::string_view uas, const char * baseUrl); } |