Add API allowing xAPPs to send alarm messages
[ric-plt/xapp-frame-cpp.git] / src / messaging / callback.hpp
1 // vi: ts=4 sw=4 noet:
2 /*
3 ==================================================================================
4         Copyright (c) 2020 Nokia
5         Copyright (c) 2020 AT&T Intellectual Property.
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
21 /*
22         Mnemonic:       callback.hpp
23         Abstract:       class description for a callback managment object.
24         Date:           9 March 2020
25         Author:         E. Scott Daniels
26 */
27
28
29 #ifndef _CALLBACK_HPP
30 #define _CALLBACK_HPP
31
32 #include <memory>
33
34 #include "msg_component.hpp"
35
36 namespace xapp {
37
38
39 class Messenger;
40 class Message;
41
42 typedef void(*user_callback)( xapp::Message& m, int mtype, int subid, int payload_len, xapp::Msg_component payload, void* usr_data );
43
44 class Callback {
45
46         private:
47                 user_callback user_fun;
48                 void*   udata;                                                                  // user data
49
50         public:
51                 Callback( user_callback, void* data );                                  // builder
52                 void Drive_cb( Message& m );                                                    // invoker
53 };
54
55 } // namespace
56
57 #endif
58