Windows fixes for IPv6 and CIDR support.
[shibboleth/cpp-sp.git] / shibsp / remoting / impl / SocketListener.h
index f555e4d..e6b4fed 100644 (file)
@@ -1,23 +1,27 @@
-/*
- *  Copyright 2001-2009 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
  */
 
 /**
  * SocketListener.h
  *
- * Berkeley Socket-based ListenerService implementation
+ * Berkeley Socket-based ListenerService implementation.
  */
 
 #ifndef __shibsp_socklisten_h__
@@ -34,7 +38,7 @@
 #include <xmltooling/util/Threads.h>
 
 #ifdef WIN32
-# include <winsock.h>
+# include <winsock2.h>
 #endif
 
 namespace shibsp {
@@ -54,17 +58,9 @@ namespace shibsp {
 
         DDF send(const DDF& in);
 
-#ifndef WIN32
-        bool setSignal(int s) {
-            m_signal = s;
-            return true;
-        }
-#endif
-
-        bool run(bool* shutdown) {
-            return run(true, shutdown);
-        }
-        bool run(bool force, bool* shutdown);
+        bool init(bool force);
+        bool run(bool* shutdown);
+        void term();
 
         // Implemented by socket-specific subclasses.
 #ifdef WIN32
@@ -82,15 +78,12 @@ namespace shibsp {
 
         bool m_catchAll;
     protected:
-        bool log_error() const; // for OS-level errors
+        bool log_error(const char* fn=nullptr) const; // for OS-level errors
         xmltooling::logging::Category* log;
         /// @endcond
 
     private:
         mutable SocketPool* m_socketpool;
-#ifndef WIN32
-        int m_signal;
-#endif
         bool* m_shutdown;
 
         // Manage child threads
@@ -99,6 +92,8 @@ namespace shibsp {
         xmltooling::Mutex* m_child_lock;
         xmltooling::CondWait* m_child_wait;
 
+        unsigned int m_stackSize;
+
         // Primary socket
         ShibSocket m_socket;
     };