Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
netlink.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Contact: Mateusz Malicki <m.malicki2@samsung.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License
17  */
18 
25 #ifndef COMMON_NETLINK_NETLINK_HPP
26 #define COMMON_NETLINK_NETLINK_HPP
27 
28 #include <memory>
29 #include <vector>
30 
31 //FIXME remove from namespace vasum
32 namespace vasum {
33 namespace netlink {
34 
39 class Netlink {
40 public:
41  Netlink();
42  ~Netlink();
43 
44  Netlink(const Netlink& other) = delete;
45  Netlink& operator=(const Netlink& other) = delete;
46 
52  void open(int netNsPid = 0);
53 
57  void close();
58 
68  unsigned int send(const void* nlmsg);
69 
79  std::unique_ptr<std::vector<char>> rcv(unsigned int nlmsgSeq);
80 private:
81  int mFd;
82 };
83 
84 } // namesapce netlink
85 } // namespace vasum
86 
87 #endif /* COMMON_NETLINK_NETLINK_HPP */