2 * Copyright 2001-2005 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /* RPCListener.h - ONC RPC-based Listener implementation
22 #ifndef __RPCListener_h__
23 #define __RPCListener_h__
26 # define _CRT_NONSTDC_NO_DEPRECATE 1
27 # define _CRT_SECURE_NO_DEPRECATE 1
31 # define FD_SETSIZE 1024
34 #include <saml/saml.h> // need this to "prime" the xmlsec-constrained windows.h declaration
35 #include <shib-target/shibrpc.h>
38 namespace shibtarget {
42 class RPCListener : public virtual IListener
45 RPCListener(const DOMElement* e);
48 DDF send(const DDF& in);
49 bool run(bool* shutdown);
51 // Implemented by socket-specific subclasses.
53 typedef SOCKET ShibSocket;
55 typedef int ShibSocket;
57 virtual bool create(ShibSocket& s) const=0;
58 virtual bool connect(ShibSocket& s) const=0;
59 virtual bool bind(ShibSocket& s, bool force=false) const=0;
60 virtual bool accept(ShibSocket& listener, ShibSocket& s) const=0;
61 virtual bool close(ShibSocket& s) const=0;
62 virtual CLIENT* getClientHandle(ShibSocket& s, u_long program, u_long version) const=0;
65 bool log_error() const; // for OS-level errors
66 log4cpp::Category* log;
69 mutable RPCHandlePool* m_rpcpool;
72 // Manage child threads
73 friend class ServerThread;
74 std::map<ShibSocket,shibboleth::Thread*> m_children;
75 shibboleth::Mutex* m_child_lock;
76 shibboleth::CondWait* m_child_wait;