diff --git a/userspace/falco/grpc_context.h b/userspace/falco/grpc_context.h index 9823fffa..22784790 100644 --- a/userspace/falco/grpc_context.h +++ b/userspace/falco/grpc_context.h @@ -62,5 +62,6 @@ public: mutable void* m_stream = nullptr; // todo(fntlnz, leodido) > useful in the future mutable bool m_has_more = false; }; + } // namespace grpc } // namespace falco diff --git a/userspace/falco/grpc_server_impl.cpp b/userspace/falco/grpc_server_impl.cpp index 861388c9..8216b86a 100644 --- a/userspace/falco/grpc_server_impl.cpp +++ b/userspace/falco/grpc_server_impl.cpp @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +#include "config_falco.h" #include "grpc_server_impl.h" #include "falco_output_queue.h" #include "banned.h" @@ -49,6 +50,16 @@ void falco::grpc::server_impl::subscribe(const stream_context& ctx, const output } } +void falco::grpc::server_impl::version(const context& ctx, const version::request&, version::response& res) +{ + res.set_version(FALCO_VERSION); + res.set_major(std::stoi(FALCO_VERSION_MAJOR)); + res.set_minor(std::stoi(FALCO_VERSION_MINOR)); + res.set_patch(std::stoi(FALCO_VERSION_PATCH)); + res.set_prerelease(FALCO_VERSION_PRERELEASE); + res.set_build(FALCO_VERSION_BUILD); +} + void falco::grpc::server_impl::shutdown() { m_stop = true; diff --git a/userspace/falco/grpc_server_impl.h b/userspace/falco/grpc_server_impl.h index fffae63b..c6b93a88 100644 --- a/userspace/falco/grpc_server_impl.h +++ b/userspace/falco/grpc_server_impl.h @@ -18,6 +18,7 @@ limitations under the License. #include #include "output.grpc.pb.h" +#include "version.grpc.pb.h" #include "grpc_context.h" namespace falco @@ -37,6 +38,8 @@ protected: void subscribe(const stream_context& ctx, const output::request& req, output::response& res); + void version(const context& ctx, const version::request& req, version::response& res); + private: std::atomic m_stop{false}; };