(file) Return to CIMClientConnection.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ManagedClient

  1 martin 1.12 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.13 //
  3 martin 1.12 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.13 //
 10 martin 1.12 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.13 //
 17 martin 1.12 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.13 //
 20 martin 1.12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.13 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.12 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.13 //
 28 martin 1.12 //////////////////////////////////////////////////////////////////////////
 29 a.arora 1.2  //
 30              //%/////////////////////////////////////////////////////////////////////////////
 31              
 32              #include "CIMClientConnection.h"
 33              
 34              PEGASUS_NAMESPACE_BEGIN
 35              
 36              // class constructor
 37              CIMClientConnection::CIMClientConnection()
 38              {
 39 joyce.j 1.6      _connectionHandle.reset(new CIMClientRep());
 40 dave.sudlik 1.9      _resolvedIP[0] = 0;
 41 a.arora     1.2  }
 42                  
 43 marek       1.10 CIMClientConnection::CIMClientConnection(
 44                      const String& host,
 45                      const String& port,
 46                      const String& userid,
 47                      const String& passwd)
 48                  {
 49                      _hostname = String(host);
 50                      _port = String(port);
 51                      _userid = String(userid);
 52                      _passwd = String(passwd);
 53 kumpf       1.14 
 54 joyce.j     1.6      _connectionHandle.reset(new CIMClientRep());
 55 dave.sudlik 1.9  
 56                          int af;
 57 marek       1.11     System::acquireIP((const char*)host.getCString(), &af, _resolvedIP);
 58 marek       1.10     if (System::isLoopBack(af, _resolvedIP))
 59                      {
 60                          // localhost or ip address of 127.0.0.1
 61                          // still for compare we need the real ip address
 62 kumpf       1.14         System::acquireIP((const char *)
 63 dave.sudlik 1.9                      System::getHostName().getCString(), &af, _resolvedIP);
 64 marek       1.10     }
 65 a.arora     1.2  }
 66                  
 67 marek       1.10 CIMClientConnection::CIMClientConnection(
 68                      const String& host,
 69                      const String& port,
 70                      const String& userid,
 71                      const String& passwd,
 72                      const SSLContext& sslcontext)
 73                  {
 74                      _hostname = String(host);
 75                      _port = String(port);
 76                      _userid = String(userid);
 77                      _passwd = String(passwd);
 78 a.arora     1.2  
 79 joyce.j     1.6      _sslcontext.reset(new SSLContext(sslcontext));
 80 a.arora     1.2  
 81 joyce.j     1.6      _connectionHandle.reset(new CIMClientRep());
 82 dave.sudlik 1.9      int af;
 83 marek       1.11     System::acquireIP((const char*)host.getCString(), &af, _resolvedIP);
 84 dave.sudlik 1.9      if (System::isLoopBack(af, _resolvedIP))
 85 marek       1.10     {
 86                          // localhost or ip address of 127.0.0.1
 87                          // still for compare we need the real ip address
 88 marek       1.11         System::acquireIP((const char *)
 89 dave.sudlik 1.9              System::getHostName().getCString(), &af, _resolvedIP);
 90 marek       1.10     }
 91 a.arora     1.2  }
 92 kumpf       1.14 
 93                  Boolean CIMClientConnection::equals(void *binIPAddress, int af,
 94 dave.sudlik 1.9      const String& port)
 95 a.arora     1.2  {
 96 marek       1.10     // only if port and resolved ip address are equal,
 97                      // we have the same connection/CIMOM
 98                      if (HostAddress::equal(af, binIPAddress, _resolvedIP)
 99 dave.sudlik 1.9              && (String::equalNoCase(_port,port)))
100 marek       1.10     {
101                          return true;
102                      }
103                      return false;
104 a.arora     1.2  }
105                  
106                  CIMClientRep* CIMClientConnection::getConnectionHandle()
107                  {
108 joyce.j     1.6      return _connectionHandle.get();
109 a.arora     1.2  }
110                  
111                  String CIMClientConnection::getUser()
112                  {
113 marek       1.10     return _userid;
114 a.arora     1.2  }
115                  
116                  String CIMClientConnection::getPass()
117                  {
118 marek       1.10     return _passwd;
119 a.arora     1.2  }
120                  
121                  SSLContext* CIMClientConnection::getSSLContext()
122                  {
123 joyce.j     1.6      return _sslcontext.get();
124 a.arora     1.2  }
125                  
126                  
127                  PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2