Boost code changes
[shibboleth/cpp-sp.git] / shibsp / remoting / impl / SocketListener.h
index 1c9d612..5c6e34b 100644 (file)
@@ -1,23 +1,27 @@
-/*
- *  Copyright 2001-2007 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__
 
 #include <shibsp/remoting/ListenerService.h>
 
-#include <log4cpp/Category.hh>
+#include <boost/scoped_ptr.hpp>
 #include <xercesc/dom/DOM.hpp>
+#include <xmltooling/logging.h>
 #include <xmltooling/util/Threads.h>
 
 #ifdef WIN32
-# include <winsock.h>
+# include <winsock2.h>
 #endif
 
 namespace shibsp {
 
     class SocketPool;
     class ServerThread;
-    
+
     /**
      * Berkeley Socket-based ListenerService implementation
      */
@@ -53,7 +58,10 @@ namespace shibsp {
         ~SocketListener();
 
         DDF send(const DDF& in);
+
+        bool init(bool force);
         bool run(bool* shutdown);
+        void term();
 
         // Implemented by socket-specific subclasses.
 #ifdef WIN32
@@ -69,20 +77,23 @@ namespace shibsp {
         virtual int send(ShibSocket& s, const char* buf, int len) const=0;
         virtual int recv(ShibSocket& s, char* buf, int buflen) const=0;
 
+        bool m_catchAll;
     protected:
-        bool log_error() const; // for OS-level errors
-        log4cpp::Category* log;
+        bool log_error(const char* fn=nullptr) const; // for OS-level errors
+        xmltooling::logging::Category* log;
         /// @endcond
-    
+
     private:
-        mutable SocketPool* m_socketpool;
+        boost::scoped_ptr<SocketPool> m_socketpool;
         bool* m_shutdown;
 
         // Manage child threads
         friend class ServerThread;
         std::map<ShibSocket,xmltooling::Thread*> m_children;
-        xmltooling::Mutex* m_child_lock;
-        xmltooling::CondWait* m_child_wait;
+        boost::scoped_ptr<xmltooling::Mutex> m_child_lock;
+        boost::scoped_ptr<xmltooling::CondWait> m_child_wait;
+
+        unsigned int m_stackSize;
 
         // Primary socket
         ShibSocket m_socket;