Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
IDobbyRdkLoggingPlugin.h
1 /*
2 * If not stated otherwise in this file or this component's LICENSE file the
3 * following copyright and licenses apply:
4 *
5 * Copyright 2020 Sky UK
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19 /*
20  * File: IDobbyRdkLoggingPlugin.h
21  *
22  */
23 #ifndef IDOBBYRDKLOGGINGPLUGIN_H
24 #define IDOBBYRDKLOGGINGPLUGIN_H
25 
26 #include "IDobbyRdkPlugin.h"
27 #include "DobbyRdkPluginUtils.h"
28 
29 #include "IPollLoop.h"
30 
31 #include "rt_dobby_schema.h"
32 
33 #include <Logging.h>
34 #include <sys/types.h>
35 
36 #include <string>
37 #include <memory>
38 #include <future>
39 
40 // -----------------------------------------------------------------------------
48 {
49 public:
50  virtual ~IDobbyRdkLoggingPlugin() = default;
51 
52 public:
53  virtual void RegisterPollSources(int fd, std::shared_ptr<AICommon::IPollLoop> pollLoop) = 0;
54 
55  virtual void DumpToLog(const int bufferFd) = 0;
56 };
57 
58 // -----------------------------------------------------------------------------
71 #define REGISTER_RDK_LOGGER(_class) \
72  extern "C" PUBLIC_FN IDobbyRdkLoggingPlugin *createIDobbyRdkLogger(std::shared_ptr<rt_dobby_schema> &containerConfig, const std::shared_ptr<DobbyRdkPluginUtils> &utils, const std::string &rootfsPath); \
73  extern "C" PUBLIC_FN IDobbyRdkLoggingPlugin *createIDobbyRdkLogger(std::shared_ptr<rt_dobby_schema> &containerConfig, const std::shared_ptr<DobbyRdkPluginUtils> &utils, const std::string &rootfsPath) \
74  { \
75  return new _class(containerConfig, utils, rootfsPath); \
76  } \
77  extern "C" PUBLIC_FN void destroyIDobbyRdkLogger(_class const *_plugin); \
78  extern "C" PUBLIC_FN void destroyIDobbyRdkLogger(_class const *_plugin) \
79  { \
80  return delete _plugin; \
81  }
82 
83 #endif // !defined(IDOBBYRDKLOGGINGPLUGIN_H)
Interface that plugin libraries have to implement.
Definition: IDobbyRdkLoggingPlugin.h:48
Interface that plugin libraries have to implement.
Definition: IDobbyRdkPlugin.h:49