Android-cuttlefish cvd tool
netlink_client.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef ALLOCD_NET_NETLINK_CLIENT_H_
17#define ALLOCD_NET_NETLINK_CLIENT_H_
18
19#include <memory>
20
22
23namespace cuttlefish {
24
25// Abstraction of Netlink client class.
27 public:
29 virtual ~NetlinkClient() {}
30
31 // Send netlink message to kernel.
32 virtual bool Send(const NetlinkRequest& message) = 0;
33
34 private:
37};
38
40 public:
41 // Create new NetlinkClient instance of a specified type.
42 // type can be any of the NETLINK_* types (eg. NETLINK_ROUTE).
43 virtual std::unique_ptr<NetlinkClient> New(int type) = 0;
44
46
47 protected:
49 virtual ~NetlinkClientFactory() = default;
50};
51
52} // namespace cuttlefish
53
54#endif // COMMON_LIBS_NET_NETLINK_CLIENT_H_
Definition: netlink_client.h:39
static NetlinkClientFactory * Default()
Definition: netlink_client.cc:173
virtual std::unique_ptr< NetlinkClient > New(int type)=0
virtual ~NetlinkClientFactory()=default
Definition: netlink_client.h:26
NetlinkClient & operator=(const NetlinkClient &)
virtual ~NetlinkClient()
Definition: netlink_client.h:29
virtual bool Send(const NetlinkRequest &message)=0
NetlinkClient()
Definition: netlink_client.h:28
NetlinkClient(const NetlinkClient &)
Definition: netlink_request.h:34
Definition: alloc_driver.h:20
uint8_t type
Definition: pairing_connection.h:0