X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fstream-provider.h;h=03bf777b60865b791463a3e8199551e9bf62359d;hb=b4059eff4a4469162082dc67a45fe15aa238ca95;hp=6beaab75e9e3bcd9c9fdf39af8a9fcabb0fb189b;hpb=c34b65c731a1b6dae014efe8895141e5b2fe758a;p=sliver-openvswitch.git diff --git a/lib/stream-provider.h b/lib/stream-provider.h index 6beaab75e..03bf777b6 100644 --- a/lib/stream-provider.h +++ b/lib/stream-provider.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. @@ -27,22 +27,22 @@ * * This structure should be treated as opaque by implementation. */ struct stream { - struct stream_class *class; + const struct stream_class *class; int state; int error; - uint32_t remote_ip; - uint16_t remote_port; - uint32_t local_ip; - uint16_t local_port; + ovs_be32 remote_ip; + ovs_be16 remote_port; + ovs_be32 local_ip; + ovs_be16 local_port; char *name; }; -void stream_init(struct stream *, struct stream_class *, int connect_status, - const char *name); -void stream_set_remote_ip(struct stream *, uint32_t remote_ip); -void stream_set_remote_port(struct stream *, uint16_t remote_port); -void stream_set_local_ip(struct stream *, uint32_t local_ip); -void stream_set_local_port(struct stream *, uint16_t local_port); +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_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) { @@ -109,6 +109,18 @@ struct stream_class { * accepted for transmission, it should return -EAGAIN immediately. */ ssize_t (*send)(struct stream *stream, const void *buffer, size_t n); + /* Allows 'stream' to perform maintenance activities, such as flushing + * output buffers. + * + * May be null if 'stream' doesn't have anything to do here. */ + void (*run)(struct stream *stream); + + /* Arranges for the poll loop to wake up when 'stream' needs to perform + * maintenance activities. + * + * May be null if 'stream' doesn't have anything to do here. */ + void (*run_wait)(struct stream *stream); + /* Arranges for the poll loop to wake up when 'stream' is ready to take an * action of the given 'type'. */ void (*wait)(struct stream *stream, enum stream_wait_type type); @@ -118,11 +130,11 @@ struct stream_class { * * This structure should be treated as opaque by stream implementations. */ struct pstream { - struct pstream_class *class; + const struct pstream_class *class; char *name; }; -void pstream_init(struct pstream *, struct pstream_class *, const char *name); +void pstream_init(struct pstream *, const struct pstream_class *, const char *name); static inline void pstream_assert_class(const struct pstream *pstream, const struct pstream_class *class) { @@ -165,9 +177,13 @@ struct pstream_class { }; /* Active and passive stream classes. */ -extern struct stream_class tcp_stream_class; -extern struct pstream_class ptcp_pstream_class; -extern struct stream_class unix_stream_class; -extern struct pstream_class punix_pstream_class; +extern const struct stream_class tcp_stream_class; +extern const struct pstream_class ptcp_pstream_class; +extern const struct stream_class unix_stream_class; +extern const struct pstream_class punix_pstream_class; +#ifdef HAVE_OPENSSL +extern const struct stream_class ssl_stream_class; +extern const struct pstream_class pssl_pstream_class; +#endif #endif /* stream-provider.h */