X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fstream-provider.h;h=8347ac6f5d748125b523b9a8706b37a2838b0791;hb=003ce655b7116d18c86a74c50391e54990346931;hp=1eb7c94fdafb670fcfb5035902b1351655f725a4;hpb=ef8a3d14976080fc5e29ce04bea8bd88f8b631f2;p=sliver-openvswitch.git diff --git a/lib/stream-provider.h b/lib/stream-provider.h index 1eb7c94fd..8347ac6f5 100644 --- a/lib/stream-provider.h +++ b/lib/stream-provider.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010 Nicira Networks. + * Copyright (c) 2009, 2010, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ #ifndef STREAM_PROVIDER_H #define STREAM_PROVIDER_H 1 -#include #include #include "stream.h" @@ -30,31 +29,22 @@ struct stream { const struct stream_class *class; int state; int error; - ovs_be32 remote_ip; - ovs_be16 remote_port; - ovs_be32 local_ip; - ovs_be16 local_port; char *name; }; void stream_init(struct stream *, const struct stream_class *, int connect_status, const char *name); -void stream_set_remote_ip(struct stream *, ovs_be32 remote_ip); -void stream_set_dscp(struct stream *, uint8_t dscp); -void stream_set_remote_port(struct stream *, ovs_be16 remote_port); -void stream_set_local_ip(struct stream *, ovs_be32 local_ip); -void stream_set_local_port(struct stream *, ovs_be16 local_port); static inline void stream_assert_class(const struct stream *stream, const struct stream_class *class) { - assert(stream->class == class); + ovs_assert(stream->class == class); } struct stream_class { /* Prefix for connection names, e.g. "tcp", "ssl", "unix". */ const char *name; - /* True if this stream needs periodic probes to verify connectivty. For + /* True if this stream needs periodic probes to verify connectivity. For * streams which need probes, it can take a long time to notice the * connection was dropped. */ bool needs_probes; @@ -141,20 +131,22 @@ struct stream_class { struct pstream { const struct pstream_class *class; char *name; + ovs_be16 bound_port; }; void pstream_init(struct pstream *, const struct pstream_class *, const char *name); +void pstream_set_bound_port(struct pstream *, ovs_be16 bound_port); static inline void pstream_assert_class(const struct pstream *pstream, const struct pstream_class *class) { - assert(pstream->class == class); + ovs_assert(pstream->class == class); } struct pstream_class { /* Prefix for connection names, e.g. "ptcp", "pssl", "punix". */ const char *name; - /* True if this pstream needs periodic probes to verify connectivty. For + /* True if this pstream needs periodic probes to verify connectivity. For * pstreams which need probes, it can take a long time to notice the * connection was dropped. */ bool needs_probes; @@ -191,13 +183,21 @@ struct pstream_class { /* Arranges for the poll loop to wake up when a connection is ready to be * accepted on 'pstream'. */ void (*wait)(struct pstream *pstream); + + /* Set DSCP value of the listening socket. */ + int (*set_dscp)(struct pstream *pstream, uint8_t dscp); }; /* Active and passive stream classes. */ extern const struct stream_class tcp_stream_class; extern const struct pstream_class ptcp_pstream_class; +#ifndef _WIN32 extern const struct stream_class unix_stream_class; extern const struct pstream_class punix_pstream_class; +#else +extern const struct stream_class windows_stream_class; +extern const struct pstream_class pwindows_pstream_class; +#endif #ifdef HAVE_OPENSSL extern const struct stream_class ssl_stream_class; extern const struct pstream_class pssl_pstream_class;