Makefile.am: Clean flake8-check too.
[cascardo/ovs.git] / lib / stream.c
index 3542455..217191c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2015 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "ofpbuf.h"
 #include "openflow/nicira-ext.h"
 #include "openflow/openflow.h"
+#include "ovs-thread.h"
 #include "packets.h"
 #include "poll-loop.h"
 #include "random.h"
+#include "socket-util.h"
 #include "util.h"
-#include "vlog.h"
+#include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(stream);
 
@@ -51,7 +53,11 @@ enum stream_state {
 
 static const struct stream_class *stream_classes[] = {
     &tcp_stream_class,
+#ifndef _WIN32
     &unix_stream_class,
+#else
+    &windows_stream_class,
+#endif
 #ifdef HAVE_OPENSSL
     &ssl_stream_class,
 #endif
@@ -59,7 +65,11 @@ static const struct stream_class *stream_classes[] = {
 
 static const struct pstream_class *pstream_classes[] = {
     &ptcp_pstream_class,
+#ifndef _WIN32
     &punix_pstream_class,
+#else
+    &pwindows_pstream_class,
+#endif
 #ifdef HAVE_OPENSSL
     &pssl_pstream_class,
 #endif
@@ -582,15 +592,6 @@ pstream_wait(struct pstream *pstream)
     (pstream->class->wait)(pstream);
 }
 
-int
-pstream_set_dscp(struct pstream *pstream, uint8_t dscp)
-{
-    if (pstream->class->set_dscp) {
-        return pstream->class->set_dscp(pstream, dscp);
-    }
-    return 0;
-}
-
 /* Returns the transport port on which 'pstream' is listening, or 0 if the
  * concept doesn't apply. */
 ovs_be16
@@ -675,13 +676,13 @@ stream_open_with_default_port(const char *name_,
 
     if ((!strncmp(name_, "tcp:", 4) || !strncmp(name_, "ssl:", 4))
         && count_fields(name_) < 3) {
-        if (default_port == OFP_OLD_PORT) {
-            VLOG_WARN_ONCE("The default OpenFlow port number will change "
-                           "from %d to %d in a future release",
+        if (default_port == OFP_PORT) {
+            VLOG_WARN_ONCE("The default OpenFlow port number has changed "
+                           "from %d to %d",
                            OFP_OLD_PORT, OFP_PORT);
-        } else if (default_port == OVSDB_OLD_PORT) {
-            VLOG_WARN_ONCE("The default OVSDB port number will change "
-                           "from %d to %d in a future release",
+        } else if (default_port == OVSDB_PORT) {
+            VLOG_WARN_ONCE("The default OVSDB port number has changed "
+                           "from %d to %d",
                            OVSDB_OLD_PORT, OVSDB_PORT);
         }
         name = xasprintf("%s:%d", name_, default_port);
@@ -720,18 +721,18 @@ pstream_open_with_default_port(const char *name_,
 /*
  * This function extracts IP address and port from the target string.
  *
- *     - On success, function returns true and fills *sin structure with port
+ *     - On success, function returns true and fills *ss structure with port
  *       and IP address. If port was absent in target string then it will use
  *       corresponding default port value.
- *     - On error, function returns false and *sin contains garbage.
+ *     - On error, function returns false and *ss contains garbage.
  */
 bool
 stream_parse_target_with_default_port(const char *target,
                                       uint16_t default_port,
-                                      struct sockaddr_in *sin)
+                                      struct sockaddr_storage *ss)
 {
     return ((!strncmp(target, "tcp:", 4) || !strncmp(target, "ssl:", 4))
-             && inet_parse_active(target + 4, default_port, sin));
+            && inet_parse_active(target + 4, default_port, ss));
 }
 
 /* Attempts to guess the content type of a stream whose first few bytes were