Fix library installation path in 64-bit environment
[platform/core/connectivity/stc-manager.git] / include / stc-helper-nl.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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 #pragma once
17
18 #include <linux/netlink.h>
19 #include <linux/genetlink.h>
20 #include <linux/rtnetlink.h>
21
22 #include "stc.h"
23
24 #define NETLINK_BUF_SIZE 16536
25
26 enum nfnl_acct_type {
27         NFACCT_UNSPEC,
28         NFACCT_NAME,
29         NFACCT_PKTS,
30         NFACCT_BYTES,
31         NFACCT_USE,
32         NFACCT_FLAGS,
33         NFACCT_QUOTA,
34         NFACCT_FILTER,
35         __NFACCT_MAX
36 };
37
38 struct genl {
39         struct nlmsghdr n;
40         struct genlmsghdr g;
41         char buf[NETLINK_BUF_SIZE];
42 };
43
44 struct netlink_serialization_params {
45         int direction;
46         struct genl *ans;
47         struct counter_arg *carg;
48         int (*eval_attr)(struct rtattr *attr_list[__NFACCT_MAX],
49                          void *user_data);
50         int (*post_eval_attr)(void *user_data);
51 };
52
53 typedef struct {
54         void (*deserialize_answer)(struct netlink_serialization_params *params);
55         void (*finalize)(struct netlink_serialization_params *params);
56         struct netlink_serialization_params params;
57 } netlink_serialization_command;
58
59 int create_netlink(int protocol, uint32_t groups);
60 int read_netlink(int sock, void *buf, size_t len);