aboutsummaryrefslogtreecommitdiff
path: root/tests/profiling/GatordMockService.hpp
blob: c19e710d69ea1b904b461515c9dc27313a96a1ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Copyright © 2019 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include <string>

namespace armnn
{

namespace gatordmock
{


/**
 * A class that implements a Mock Gatord server. It will listen on a specified Unix domain socket (UDS)
 * namespace for client connections.
 */
class GatordMockService
{
public:

    /**
     * Establish the Unix domain socket and set it to listen for connections.
     *
     * @param udsNamespace the namespace (socket address) associated with the listener.
     * @return true only if the socket has been correctly setup.
     */
    bool OpenListeningSocket(std::string udsNamespace);

    /**
     * Block waiting to accept one client to connect to the UDS.
     *
     * @return the file descriptor of the client connection.
     */
    int BlockForOneClient();

private:

    int m_ListeningSocket;
};


} // namespace gatordmock

} // namespace armnn