Restructure O1 module to run as a thread in O-DU High binary [Issue-Id: ODUHIGH-297]
[o-du/l2.git] / src / o1 / UnixSocketClient.hpp
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
4 #                                                                              #
5 #   Licensed under th`e Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /* This file contains functions to connect to a unix socket server and send/recv
20    messages 
21 */
22
23 #ifndef __UNIX_SOCKET_CLIENT_HPP__
24 #define __UNIX_SOCKET_CLIENT_HPP__
25
26 #include <stdint.h>
27 #include <string>
28 #include <sys/un.h>
29
30 using std::string;
31
32 class UnixSocketClient
33 {
34    private:
35
36    int mSock;
37    string mSockPath;
38    struct sockaddr_un mSockName;
39    
40    public:
41    UnixSocketClient(const string& path);
42    ~UnixSocketClient();
43    uint8_t openSocket();
44    int sendData(void*, const int);
45    int receiveData(void* data, const int size);
46    uint8_t closeSocket();
47
48 };
49
50 #endif
51
52 /**********************************************************************
53          End of file
54 **********************************************************************/