From: Thomas Graf Date: Mon, 15 Dec 2014 13:10:38 +0000 (+0100) Subject: lib: Move vconn.h to X-Git-Tag: v2.4.0~783 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=4a1f523f2d760e9e5751bc93519d1b70c5492b56 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 --- 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/include/openvswitch/vconn.h b/include/openvswitch/vconn.h new file mode 100644 index 000000000..b7dd2dfc2 --- /dev/null +++ b/include/openvswitch/vconn.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_VCONN_H +#define OPENVSWITCH_VCONN_H 1 + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct ofpbuf; +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); + +/* Active vconns: virtual connections to OpenFlow devices. */ +int vconn_verify_name(const char *name); +int vconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp, + struct vconn **vconnp); +void vconn_close(struct vconn *); +const char *vconn_get_name(const struct vconn *); + +uint32_t vconn_get_allowed_versions(const struct vconn *vconn); +void vconn_set_allowed_versions(struct vconn *vconn, + uint32_t allowed_versions); +int vconn_get_version(const struct vconn *); +void vconn_set_recv_any_version(struct vconn *); + +int vconn_connect(struct vconn *); +int vconn_recv(struct vconn *, struct ofpbuf **); +int vconn_send(struct vconn *, struct ofpbuf *); +int vconn_recv_xid(struct vconn *, ovs_be32 xid, struct ofpbuf **); +int vconn_transact(struct vconn *, struct ofpbuf *, struct ofpbuf **); +int vconn_transact_noreply(struct vconn *, struct ofpbuf *, struct ofpbuf **); +int vconn_transact_multiple_noreply(struct vconn *, struct ovs_list *requests, + struct ofpbuf **replyp); + +void vconn_run(struct vconn *); +void vconn_run_wait(struct vconn *); + +int vconn_get_status(const struct vconn *); + +int vconn_open_block(const char *name, uint32_t allowed_versions, uint8_t dscp, + struct vconn **); +int vconn_connect_block(struct vconn *); +int vconn_send_block(struct vconn *, struct ofpbuf *); +int vconn_recv_block(struct vconn *, struct ofpbuf **); + +enum vconn_wait_type { + WAIT_CONNECT, + WAIT_RECV, + WAIT_SEND +}; +void vconn_wait(struct vconn *, enum vconn_wait_type); +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. + * + * 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); +const char *pvconn_get_name(const struct pvconn *); +void pvconn_close(struct pvconn *); +int pvconn_accept(struct pvconn *, struct vconn **); +void pvconn_wait(struct pvconn *); + +#ifdef __cplusplus +} +#endif + +#endif /* vconn.h */ 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/lib/vconn.h b/lib/vconn.h deleted file mode 100644 index 258568cc3..000000000 --- a/lib/vconn.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VCONN_H -#define VCONN_H 1 - -#include -#include "openvswitch/types.h" -#include "openflow/openflow.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct ovs_list; -struct ofpbuf; -struct pvconn; -struct vconn; - -void vconn_usage(bool active, bool passive, bool bootstrap); - -/* Active vconns: virtual connections to OpenFlow devices. */ -int vconn_verify_name(const char *name); -int vconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp, - struct vconn **vconnp); -void vconn_close(struct vconn *); -const char *vconn_get_name(const struct vconn *); - -uint32_t vconn_get_allowed_versions(const struct vconn *vconn); -void vconn_set_allowed_versions(struct vconn *vconn, - uint32_t allowed_versions); -int vconn_get_version(const struct vconn *); -void vconn_set_recv_any_version(struct vconn *); - -int vconn_connect(struct vconn *); -int vconn_recv(struct vconn *, struct ofpbuf **); -int vconn_send(struct vconn *, struct ofpbuf *); -int vconn_recv_xid(struct vconn *, ovs_be32 xid, struct ofpbuf **); -int vconn_transact(struct vconn *, struct ofpbuf *, struct ofpbuf **); -int vconn_transact_noreply(struct vconn *, struct ofpbuf *, struct ofpbuf **); -int vconn_transact_multiple_noreply(struct vconn *, struct ovs_list *requests, - struct ofpbuf **replyp); - -void vconn_run(struct vconn *); -void vconn_run_wait(struct vconn *); - -int vconn_get_status(const struct vconn *); - -int vconn_open_block(const char *name, uint32_t allowed_versions, uint8_t dscp, - struct vconn **); -int vconn_connect_block(struct vconn *); -int vconn_send_block(struct vconn *, struct ofpbuf *); -int vconn_recv_block(struct vconn *, struct ofpbuf **); - -enum vconn_wait_type { - WAIT_CONNECT, - WAIT_RECV, - WAIT_SEND -}; -void vconn_wait(struct vconn *, enum vconn_wait_type); -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. */ -int pvconn_verify_name(const char *name); -int pvconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp, - struct pvconn **pvconnp); -const char *pvconn_get_name(const struct pvconn *); -void pvconn_close(struct pvconn *); -int pvconn_accept(struct pvconn *, struct vconn **); -void pvconn_wait(struct pvconn *); - -#ifdef __cplusplus -} -#endif - -#endif /* vconn.h */ 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);