moss-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Moss-devel] CVS: moss/rmc/include Makefile.am,NONE,1.1 README,NONE,1.1


From: Alexander Feder <address@hidden>
Subject: [Moss-devel] CVS: moss/rmc/include Makefile.am,NONE,1.1 README,NONE,1.1 RmcClient.h,NONE,1.1 RmcObject.h,NONE,1.1 RmcServer.h,NONE,1.1 generic.h,NONE,1.1 rmc.h,NONE,1.1
Date: Sun, 23 Jun 2002 09:27:50 -0400

Update of /cvsroot/moss/moss/rmc/include
In directory subversions:/tmp/cvs-serv2212/include

Added Files:
        Makefile.am README RmcClient.h RmcObject.h RmcServer.h 
        generic.h rmc.h 
Log Message:
added rmc


--- NEW FILE ---
SUBDIRS = Transport 

EXTRA_DIST = RmcClient.h RmcServer.h generic.h rmc.h

install-data-local:
        $(mkinstalldirs) $(prefix)/include/RMC
        $(INSTALL_DATA) RmcClient.h $(prefix)/include/RMC/RmcClient.h
        $(INSTALL_DATA) RmcServer.h $(prefix)/include/RMC/RmcServer.h
        $(INSTALL_DATA) generic.h $(prefix)/include/RMC/generic.h
        $(INSTALL_DATA) rmc.h $(prefix)/include/RMC/rmc.h


--- NEW FILE ---

This folder contain the header files for the project
and all subprojects.

 
--- NEW FILE ---
/***************************************************************************
                               RmcClient.h
                           -------------------
    begin                : Sun Mai 03 2001
    copyright            : (C) 2001 by Manfred Morgner
    email                : address@hidden

 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *                                                                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place Suite 330,                                            *
 *   Boston, MA  02111-1307, USA.                                          *
 *                                                                         *
 ***************************************************************************
 *
 *  Client side RMC.2 Helper class for remote connection and transport
 *
 */

#ifndef __RMC_CLIENT_H
#define __RMC_CLIENT_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#if __GNU__ >= 2
#  pragma interface
#endif // __GNU__ >= 2

// RMC
#include "rmc.h"
#include "Transport/TransportClient.h"
#include "family/PluginHandler.h"

using namespace family;

namespace rmc
  {
  class CRmcClient
    {
    protected:
      bool       m_bConnected;  // do we have a remote object on the server 
side?
      TRmcResult m_nLastResult; // the result of the last remote call
      TRmcClass  m_nClass;      // the class we are working for
      TRmcObject m_nObject;     // the "handle" for the remote object (stub)
      TRmcVisum  m_nVisum;      // the visum for using the remote object
      string     m_sConfigFile; // the configuration file

          // transport members
      CPluginHandler m_oLibTransport;

          // transport functions
          pfnGetTransport            m_fnGetTransport;
          CTransportClientInterface *m_poTransport;
          
    public:
       CRmcClient(const string &sComputer = RMC_LOCAL_MACHINE);
      ~CRmcClient();

    protected:
      void Initialize();
          bool ChangeConfiguration(const string& rsConfigFile);

    public:
    
      // Set the connection information to the transport
      // library. The library has to do nothings but
      // store the given information. The ObjectConnect()
      // methode uses the data internaly
      LONG RemoteSystemConfig(const string& sComputer,
                              const string& sLogin    = _T(""),
                              const string& sPassword = _T(""));

      // Lets the server create a "server side instance"
      // of the client object and return the remote
      // object handle and the security visum.
      TRmcResult ObjectConnect(TRmcClass nClass);

      // Call a remote methode
      TRmcResult Call(TRmcMethode  nMethode,
                      TRmcSize    &rnSize,
                      TRmcData   *&rpcData);

      // Releases the remote object instance. After this
      // call, all RMC related data are invalid.
      TRmcResult ObjectRelease();

    }; // class CRmcClient

  }; // namespace rmc

#endif // __RMC_CLIENT_H

--- NEW FILE ---
/***************************************************************************
                               RmcObject.h
                           -------------------
    begin                : Mon October 22 2001
    copyright            : (C) 2001 Peter Soetens
    email                : address@hidden

 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *                                                                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place Suite 330,                                            *
 *   Boston, MA  02111-1307, USA.                                          *
 *                                                                         *
 ***************************************************************************/

#ifndef __RMC_OBJECT_H
#define __RMC_OBJECT_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#if __GNU__ >= 2
#  pragma interface
#endif // __GNU__ >= 2


namespace rmc
  {
  class CRmcObject
        {
        public:
                   CRmcObject () : m_nVisum(0), m_nObjectId (0), m_nClass(0) {};
          virtual ~CRmcObject () {};

      TRmcObject IdGet() { return m_nObjectId;}
      void       IdSet(TRmcObject nObjectId) { m_nObjectId = nObjectId; }

      TRmcVisum VisumGet() { return m_nVisum; }
      void      VisumSet(TRmcVisum nVisum) { m_nVisum = nVisum; }

      TRmcClass RttiGet()  { return m_nClass; }
      void      RttiSet(TRmcClass nClass) { m_nClass = nClass; }

      virtual TRmcResult RmcWrapperCall(TRmcMethode nMethode, TRmcSize &rnSize, 
TRmcData *&rpcData)=0;

    private:
      TRmcVisum  m_nVisum; // Visum
      TRmcObject m_nObjectId;
      
    public:
      TRmcClass  m_nClass; // RTTI
        }; // class CRmcObject
  }; // namespace rmc

#endif // __RMC_OBJECT_H

--- NEW FILE ---
/***************************************************************************
                               RmcServer.h
                           -------------------
    begin                : Sun Mai 03 2001
    copyright            : (C) 2001 by Manfred Morgner
    email                : address@hidden

 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *                                                                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place Suite 330,                                            *
 *   Boston, MA  02111-1307, USA.                                          *
 *                                                                         *
 ***************************************************************************

  Server side RMC.2 Helper class for remote connection and transport

 ***************************************************************************/

#ifndef __RMC_SERVER_H
#define __RMC_SERVER_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#if __GNU__ >= 2
#  pragma interface
#endif // __GNU__ >= 2

#include "generic.h"
// RMC
#include "rmc.h"

// randomize
#include <stdlib.h>

// STL
#include <map>
#include <vector>

// family
#include <family/Mutex.h>
#include <family/MutexLock.h>
#include <family/PluginHandler.h>

#ifdef WIN32
// our use of "srand()" needs "time()" 
#  include <time.h>
#endif // WIN32


namespace rmc
  {

//+ here is a little bit of work for KM
//+ the macros has to be implemented in a way, that protect
//+ the RMC call wrapper methods from any crash, like
//+ GPF (Win) or Segfault (Linux) or whatever appears
#define RMC_TRY_CALL
#define RMC_CATCH_GPF
#define RMC_END_CATCH


// the entry node for the factory map. here we save the following:
//
// (1) the RTTI for the object, to find out the class during runtime
// (2) the object pointer itself
// (3) a usage counter to ensure, we will not kill the object
//     while it is in use by an other thread
// (4) a flag, if there was a "kill request" during handling an
//     other call. we have to register kill requests, because a
//     client object can send a kill request only ones.
//     malicuse client applications may send more than one kill
//     requests, but the count of them can seamlessly be ignored
//     after a kill request - no new request is allowed.
// (?) LATER ? the time of the last access ?
//
// this is not a class, to not suggest it will do anything
typedef
  struct
    {
    rmc::TRmcClass nClass;
         void*     pObject;
         long      nUseCount;
         bool      bKillme;
    //? time_t    tLastAccess;
    } TObjectNode;

// the map holds the objectId --> pObject relation
// this is gneric code, included by ALL server applications
// that's why we don't know any class definition for "pObject"
typedef std::map<TRmcObject, TObjectNode> CMapHandle2Object;


// object factory
// some methods are implemented inline, because the
// cxx-file is generated by rmcgen and should not 
// implement non changing parts of the class
// NOW the object factory is derived from "CMapHandle2Object"
//     this is, because it is not only the factory, but also
//     the manager - and managing the set of stub object as
//     a natural property of the factory is more near the real
//     and much easier to implement than handle the list of
//     stub objects in a seperated member.
//
// Further, we will not dervice anything from this class
// so "virtual" is no tnecessary. Because "virtual" is a memory
// and performance issues, we are going better without it
class CRmcObjectFactory : public CMapHandle2Object
  {
  protected:
    // this mutex is used for locking the factory
    // some operations need this, to ensure correct behavior of 
    // the the management part of the mission of this class
    family::CMutex  m_oMutex;
    
  public:
    CRmcObjectFactory()
      {
#ifdef WIN32
      srand( (unsigned)time( NULL ) );
#else
      random();
#endif // WIN32
      } // CRmcObjectFactory()
    
    // the factory is thrown away, we have to free all objects
    // because there can't be any user of any object from the factory
    // if there is any object in use during this, we are right to
    // kill ourself, the application or whatever is to kill
    virtual ~CRmcObjectFactory()
      {
      for (iterator it = begin(); it != end(); ++it)
        {
        
        // we need to delete the stub objects the rest will
        // go his way as usual in a map destructor
        //
        // in some gcc implementations this construct lets the
        // compiler throw a warning. this warning is implemented
        // by a programm who didn't understand the meaning of
        // the new/delete pair in C++.
        // I hope, this misbehavior will become removed in one of
        // the next gcc version.
        delete it->second.pObject;
        }  // for (iterator it = begin(); it != end(); ++it)
      
      } // ~CRmcObjectFactory()
    
    // creates : an object for nClass (=rtti)
    // returns : rnObject and rnVisum
    // the instanciated application class implements the server specific
    // functions for the requested class (polymophic)
    // this means - the factory will not instanciate the requested class,
    // but it will instanciate a class, derived from the requested class.
    // Visum is retrieved from the object, because only the object knows it
    TRmcResult ObjectMake(TRmcClass nClass, TRmcObject &rnObject, TRmcVisum 
&rnVisum);
    
    // methode routing
    TRmcResult Call( TRmcClass     nClass,
      void         *pObject,
      TRmcMethode   nMethode,
      TRmcSize    &rnSize,
      TRmcData  *&rpcData,
      TRmcVisum   &rnVisum );
    
    // Returns a queried object in a TObjectNode structure
    TObjectNode& ObjectGetAndUse(TRmcObject nObject)
      {
      TRACE("[Object Get (stub)]\n");
        
      // this is the representation of a "not found node"
      // because we have to write to the usage counter of the node
      // we need a reference to the real node. but if do not find
      // a node in the factory, we have to return anything that
      // can be interpreted as a invalid or non existing node
      static TObjectNode stNoNode = {0,0,0};
      
      // locking the factory to prevent manipulation of it during search
      family::CMutexLock oLock(m_oMutex);
      
      // find the the object.
      // after this we only return, so we don't need explicite
      // unlocking the map.
      // the mutex lock class unlocks automaticaly if it runs
      // out of context - here: at the end of the methode
      iterator it = find(nObject);
      
      // return the CRmcObject
      // if no object was fond, we return the "non node"
      //
      // we have to asume, that the returned structure keeps
      // valid, even if the factor is not locked after returning
      // from the methode.
      // that's why, we increment the usage counter for the
      // object. this is dangeriouse, because we have to watch
      // the counter and we must not forget to decrement it,
      // matching to this increment
      return ( it == end() ) ? stNoNode : it->second;
      } // TObjectNode& ObjectGetAndUse(TRmcObj..
    
    TObjectNode& ObjectGetNotUse(TRmcObject nObject)
      {
      // at first we get the object with the normal methode
      // this methode will lock the node by incrementing the
      // usage counter
      TObjectNode& rtNode = ObjectGetAndUse(nObject);
      
      // now, we decrement the usege counter to give up the
      // lock because the request was: get the node without locking
      rtNode.nUseCount--;
      
      // we return the node without incremented usage counter
      return rtNode;
      } // TObjectNode& ObjectGetNotUse(TRmcObj..
    
    // add an object to the factory management
    // this needs the generation of a local unique ID for the object
    TRmcObject ObjectAdd(TRmcClass nClass, void* pObject)
      {
      // we have to lock the factory for the expensive action
      // because we have to ensure, no one will change anything
      // or generate duplicate ID's.
      // this is, because the uniqueness test goes against the
      // factory - so we may get duplicate ID's if more than one
      // process is in search for a new unique ID
      family::CMutexLock oLock(m_oMutex);
      
      // the new object ID for the given object
      // the ID is local unique and needed as key for the map
      // and also as ID for the client to access this object
      // that is his stub on the server side
      TRmcObject nObject = IdMake();
      
      // the new node contains the RTTI for the class, the real
      // object pointer and initializes the usage counter to "0"
      TObjectNode tNode = {nClass, pObject, 0};
      
      // add the object to the factory using the newly generated key
      operator[](nObject) = tNode;
      
      // we return the content of the object node for further use
      // by the client
      return nObject;
      } // TRmcObject ObjectAdd(void* pNewObject)
    
    // Kill the given object instance if the call is valid
    // there is no removing from the factory without destroying the
    // object, because the object will loose his meaning if it is
    // no more in the factory
    TRmcResult ObjectKill(TRmcObject nObject, TRmcVisum nVisum)
      {
      TRACE("[Object Kill (stub)]\n")
        
        // IS THIS LOCK NEEDED ??
        // (KM) -> YES we can't delete an object that is in use!
        //         and we can't delete elements from the map during
        //         the map is in use (e.g. for searching)
        family::CMutexLock oLock(m_oMutex);
      
      // find the object we can't use the find methode, because we
      // need the complete iterator to erase them from the list
      iterator it = find(nObject);
      if ( it != end() )
        {
        // we have to check the visum
        // this is a passive process and does not change the visum itself
        
        // this is a structural mistake - we have to find a solution.
        // we can't call any methode from the object because here we don't know
        // the object. on the other hand, we should not implement a special
        // part in the application specific part of the factory implementation
        // by rmcgen.
        // - I'm thinking about it (KM)
        //
        //->      if (it->second.CheckVisum(nVisum) != ntohl(nVisum))
        //->            {
        //->            return RMC_E_SECURITY;
        //->            } // if (it->second.CheckVisum(nVisum) == false)
        //
        // one idea is, to implement a template to do this, but this way 
requests
        // building the library with the application, becaise resolving 
templates
        // has to go at compile time AND ist needs code from rmcgen
        
        
        // if the object is in use, we are not allowed to kill it
        // if the useage counter is "1", we assume, that the calling
        // methode has the node in use - so we will delete the
        // node and the object
        if (it->second.nUseCount > 1)
          {
          return RMC_E_LOCKED;
          } // if (it->second.nUseCount > 1)
        
        // now we save the pointer to the object to free it
        // after removeing the node from the factory
        void *pObject = it->second.pObject;
        
        // delete the key
        erase(it);
        
        //+ at this point we should free the mutex because the
        //+ the element is erased, but deletion may be fast
        //+ enought to execute while the map is locked. later
        //+ this will become a point for optimisation
        //+ currently, CMutexLock does not support explicite
        //+ unlocking for some reasons
        
        // delete the object itself
        //
        // in some gcc implementations this construct lets the
        // compiler throw a warning. this warning is implemented
        // by a programm who didn't understand the meaning of
        // the new/delete pair in C++.
        // I hope, this misbehavior will become removed in one of
        // the next gcc version.
        delete pObject;
        } // if ( it != end() )
      
      return RMC_SUCCESS;
      } // TRmcResult ObjectKill(..
    
protected:
  
  // generate a unique ID
  // unique means: unique inside the factory
  //               = local unique
  //               = only valid in this context
  //
  // this call is expensive, so we shouldn't use it very often
  // regarding new object we have to, changing the ID for existing
  // object should go only after some time, not in each call
  // as the visum does.
  TRmcObject IdMake()
    {
    // we have no ID
    // assigning an value at this position will duplicate the code
    // or lead to a new methode and calling it.
    //  - duplicate code is bad
    //  - methode calls in this method are performance relevant
    // initializing with NULL will lead to one assembler instruction
    // the is processed in zero time, depending on the compilers capability
    TRmcObject nResult = 0;
    
    // this loop will end if the random generator presents a local
    // unique ID for a new key for the map in the factory
    // accessing this methode needs a locked factory, because this methode
    // can only work correct if it is called synchron (one thread at a time)
    while ( (nResult == NO_OBJECT) || (find(nResult) != end()) )
      {
      // we try to get an ID
      nResult = (TRmcVisum) (((double)rand())/RAND_MAX * ((unsigned long) -1));
      // sleep for some milliseconds - until 100
      //??        SLEEP_MS((long)((double)rand())/RAND_MAX * 90) +10);
      SLEEP( (long)((double)rand()/RAND_MAX * 90) +10);
      } // while (nRes...
    
    // this is the new and unique ID, the factory has to be held locked
    // until the ID is inserted to it - if it has to stay meaningfull
    // if the factory is unlocked before the ID is inserted, the ID
    // looses there meaning immediately
    return nResult;
    } // TRmcObject IdMake()
  
}; // class CRmcObjectFactory


typedef std::vector<family::CPluginHandler*> CVectorTransports;

//- namespace rmc
//-   {
  class CRmcServer
    {
    protected:
      
      // the object factory manages the incoming calls and handles
      // the administration for the stub objects (server sided objects)
      CRmcObjectFactory m_oObjectFactory;
      
      // transport members
      //CPluginHandler m_oLibTransport;
      CVectorTransports m_voTransports;
      
    public:
      CRmcServer();
      virtual ~CRmcServer();
      
      // add a transport library to the server
      bool TransportAdd(const std::string& sLibTransport);
      
      // create a new stub object as response of a client request
      //
      // INPUT..: nClass - the RTTI 
      //                   = runtime type information
      //                     for the class to create
      //
      // OUTPUT.: rnObject - the ID for the next access to this
      //                                         object from the client side
      //          rnVisum  - the "passport" for the client
      //                     access (changes with every access)
      virtual TRmcResult RmcConnect ( TRmcClass    nClass,
                                      TRmcObject &rnObject,
                                      TRmcVisum  &rnVisum  );
      
      // call the methode in the requstesd object
      // (methode routing)
      //
      // Remote Methode Calls are always coming in here
      // they will become forwarded to the correct
      // object.
      //
      // INPUT..: rnObject - the ID for the object to call
      //          rnVisum  - the passport for the call
      //          nMethode - the RMT-index of the methode to call
      //                     (RMT = Remote Methode Table)
      //          rnSize     the size of the input data coming
      //                     in for the real call (rpcData)
      //          rpcData  - the methode parameters for the
      //                     methode to call
      //
      // OUTPUT.: rnObject - the new ID for the object
      //          rnVisum  - the new passport for the next call
      //          rnSize   - the size of the return data
      //          rpcData  - the return data from the call
      virtual TRmcResult RmcCall    ( TRmcObject  &rnObject,
                                      TRmcVisum   &rnVisum,
                                      TRmcMethode   nMethode,
                                      TRmcSize    &rnSize,
                                      TRmcData   *&rpcData );
      
      // delete the stub object
      //
      // INPUT..: rnObject - the ID for the object to destroy
      //          rnVisum  - the passport for destroying it
      virtual TRmcResult RmcRelease ( TRmcObject nObject,
                                      TRmcVisum  nVisum );
      
    protected:
      // may be, we have to initialize somethings for all
      // constructors. this will be done in this methode.
      // because this methode is called from the constructor,
      // is must not be virtual
      //+ maybe - is should be private (I'm nearly sure)
      void Initialize();
    }; // class CRmcServer
  

  }; // namespace rmc

#endif // __RMC_SERVER_H


--- NEW FILE ---
/***************************************************************************
                               generic.h
                           -------------------
    begin                : Mon Mar 13 2000
    copyright            : (C) 1993..2001 by Manfred Morgner
    email                : address@hidden

 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *                                                                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place Suite 330,                                            *
 *   Boston, MA  02111-1307, USA.                                          *
 *                                                                         *
 ***************************************************************************

 common includes and defines for the project

 ***************************************************************************/

#ifndef __GENERIC_H
#define __GENERIC_H

#if _MSC_VER >= 1000
#pragma once
#pragma warning (disable : 4786)
#endif // _MSC_VER >= 1000

#if __GNU__ >= 2
#  pragma interface
#endif // #if __GNU__ >= 2


//okey remove me once RMC really is included!! XXX 
//#define RMC
//XXX XXX XXX remove me!



// generic flags
#define E_NOT_IMPLEMENTED 0x80001000L

#ifdef WIN32

// #  include <afx.h>
#  include "winsock2.h"
  extern "C" int gettimeofday( struct timeval*, struct timezone*);
// will sleep for <n> milli seconds
#  define SLEEP(n) Sleep(n)
#  define LONG  long
#  define CHAR  char
#  define UCHAR unsigned char

#else // WIN32

#  include <netinet/in.h> // for htonl and ntohl
#  include <sys/time.h>
#  include <unistd.h>
// will sleep for <n> milli seconds
#  define SLEEP(n) usleep(n * 1000)
#  define POSIX

  typedef long LONG;
  typedef char CHAR;
  typedef unsigned char UCHAR;

#endif // else WIN32


#ifdef _DEBUG
  #include <iostream> // for tracing
#endif // _DEBUG

#ifndef TRACE
#  ifdef _DEBUG
#    define TRACE(s) std::cout << s;
#  else // _DEBUG
#    define TRACE(s) {};
#  endif // _DEBUG
#endif // TRACE

#ifndef _T
#  define _T(s) (const std::string&) s
#endif // _T

bool operator > (const timeval& t1, const timeval& t2);

// #include <string>

#endif // __GENERIC_H


--- NEW FILE ---
/***************************************************************************
                                 rmc.h
                           -------------------
    begin                : Sun Mai 03 2001
    copyright            : (C) 2001 by Manfred Morgner
    email                : address@hidden

 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *                                                                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place Suite 330,                                            *
 *   Boston, MA  02111-1307, USA.                                          *
 *                                                                         *
 ***************************************************************************
 *
 *  Generic RMC header.
 *
 */
 
#ifndef __RMC_H
#define __RMC_H

// some generics
#include "generic.h"
// STL
#include <string>

namespace rmc
  {
  // we need this to prevent error messages if the compiler
  // finds a RMC preprocessor clause
#ifndef RMC
#  define RMC
#endif

  // this is for generic string handling
#ifndef _T
#  define _T(s) (const std::string&)s
#endif // _T

  extern "C"
    {
/*
#ifdef WIN32
#   define  LONG long
#   define  CHAR char
#else
    typedef long LONG;
    typedef char CHAR;
#endif
*/
    typedef LONG TTransResult;

    typedef LONG TRmcResult;
    typedef LONG TRmcClass;
    typedef LONG TRmcObject;
    typedef LONG TRmcMethode;
    typedef LONG TRmcVisum;
    typedef LONG TRmcSize;
    typedef CHAR TRmcData;
    typedef LONG TRmcMemPos;

#ifdef WIN32
#   undef  LONG
#   undef  CHAR
#endif

#   define RMC_LOCAL_MACHINE _T(".")

#   define NO_CLASS  0
#   define NO_OBJECT 0
#   define NO_VISUM  0

// these are the commend identifier for the remote
// call. it is suggested to use them, but not 
// necessary
#   define RMC_IDENT_CONNECT _T("Conn")
#   define RMC_IDENT_CALL    _T("Call")
#   define RMC_IDENT_RELEASE _T("Rele")

    enum
      {
      RMC_SUCCESS          =   0,
      RMC_FAILURE          = - 1,
      RMC_ERROR            = - 2,
      RMC_E_NO_TRANSPORT   = - 3,
      RMC_E_INVALID_ACCESS = - 4,
      RMC_E_RMT_IDX        = - 5,
      RMC_E_LOCKED         = - 6,
      RMC_E_DELETING       = - 7,
      RMC_E_REMOTE_GPF     = - 8,
      RMC_E_NO_STUB        = - 9,
      RMC_E_NO_CLASS       = -10,
      RMC_E_NO_OBJECT      = -11
      };

    enum
      {
      TRANSPORT_SUCCESS =  0,
      TRANSPORT_FAILURE = -1,
      TRANSPORT_ERROR   = -2
      };

    }; // extern "C"
  }; // namespace rmc

//- using namespace rmc;
//- using namespace std;

#endif // __RMC_H




reply via email to

[Prev in Thread] Current Thread [Next in Thread]