From 4a1f523f2d760e9e5751bc93519d1b70c5492b56 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Mon, 15 Dec 2014 14:10:38 +0100 Subject: [PATCH] lib: Move vconn.h to Also moves definitions for struct vconn and pvconn to the public header. The provider interface is kept private. Signed-off-by: Thomas Graf Acked-by: Ben Pfaff --- include/openvswitch/automake.mk | 1 + {lib => include/openvswitch}/vconn.h | 38 ++++++++++++++++++++++------ lib/automake.mk | 1 - lib/learning-switch.c | 2 +- lib/ofp-parse.c | 2 +- lib/rconn.c | 2 +- lib/vconn-provider.h | 28 ++------------------ lib/vconn-stream.c | 2 +- ofproto/bundles.c | 2 +- ofproto/connmgr.c | 2 +- ofproto/fail-open.c | 2 +- ofproto/pinsched.c | 2 +- ofproto/pktbuf.c | 2 +- tests/test-vconn.c | 2 +- utilities/ovs-ofctl.c | 2 +- utilities/ovs-testcontroller.c | 2 +- utilities/ovs-vsctl.c | 2 +- vswitchd/ovs-vswitchd.c | 2 +- vtep/vtep-ctl.c | 2 +- 19 files changed, 48 insertions(+), 50 deletions(-) rename {lib => include/openvswitch}/vconn.h (76%) diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk index 5e9b77ad6..90a45cb00 100644 --- a/include/openvswitch/automake.mk +++ b/include/openvswitch/automake.mk @@ -7,5 +7,6 @@ openvswitchinclude_HEADERS = \ include/openvswitch/types.h \ include/openvswitch/util.h \ include/openvswitch/version.h \ + include/openvswitch/vconn.h \ include/openvswitch/vlog.h diff --git a/lib/vconn.h b/include/openvswitch/vconn.h similarity index 76% rename from lib/vconn.h rename to include/openvswitch/vconn.h index 258568cc3..b7dd2dfc2 100644 --- a/lib/vconn.h +++ b/include/openvswitch/vconn.h @@ -14,21 +14,36 @@ * limitations under the License. */ -#ifndef VCONN_H -#define VCONN_H 1 +#ifndef OPENVSWITCH_VCONN_H +#define OPENVSWITCH_VCONN_H 1 #include -#include "openvswitch/types.h" -#include "openflow/openflow.h" +#include +#include +#include #ifdef __cplusplus extern "C" { #endif -struct ovs_list; struct ofpbuf; -struct pvconn; -struct vconn; +struct vconn_class; +struct pvconn_class; + +/* This structure should be treated as opaque by vconn implementations. */ +struct vconn { + const struct vconn_class *class; + int state; + int error; + + /* OpenFlow versions. */ + uint32_t allowed_versions; /* Bitmap of versions we will accept. */ + uint32_t peer_versions; /* Peer's bitmap of versions it will accept. */ + enum ofp_version version; /* Negotiated version (or 0). */ + bool recv_any_version; /* True to receive a message of any version. */ + + char *name; +}; void vconn_usage(bool active, bool passive, bool bootstrap); @@ -75,7 +90,14 @@ void vconn_connect_wait(struct vconn *); void vconn_recv_wait(struct vconn *); void vconn_send_wait(struct vconn *); -/* Passive vconns: virtual listeners for incoming OpenFlow connections. */ +/* Passive vconns: virtual listeners for incoming OpenFlow connections. + * + * This structure should be treated as opaque by vconn implementations. */ +struct pvconn { + const struct pvconn_class *class; + char *name; + uint32_t allowed_versions; +}; int pvconn_verify_name(const char *name); int pvconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp, struct pvconn **pvconnp); diff --git a/lib/automake.mk b/lib/automake.mk index ef5b02041..2a5844b15 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -259,7 +259,6 @@ lib_libopenvswitch_la_SOURCES = \ lib/vconn-provider.h \ lib/vconn-stream.c \ lib/vconn.c \ - lib/vconn.h \ lib/vlan-bitmap.c \ lib/vlan-bitmap.h \ lib/vlandev.c \ diff --git a/lib/learning-switch.c b/lib/learning-switch.c index b948af7a6..1423ac46a 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -41,7 +41,7 @@ #include "shash.h" #include "simap.h" #include "timeval.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(learning_switch); diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index fea1ab7fb..2ae1edbcd 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -38,7 +38,7 @@ #include "packets.h" #include "simap.h" #include "socket-util.h" -#include "vconn.h" +#include "openvswitch/vconn.h" /* Parses 'str' as an 8-bit unsigned integer into '*valuep'. * diff --git a/lib/rconn.c b/lib/rconn.c index 8e07b8e2b..0ee8f0ded 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -29,7 +29,7 @@ #include "sat-math.h" #include "timeval.h" #include "util.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(rconn); diff --git a/lib/vconn-provider.h b/lib/vconn-provider.h index 0225a58d6..7a41ee62e 100644 --- a/lib/vconn-provider.h +++ b/lib/vconn-provider.h @@ -20,29 +20,12 @@ /* Provider interface to vconns, which provide a virtual connection to an * OpenFlow device. */ -#include "vconn.h" +#include "openvswitch/vconn.h" #include "util.h" #include "openflow/openflow-common.h" /* Active virtual connection to an OpenFlow device. */ -/* Active virtual connection to an OpenFlow device. - * - * This structure should be treated as opaque by vconn implementations. */ -struct vconn { - const struct vconn_class *class; - int state; - int error; - - /* OpenFlow versions. */ - uint32_t allowed_versions; /* Bitmap of versions we will accept. */ - uint32_t peer_versions; /* Peer's bitmap of versions it will accept. */ - enum ofp_version version; /* Negotiated version (or 0). */ - bool recv_any_version; /* True to receive a message of any version. */ - - char *name; -}; - void vconn_init(struct vconn *, const struct vconn_class *, int connect_status, const char *name, uint32_t allowed_versions); void vconn_free_data(struct vconn *vconn); @@ -130,14 +113,7 @@ struct vconn_class { void (*wait)(struct vconn *vconn, enum vconn_wait_type type); }; -/* Passive virtual connection to an OpenFlow device. - * - * This structure should be treated as opaque by vconn implementations. */ -struct pvconn { - const struct pvconn_class *class; - char *name; - uint32_t allowed_versions; -}; +/* Passive virtual connection to an OpenFlow device. */ void pvconn_init(struct pvconn *pvconn, const struct pvconn_class *class, const char *name, uint32_t allowed_versions); diff --git a/lib/vconn-stream.c b/lib/vconn-stream.c index 32c25cdbb..eaf459f56 100644 --- a/lib/vconn-stream.c +++ b/lib/vconn-stream.c @@ -29,7 +29,7 @@ #include "stream.h" #include "util.h" #include "vconn-provider.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(vconn_stream); diff --git a/ofproto/bundles.c b/ofproto/bundles.c index c33af52cc..c443bdc34 100644 --- a/ofproto/bundles.c +++ b/ofproto/bundles.c @@ -34,7 +34,7 @@ #include "simap.h" #include "stream.h" #include "timeval.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" #include "bundles.h" diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 35aa98052..6bcf5d494 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -39,7 +39,7 @@ #include "simap.h" #include "stream.h" #include "timeval.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" #include "bundles.h" diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index 2aacc1311..ecdba4467 100644 --- a/ofproto/fail-open.c +++ b/ofproto/fail-open.c @@ -32,7 +32,7 @@ #include "poll-loop.h" #include "rconn.h" #include "timeval.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(fail_open); diff --git a/ofproto/pinsched.c b/ofproto/pinsched.c index 1300e004f..d81c9b305 100644 --- a/ofproto/pinsched.c +++ b/ofproto/pinsched.c @@ -32,7 +32,7 @@ #include "sat-math.h" #include "timeval.h" #include "openvswitch/token-bucket.h" -#include "vconn.h" +#include "openvswitch/vconn.h" struct pinqueue { struct hmap_node node; /* In struct pinsched's 'queues' hmap. */ diff --git a/ofproto/pktbuf.c b/ofproto/pktbuf.c index 5ba8c5103..ad2b1a435 100644 --- a/ofproto/pktbuf.c +++ b/ofproto/pktbuf.c @@ -23,7 +23,7 @@ #include "ofpbuf.h" #include "timeval.h" #include "util.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(pktbuf); diff --git a/tests/test-vconn.c b/tests/test-vconn.c index b5ba1726a..a05fc638b 100644 --- a/tests/test-vconn.c +++ b/tests/test-vconn.c @@ -16,7 +16,7 @@ #include #undef NDEBUG -#include "vconn.h" +#include "openvswitch/vconn.h" #include #include #include diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 1e349ea09..35cb2e8a9 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -59,7 +59,7 @@ #include "timeval.h" #include "unixctl.h" #include "util.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" #include "meta-flow.h" #include "sort.h" diff --git a/utilities/ovs-testcontroller.c b/utilities/ovs-testcontroller.c index 2c75b41c7..bb96701fd 100644 --- a/utilities/ovs-testcontroller.c +++ b/utilities/ovs-testcontroller.c @@ -40,7 +40,7 @@ #include "timeval.h" #include "unixctl.h" #include "util.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" #include "socket-util.h" #include "ofp-util.h" diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index 41d8f9b1b..4f9fd4730 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -47,7 +47,7 @@ #include "table.h" #include "timeval.h" #include "util.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(vsctl); diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index 9e406c42b..812c00b91 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -45,7 +45,7 @@ #include "timeval.h" #include "unixctl.h" #include "util.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" #include "lib/vswitch-idl.h" #include "lib/netdev-dpdk.h" diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c index 14de5b54f..c1a657d09 100644 --- a/vtep/vtep-ctl.c +++ b/vtep/vtep-ctl.c @@ -47,7 +47,7 @@ #include "table.h" #include "timeval.h" #include "util.h" -#include "vconn.h" +#include "openvswitch/vconn.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(vtep_ctl); -- 2.20.1