Removed sock name typedef, reorgd headers
authorScott Cantor <cantor.2@osu.edu>
Sun, 18 Jan 2004 02:42:31 +0000 (02:42 +0000)
committerScott Cantor <cantor.2@osu.edu>
Sun, 18 Jan 2004 02:42:31 +0000 (02:42 +0000)
15 files changed:
shib-target/XMLApplicationMapper.cpp
shib-target/internal.h
shib-target/shib-ccache.cpp
shib-target/shib-config.cpp
shib-target/shib-ini.cpp
shib-target/shib-mlp.cpp
shib-target/shib-resourceentry.cpp
shib-target/shib-rm.cpp
shib-target/shib-rpcerror.cpp
shib-target/shib-rpchandle.cpp
shib-target/shib-shire.cpp
shib-target/shib-sock.c
shib-target/shib-target.cpp
shib-target/shib-target.h
shib-target/shibrpc-server.cpp

index 9426c82..f206961 100644 (file)
 #include <log4cpp/Category.hh>
 #include <xercesc/framework/URLInputSource.hpp>
 
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
+
 namespace shibtarget {
 
     class XMLApplicationMapperImpl : public ReloadableXMLFileImpl
index 80b8772..129a7d6 100644 (file)
 
 #include "ccache-utils.h"
 
-#include <log4cpp/Category.hh>
-
-using namespace std;
-using namespace log4cpp;
-using namespace saml;
-using namespace shibboleth;
-using namespace shibtarget;
-
 namespace shibtarget {
 
     // An implementation of the URL->application mapping API using an XML file
-    class XMLApplicationMapper : public IApplicationMapper, public ReloadableXMLFile
+    class XMLApplicationMapper : public IApplicationMapper, public shibboleth::ReloadableXMLFile
     {
     public:
-        XMLApplicationMapper(const char* pathname) : ReloadableXMLFile(pathname) {}
+        XMLApplicationMapper(const char* pathname) : shibboleth::ReloadableXMLFile(pathname) {}
         ~XMLApplicationMapper() {}
 
         const char* getApplicationFromURL(const char* url) const;
@@ -103,7 +95,7 @@ namespace shibtarget {
             ) const;
 
     protected:
-        virtual ReloadableXMLFileImpl* newImplementation(const char* pathname) const;
+        virtual shibboleth::ReloadableXMLFileImpl* newImplementation(const char* pathname) const;
     };
 
     class STConfig : public ShibTargetConfig
@@ -116,10 +108,10 @@ namespace shibtarget {
         void shutdown();
         ShibINI& getINI() const { return *ini; }
         IApplicationMapper* getApplicationMapper() const { return m_applicationMapper; }
-        saml::Iterator<IMetadata*> getMetadataProviders() const { return metadatas; }
-        saml::Iterator<ITrust*> getTrustProviders() const { return trusts; }
-        saml::Iterator<ICredentials*> getCredentialProviders() const { return creds; }
-        saml::Iterator<IAAP*> getAAPProviders() const { return aaps; }
+        saml::Iterator<shibboleth::IMetadata*> getMetadataProviders() const { return metadatas; }
+        saml::Iterator<shibboleth::ITrust*> getTrustProviders() const { return trusts; }
+        saml::Iterator<shibboleth::ICredentials*> getCredentialProviders() const { return creds; }
+        saml::Iterator<shibboleth::IAAP*> getAAPProviders() const { return aaps; }
         saml::Iterator<const XMLCh*> getPolicies() const { return saml::Iterator<const XMLCh*>(policies); }
      
     private:
@@ -134,13 +126,13 @@ namespace shibtarget {
         std::vector<std::string> m_SocketACL;
 #endif
         IApplicationMapper* m_applicationMapper;
-        std::vector<IMetadata*> metadatas;
-        std::vector<ITrust*> trusts;
-        std::vector<ICredentials*> creds;
-        std::vector<IAAP*> aaps;
+        std::vector<shibboleth::IMetadata*> metadatas;
+        std::vector<shibboleth::ITrust*> trusts;
+        std::vector<shibboleth::ICredentials*> creds;
+        std::vector<shibboleth::IAAP*> aaps;
       
-        friend ShibSockName ::shib_target_sockname();
-        friend ShibSockName ::shib_target_sockacl(unsigned int);
+        friend const char* ::shib_target_sockname();
+        friend const char* ::shib_target_sockacl(unsigned int);
     };
 
     class XML
index 1903782..491f416 100644 (file)
 #include <dmalloc.h>
 #endif
 
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
+
 class InternalCCache;
 class InternalCCacheEntry : public CCacheEntry
 {
index 8172dcf..32b2e4b 100644 (file)
 #define SHIBTARGET_INIFILE "/opt/shibboleth/etc/shibboleth/shibboleth.ini"
 #endif
 
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
+
 namespace {
   STConfig * g_Config = NULL;
   Mutex * g_lock = NULL;
@@ -380,18 +386,18 @@ void STConfig::shutdown()
   }
 }
 
-extern "C" ShibSockName shib_target_sockname(void)
+extern "C" const char* shib_target_sockname(void)
 {
-    return (g_Config ? g_Config->m_SocketName.c_str() : (ShibSockName)0);
+    return g_Config ? g_Config->m_SocketName.c_str() : NULL;
 }
 
-extern "C" ShibSockName shib_target_sockacl(unsigned int index)
+extern "C" const char* shib_target_sockacl(unsigned int index)
 {
 #ifdef WANT_TCP_SHAR
     if (g_Config && index<g_Config->m_SocketACL.size())
         return g_Config->m_SocketACL[index].c_str();
 #endif
-    return (ShibSockName)0;
+    return NULL;
 }
 
 ApplicationMapper::ApplicationMapper() : m_mapper(ShibTargetConfig::getConfig().getApplicationMapper())
index 79142bf..5270664 100644 (file)
@@ -58,6 +58,7 @@
 #include "internal.h"
 
 #include <shib/shib-threads.h>
+#include <log4cpp/Category.hh>
 
 #include <sstream>
 #include <iostream>
 #include <sys/types.h>
 #include <sys/stat.h>
 
+using namespace std;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
+
 class HeaderIterator : public shibtarget::ShibINI::Iterator {
 public:
   HeaderIterator (ShibINIPriv* ini);
index 9458476..00548d1 100644 (file)
 #include <sstream>
 #include <ctype.h>
 #include <xercesc/util/XercesDefs.hpp>
+#include <log4cpp/Category.hh>
+
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
 
 class shibtarget::ShibMLPPriv {
 public:
index 5218fbe..c6c3720 100644 (file)
 #include <dmalloc.h>
 #endif
 
+#include <log4cpp/Category.hh>
+
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
+
 class shibtarget::ResourceEntryPriv
 {
 public:
index 9932ff3..55cc6d3 100644 (file)
 #include <sstream>
 #include <stdexcept>
 
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
+
 class shibtarget::RMPriv
 {
 public:
index 3c44b01..6a517c4 100644 (file)
 #include <stdexcept>
 #include <sstream>
 #include <typeinfo>
+#include <log4cpp/Category.hh>
+
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
 
 namespace {
   int initializing = 0;
index 9843b15..328b526 100644 (file)
 #include <shib/shib-threads.h>
 
 #include <stdexcept>
+#include <log4cpp/Category.hh>
+
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
 
 class shibtarget::RPCHandleInternal
 {
@@ -73,7 +80,7 @@ public:
   CLIENT *     m_clnt;
   ShibSocket   m_sock;
 
-  ShibSockName m_shar;
+  const char* m_shar;
   u_long       m_program;
   u_long       m_version;
 
@@ -92,7 +99,7 @@ RPCHandleInternal::RPCHandleInternal()
 //*************************************************************************
 // RPCHandle Implementation
 
-RPCHandle::RPCHandle(ShibSockName shar, u_long program, u_long version)
+RPCHandle::RPCHandle(const char* shar, u_long program, u_long version)
 {
   m_priv = new RPCHandleInternal();
 
@@ -212,7 +219,7 @@ void RPCHandle::disconnect(void)
 }
 
 RPCHandle* RPCHandle::get_handle(ThreadKey* key,
-                                ShibSockName shar, u_long program,
+                                const char* shar, u_long program,
                                 u_long version)
 {
   RPCHandle* retval = (RPCHandle*)key->getData();
index 1c79832..21292e7 100644 (file)
 #endif
 
 #include <stdexcept>
+#include <log4cpp/Category.hh>
+
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
 
 class shibtarget::SHIREPriv
 {
index 3f08118..3417509 100644 (file)
@@ -72,7 +72,7 @@
 #include <errno.h>
 
 #if defined(WANT_TCP_SHAR)
-static void setup_tcp_sockaddr(struct sockaddr_in *addr, ShibSockName name)
+static void setup_tcp_sockaddr(struct sockaddr_in *addr, const char* name)
 {
     // Split on host:port boundary. Default to port only.
     char* dup=strdup(name);
@@ -120,7 +120,7 @@ int shib_sock_create(ShibSocket *sock)
     return 0;
 }
 
-int shib_sock_bind(ShibSocket s, ShibSockName name)
+int shib_sock_bind(ShibSocket s, const char* name)
 {
   struct sockaddr_in addr;
   int res;
@@ -132,14 +132,14 @@ int shib_sock_bind(ShibSocket s, ShibSockName name)
   return map_winsock_result(listen(s,3));
 }
 
-int shib_sock_connect(ShibSocket s, ShibSockName name)
+int shib_sock_connect(ShibSocket s, const char* name)
 {
   struct sockaddr_in addr;
   setup_tcp_sockaddr(&addr,name);
   return map_winsock_result(connect(s,(struct sockaddr *)&addr,sizeof(addr)));
 }
 
-void shib_sock_close(ShibSocket s, ShibSockName name)
+void shib_sock_close(ShibSocket s, const char* name)
 {
   int rc=map_winsock_result(closesocket(s));
 }
@@ -147,7 +147,7 @@ void shib_sock_close(ShibSocket s, ShibSockName name)
 int shib_sock_accept(ShibSocket listener, ShibSocket* s)
 {
   unsigned int index=0;
-  ShibSockName acl,client;
+  const char *acl,*client;
   struct sockaddr_in addr;
   size_t size=sizeof(addr);
 
@@ -156,12 +156,12 @@ int shib_sock_accept(ShibSocket listener, ShibSocket* s)
   if(*s==INVALID_SOCKET)
     return get_winsock_errno();
   client=inet_ntoa(addr.sin_addr);
-  while ((acl=shib_target_sockacl(index++))!=(ShibSockName)0)
+  while (acl=shib_target_sockacl(index++))
   {
     if (!strcmp(acl,client))
         return 0;
   }
-  shib_sock_close(*s,(ShibSockName)0);
+  shib_sock_close(*s,NULL);
   *s=-1;
   fprintf(stderr,"shib_sock_accept(): rejected client at %s\n",client);
   return EACCES;
@@ -195,7 +195,7 @@ int shib_sock_create(ShibSocket *sock)
  *
  * NOTE: This will close the socket on failure 
  */
-int shib_sock_bind(ShibSocket s, ShibSockName name)
+int shib_sock_bind(ShibSocket s, const char* name)
 {
 #ifdef WANT_TCP_SHAR
   struct sockaddr_in addr;
@@ -233,7 +233,7 @@ int shib_sock_bind(ShibSocket s, ShibSockName name)
 }
 
 /* Connect the socket to the local host and "port name" */
-int shib_sock_connect(ShibSocket s, ShibSockName name)
+int shib_sock_connect(ShibSocket s, const char* name)
 {
 #ifdef WANT_TCP_SHAR
   struct sockaddr_in addr;
@@ -256,7 +256,7 @@ int shib_sock_connect(ShibSocket s, ShibSockName name)
 }
 
 /* close the socket (and remove the file) */
-void shib_sock_close(ShibSocket s, ShibSockName name)
+void shib_sock_close(ShibSocket s, const char* name)
 {
 #ifndef WANT_TCP_SHAR
   if (name) {
@@ -271,7 +271,7 @@ int shib_sock_accept(ShibSocket listener, ShibSocket* s)
 {
 #ifdef WANT_TCP_SHAR
   unsigned int index=0;
-  ShibSockName acl,client;
+  const char *acl,*client;
   struct sockaddr_in addr;
   size_t size=sizeof(addr);
 
@@ -280,12 +280,12 @@ int shib_sock_accept(ShibSocket listener, ShibSocket* s)
   if (*s < 0)
     return errno;
   client=inet_ntoa(addr.sin_addr);
-  while ((acl=shib_target_sockacl(index++))!=(ShibSockName)0)
+  while (acl=shib_target_sockacl(index++))
   {
     if (!strcmp(acl,client))
         return 0;
   }
-  shib_sock_close(*s,(ShibSockName)0);
+  shib_sock_close(*s,NULL);
   *s=-1;
   fprintf(stderr,"shib_sock_accept(): rejected client at %s\n",client);
   return EACCES;
index 77ffcdb..94373da 100644 (file)
 
 #include "internal.h"
 
+#include <log4cpp/Category.hh>
+
+using namespace std;
+using namespace shibtarget;
+
 /* shib-target.cpp */
 
 namespace {
index 9aee470..528fe6e 100644 (file)
@@ -82,13 +82,11 @@ extern "C" {
 
 #include <winsock.h>
 typedef SOCKET ShibSocket;
-typedef const char* ShibSockName;
 #define SHIB_SHAR_SOCKET "127.0.0.1:12345"  /* TCP host:port */
 
 #else  /* UNIX */
 
 typedef int ShibSocket;
-typedef const char* ShibSockName;
 #define SHIB_SHAR_SOCKET "/tmp/shar-socket" /* Unix domain socket */
 
 #endif
@@ -119,14 +117,14 @@ SHIBTARGET_EXPORTS int shib_sock_create (ShibSocket *sock);
  *
  * SIDE EFFECT: On error, the socket is closed!
  */
-SHIBTARGET_EXPORTS int shib_sock_bind (ShibSocket s, ShibSockName name);
+SHIBTARGET_EXPORTS int shib_sock_bind (ShibSocket s, const char* name);
 
 /*
  * connect the socket s to the "port" name on the local host.
  *
  * Returns 0 on success; non-zero on error.
  */
-SHIBTARGET_EXPORTS int shib_sock_connect (ShibSocket s, ShibSockName name);
+SHIBTARGET_EXPORTS int shib_sock_connect (ShibSocket s, const char* name);
 
 /*
  * accept a connection.  Returns 0 on success, non-zero on failure.
@@ -136,7 +134,7 @@ SHIBTARGET_EXPORTS int shib_sock_accept (ShibSocket listener, ShibSocket* s);
 /*
  * close the socket
  */
-SHIBTARGET_EXPORTS void shib_sock_close (ShibSocket s, ShibSockName name);
+SHIBTARGET_EXPORTS void shib_sock_close (ShibSocket s, const char* name);
 
 /* shib-target.cpp */
 
@@ -178,8 +176,8 @@ SHIBTARGET_EXPORTS int shib_target_initialize (const char* application, const ch
 SHIBTARGET_EXPORTS void shib_target_finalize (void);
 
 /* access socket specifics from C code */
-SHIBTARGET_EXPORTS ShibSockName shib_target_sockname(void);
-SHIBTARGET_EXPORTS ShibSockName shib_target_sockacl(unsigned int index);
+SHIBTARGET_EXPORTS const char* shib_target_sockname(void);
+SHIBTARGET_EXPORTS const char* shib_target_sockacl(unsigned int index);
 
 #ifdef __cplusplus
 }
@@ -190,7 +188,7 @@ namespace shibtarget {
   class SHIBTARGET_EXPORTS RPCHandle
   {
   public:
-    RPCHandle(ShibSockName shar, u_long program, u_long version);
+    RPCHandle(const char* shar, u_long program, u_long version);
     ~RPCHandle();
 
     CLIENT *   connect(void);  /* locks the HANDLE and returns the CLIENT */
@@ -200,7 +198,7 @@ namespace shibtarget {
     // A simple function to get a handle
     // Note that it does not check that an existing handle matches the request.
     static RPCHandle* get_handle(shibboleth::ThreadKey* key,
-                                ShibSockName shar, u_long program,
+                                const char* shar, u_long program,
                                 u_long version);
 
   private:
index c99cd57..58ac0c5 100644 (file)
 #include <dmalloc.h>
 #endif
 
+#include <log4cpp/Category.hh>
+
+using namespace std;
+using namespace log4cpp;
+using namespace saml;
+using namespace shibboleth;
+using namespace shibtarget;
+
 static string get_threadid (const char* proc)
 {
   static u_long counter = 0;