libnl  3.2.21
openvswitch.h
1 /*
2  * netlink/openvswitch/openvswitch.h Open vSwitch
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation version 2.1
7  * of the License.
8  *
9  * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch>
10  */
11 
12 #ifndef NETLINK_OPENVSWITCH_H_
13 #define NETLINK_OPENVSWITCH_H_
14 
15 #include <netlink/netlink.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /**
22  * @struct ovs_dp openvswitch.h "openvswitch/openvswitch.h"
23  * @brief Open vSwitch datapath object
24  * @implements nl_object
25  * @ingroup ovs_datapath
26  *
27  * @copydoc private_struct
28  */
29 struct ovs_dp;
30 
31 /**
32  * @ingroup ovs_datapath
33  * Datapath statistic identifiers
34  */
35 typedef enum {
36  OVS_DP_STAT_HIT,
37  OVS_DP_STAT_MISSED,
38  OVS_DP_STAT_LOST,
39  OVS_DP_STAT_FLOWS,
40  __OVS_DP_STAT_MAX,
42 
43 #define OVS_DP_STAT_MAX (__OVS_DP_STAT_MAX - 1)
44 
45 extern struct ovs_dp * ovs_dp_alloc(void);
46 extern void ovs_dp_put(struct ovs_dp *);
47 
48 extern void ovs_dp_set_name(struct ovs_dp *, const char *);
49 extern const char * ovs_dp_get_name(const struct ovs_dp *);
50 
51 extern void ovs_dp_set_ifindex(struct ovs_dp *, int);
52 extern int ovs_dp_get_ifindex(const struct ovs_dp *);
53 
54 extern void ovs_dp_set_upcall_pid(struct ovs_dp *, int);
55 extern int ovs_dp_get_upcall_pid(const struct ovs_dp *);
56 
57 extern uint64_t ovs_dp_get_stat(const struct ovs_dp *, ovs_dp_stat_id_t);
58 extern int ovs_dp_set_stat(struct ovs_dp *, ovs_dp_stat_id_t, const uint64_t);
59 
60 extern const char * ovs_dp_stat2str(int, char *, size_t);
61 extern int ovs_dp_str2stat(const char *);
62 
63 extern int ovs_dp_alloc_cache(struct nl_sock *, struct nl_cache **);
64 
65 extern int ovs_dp_build_add_request(const struct ovs_dp *, int, struct nl_msg **);
66 extern int ovs_dp_add(struct nl_sock *, const struct ovs_dp *, int);
67 
68 extern int ovs_dp_build_delete_request(const struct ovs_dp *, int, struct nl_msg **);
69 extern int ovs_dp_delete(struct nl_sock *, const struct ovs_dp *, int);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif