]>
Commit | Line | Data |
---|---|---|
064af421 | 1 | /* |
dc707e66 | 2 | * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. |
064af421 | 3 | * |
a14bc59f BP |
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: | |
064af421 | 7 | * |
a14bc59f BP |
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. | |
064af421 BP |
15 | */ |
16 | ||
4a1f523f TG |
17 | #ifndef OPENVSWITCH_VCONN_H |
18 | #define OPENVSWITCH_VCONN_H 1 | |
064af421 | 19 | |
064af421 | 20 | #include <stdbool.h> |
4a1f523f TG |
21 | #include <openvswitch/list.h> |
22 | #include <openvswitch/types.h> | |
23 | #include <openflow/openflow.h> | |
064af421 | 24 | |
43d1478b CB |
25 | #ifdef __cplusplus |
26 | extern "C" { | |
27 | #endif | |
28 | ||
064af421 | 29 | struct ofpbuf; |
dc707e66 | 30 | struct pvconn; |
4a1f523f | 31 | struct pvconn_class; |
dc707e66 BP |
32 | struct vconn; |
33 | struct vconn_class; | |
064af421 BP |
34 | |
35 | void vconn_usage(bool active, bool passive, bool bootstrap); | |
36 | ||
37 | /* Active vconns: virtual connections to OpenFlow devices. */ | |
30012c72 | 38 | int vconn_verify_name(const char *name); |
82c8c53c BP |
39 | int vconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp, |
40 | struct vconn **vconnp); | |
064af421 BP |
41 | void vconn_close(struct vconn *); |
42 | const char *vconn_get_name(const struct vconn *); | |
4766ce7a | 43 | |
7a25bd99 | 44 | uint32_t vconn_get_allowed_versions(const struct vconn *vconn); |
e182670b SH |
45 | void vconn_set_allowed_versions(struct vconn *vconn, |
46 | uint32_t allowed_versions); | |
4766ce7a BP |
47 | int vconn_get_version(const struct vconn *); |
48 | void vconn_set_recv_any_version(struct vconn *); | |
49 | ||
064af421 BP |
50 | int vconn_connect(struct vconn *); |
51 | int vconn_recv(struct vconn *, struct ofpbuf **); | |
52 | int vconn_send(struct vconn *, struct ofpbuf *); | |
dbba996b | 53 | int vconn_recv_xid(struct vconn *, ovs_be32 xid, struct ofpbuf **); |
064af421 | 54 | int vconn_transact(struct vconn *, struct ofpbuf *, struct ofpbuf **); |
33af7dca | 55 | int vconn_transact_noreply(struct vconn *, struct ofpbuf *, struct ofpbuf **); |
ca6ba700 | 56 | int vconn_transact_multiple_noreply(struct vconn *, struct ovs_list *requests, |
7f009380 | 57 | struct ofpbuf **replyp); |
064af421 | 58 | |
60cb3eb8 BP |
59 | void vconn_run(struct vconn *); |
60 | void vconn_run_wait(struct vconn *); | |
61 | ||
accaecc4 BP |
62 | int vconn_get_status(const struct vconn *); |
63 | ||
82c8c53c | 64 | int vconn_open_block(const char *name, uint32_t allowed_versions, uint8_t dscp, |
2e3fa633 | 65 | struct vconn **); |
6d1fb217 | 66 | int vconn_connect_block(struct vconn *); |
064af421 BP |
67 | int vconn_send_block(struct vconn *, struct ofpbuf *); |
68 | int vconn_recv_block(struct vconn *, struct ofpbuf **); | |
69 | ||
70 | enum vconn_wait_type { | |
71 | WAIT_CONNECT, | |
72 | WAIT_RECV, | |
73 | WAIT_SEND | |
74 | }; | |
75 | void vconn_wait(struct vconn *, enum vconn_wait_type); | |
76 | void vconn_connect_wait(struct vconn *); | |
77 | void vconn_recv_wait(struct vconn *); | |
78 | void vconn_send_wait(struct vconn *); | |
79 | ||
dc707e66 | 80 | /* Passive vconns: virtual listeners for incoming OpenFlow connections. */ |
30012c72 | 81 | int pvconn_verify_name(const char *name); |
82c8c53c BP |
82 | int pvconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp, |
83 | struct pvconn **pvconnp); | |
064af421 BP |
84 | const char *pvconn_get_name(const struct pvconn *); |
85 | void pvconn_close(struct pvconn *); | |
7a25bd99 | 86 | int pvconn_accept(struct pvconn *, struct vconn **); |
064af421 BP |
87 | void pvconn_wait(struct pvconn *); |
88 | ||
43d1478b CB |
89 | #ifdef __cplusplus |
90 | } | |
91 | #endif | |
92 | ||
064af421 | 93 | #endif /* vconn.h */ |