X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fvconn-stream.c;h=d707e063c302364bd33305e8946b9c9881ee90e9;hb=d86a6c099ff4a1e0c7d1b437fa4ff0a9684fcdb9;hp=82854e91125822112d450efd404246f48320a2c6;hpb=d98e60075528c3065ad453f7add4b30f22edcde3;p=openvswitch diff --git a/lib/vconn-stream.c b/lib/vconn-stream.c index 82854e91..d707e063 100644 --- a/lib/vconn-stream.c +++ b/lib/vconn-stream.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,13 +78,13 @@ vconn_stream_new(struct stream *stream, int connect_status) * Returns 0 if successful, otherwise a positive errno value. */ static int vconn_stream_open(const char *name, char *suffix OVS_UNUSED, - struct vconn **vconnp) + struct vconn **vconnp, uint8_t dscp) { struct stream *stream; int error; error = stream_open_with_default_ports(name, OFP_TCP_PORT, OFP_SSL_PORT, - &stream); + &stream, dscp); if (!error) { error = stream_connect(stream); if (!error || error == EAGAIN) { @@ -227,6 +227,7 @@ vconn_stream_run(struct vconn *vconn) struct vconn_stream *s = vconn_stream_cast(vconn); ssize_t retval; + stream_run(s->stream); if (!s->txbuf) { return; } @@ -252,6 +253,7 @@ vconn_stream_run_wait(struct vconn *vconn) { struct vconn_stream *s = vconn_stream_cast(vconn); + stream_run_wait(s->stream); if (s->txbuf) { stream_send_wait(s->stream); } @@ -309,14 +311,14 @@ pvconn_pstream_cast(struct pvconn *pvconn) * implementation never fails.) */ static int pvconn_pstream_listen(const char *name, char *suffix OVS_UNUSED, - struct pvconn **pvconnp) + struct pvconn **pvconnp, uint8_t dscp) { struct pvconn_pstream *ps; struct pstream *pstream; int error; error = pstream_open_with_default_ports(name, OFP_TCP_PORT, OFP_SSL_PORT, - &pstream); + &pstream, dscp); if (error) { return error; } @@ -365,9 +367,9 @@ pvconn_pstream_wait(struct pvconn *pvconn) /* Stream-based vconns and pvconns. */ -#define DEFINE_VCONN_STREAM_CLASS(NAME) \ - struct vconn_class NAME##_vconn_class = { \ - #NAME, \ +#define STREAM_INIT(NAME) \ + { \ + NAME, \ vconn_stream_open, \ vconn_stream_close, \ vconn_stream_connect, \ @@ -376,27 +378,27 @@ pvconn_pstream_wait(struct pvconn *pvconn) vconn_stream_run, \ vconn_stream_run_wait, \ vconn_stream_wait, \ - }; + } -#define DEFINE_PVCONN_STREAM_CLASS(NAME) \ - struct pvconn_class NAME##_pvconn_class = { \ - #NAME, \ +#define PSTREAM_INIT(NAME) \ + { \ + NAME, \ pvconn_pstream_listen, \ pvconn_pstream_close, \ pvconn_pstream_accept, \ pvconn_pstream_wait \ - }; + } -static DEFINE_VCONN_STREAM_CLASS(stream); -static DEFINE_PVCONN_STREAM_CLASS(pstream); +static struct vconn_class stream_vconn_class = STREAM_INIT("stream"); +static struct pvconn_class pstream_pvconn_class = PSTREAM_INIT("pstream"); -DEFINE_VCONN_STREAM_CLASS(tcp); -DEFINE_PVCONN_STREAM_CLASS(ptcp); +struct vconn_class tcp_vconn_class = STREAM_INIT("tcp"); +struct pvconn_class ptcp_pvconn_class = PSTREAM_INIT("ptcp"); -DEFINE_VCONN_STREAM_CLASS(unix); -DEFINE_PVCONN_STREAM_CLASS(punix); +struct vconn_class unix_vconn_class = STREAM_INIT("unix"); +struct pvconn_class punix_pvconn_class = PSTREAM_INIT("punix"); #ifdef HAVE_OPENSSL -DEFINE_VCONN_STREAM_CLASS(ssl); -DEFINE_PVCONN_STREAM_CLASS(pssl); +struct vconn_class ssl_vconn_class = STREAM_INIT("ssl"); +struct pvconn_class pssl_pvconn_class = PSTREAM_INIT("pssl"); #endif