X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fstream.h;h=5c536c6ae5ff1af0548e4bb5f715ebb9a50cb12b;hb=67b30fcde789088b2e43407167f9ad656c2cc1e5;hp=76c9e6c67238ec46920f1b2ec54142ee2fdf4014;hpb=c34b65c731a1b6dae014efe8895141e5b2fe758a;p=openvswitch diff --git a/lib/stream.h b/lib/stream.h index 76c9e6c6..5c536c6a 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nicira Networks. + * Copyright (c) 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,21 +17,20 @@ #ifndef STREAM_H #define STREAM_H 1 -#include #include #include #include - -#include "flow.h" +#include "vlog.h" struct pstream; struct stream; -void stream_usage(const char *name, bool active, bool passive); +void stream_usage(const char *name, bool active, bool passive, bool bootstrap); /* Bidirectional byte streams. */ +int stream_verify_name(const char *name); int stream_open(const char *name, struct stream **); -int stream_open_block(const char *name, struct stream **); +int stream_open_block(int error, struct stream **); void stream_close(struct stream *); const char *stream_get_name(const struct stream *); uint32_t stream_get_remote_ip(const struct stream *); @@ -42,6 +41,9 @@ int stream_connect(struct stream *); int stream_recv(struct stream *, void *buffer, size_t n); int stream_send(struct stream *, const void *buffer, size_t n); +void stream_run(struct stream *); +void stream_run_wait(struct stream *); + enum stream_wait_type { STREAM_CONNECT, STREAM_RECV, @@ -53,10 +55,35 @@ void stream_recv_wait(struct stream *); void stream_send_wait(struct stream *); /* Passive streams: listeners for incoming stream connections. */ +int pstream_verify_name(const char *name); int pstream_open(const char *name, struct pstream **); const char *pstream_get_name(const struct pstream *); void pstream_close(struct pstream *); int pstream_accept(struct pstream *, struct stream **); +int pstream_accept_block(struct pstream *, struct stream **); void pstream_wait(struct pstream *); + +/* Convenience functions. */ + +int stream_open_with_default_ports(const char *name, + uint16_t default_tcp_port, + uint16_t default_ssl_port, + struct stream **); +int pstream_open_with_default_ports(const char *name, + uint16_t default_ptcp_port, + uint16_t default_pssl_port, + struct pstream **); + +/* Error reporting. */ + +enum stream_content_type { + STREAM_UNKNOWN, + STREAM_OPENFLOW, + STREAM_SSL, + STREAM_JSONRPC +}; + +void stream_report_content(const void *, size_t, enum stream_content_type, + struct vlog_module *, const char *stream_name); #endif /* stream.h */