]>
git.proxmox.com Git - mirror_ovs.git/blob - lib/stream.h
2 * Copyright (c) 2009, 2010, 2011, 2013, 2015 Nicira, Inc.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 #include <sys/types.h>
24 #include "openvswitch/types.h"
25 #include "socket-util.h"
32 void stream_usage(const char *name
, bool active
, bool passive
, bool bootstrap
);
34 /* Bidirectional byte streams. */
35 int stream_verify_name(const char *name
);
36 int stream_open(const char *name
, struct stream
**, uint8_t dscp
);
37 int stream_open_block(int error
, long long int timeout
, struct stream
**);
38 void stream_close(struct stream
*);
39 const char *stream_get_name(const struct stream
*);
40 int stream_connect(struct stream
*);
41 int stream_recv(struct stream
*, void *buffer
, size_t n
);
42 int stream_send(struct stream
*, const void *buffer
, size_t n
);
44 void stream_run(struct stream
*);
45 void stream_run_wait(struct stream
*);
47 enum stream_wait_type
{
52 void stream_wait(struct stream
*, enum stream_wait_type
);
53 void stream_connect_wait(struct stream
*);
54 void stream_recv_wait(struct stream
*);
55 void stream_send_wait(struct stream
*);
56 void stream_set_peer_id(struct stream
*, const char *);
57 const char *stream_get_peer_id(const struct stream
*);
59 /* Passive streams: listeners for incoming stream connections. */
60 int pstream_verify_name(const char *name
);
61 int pstream_open(const char *name
, struct pstream
**, uint8_t dscp
);
62 const char *pstream_get_name(const struct pstream
*);
63 void pstream_close(struct pstream
*);
64 int pstream_accept(struct pstream
*, struct stream
**);
65 int pstream_accept_block(struct pstream
*, struct stream
**);
66 void pstream_wait(struct pstream
*);
68 ovs_be16
pstream_get_bound_port(const struct pstream
*);
70 /* Convenience functions. */
72 int stream_open_with_default_port(const char *name
,
73 uint16_t default_port
,
76 int pstream_open_with_default_port(const char *name
,
77 uint16_t default_port
,
80 bool stream_parse_target_with_default_port(const char *target
,
82 struct sockaddr_storage
*ss
);
83 int stream_or_pstream_needs_probes(const char *name
);
85 /* Error reporting. */
87 enum stream_content_type
{
94 void stream_report_content(const void *, ssize_t
, enum stream_content_type
,
95 struct vlog_module
*, const char *stream_name
);