[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Moss-devel] CVS: moss/rmc/src/Demos/Chat/Server Chat_s.cxx,NONE,1.1 Cha
From: |
Alexander Feder <address@hidden> |
Subject: |
[Moss-devel] CVS: moss/rmc/src/Demos/Chat/Server Chat_s.cxx,NONE,1.1 Chat_s.h,NONE,1.1 Makefile.am,NONE,1.1 RmcObjectFactory.cxx,NONE,1.1 main.cxx,NONE,1.1 |
Date: |
Sun, 23 Jun 2002 09:27:52 -0400 |
Update of /cvsroot/moss/moss/rmc/src/Demos/Chat/Server
In directory subversions:/tmp/cvs-serv2212/src/Demos/Chat/Server
Added Files:
Chat_s.cxx Chat_s.h Makefile.am RmcObjectFactory.cxx main.cxx
Log Message:
added rmc
--- NEW FILE ---
/***************************************************************************
Chat_s.cxx
-------------------
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. *
* *
***************************************************************************
*
* RMC.2 sample application.
*
* Server Side: A simple chat server using 2 remote methods
* "Send(.)" and "Receive(.)"
*
*/
// #define _DEBUG
// RMC generated - don't change ---> START
#include "generic.h"
#include "Chat_s.h"
#include <string>
using namespace std;
// the RMT (remote methode table)
//long (CChat::*s_rmc_s_apmRmt[])(TRmcSize&, TRmcData*&) =
long (CChat::*CChat::s_rmc_s_apmRmt[])(TRmcSize&, TRmcData*&) =
{
&CChat::RmcSend0,
&CChat::RmcReceive0,
&CChat::RmcGetHistory0,
&CChat::RmcGetHistory1,
&CChat::RmcSetParameter0,
&CChat::RmcSend1,
&CChat::RmcStartAgents0
}; // slong (CChat::*CChat::s_rmc_s_apmRmt[])(TRmcSize&, TRmcData*&)
long CChat::s_rmc_s_nRTTI = RTTI_CCHAT;
// RMC generated - don't change <--- END
// the application data - inserted by hand in case of the
// applicational purpose of the class
CVectorString CChat::s_vsText;
// the one an only constructor for this class
CChat::CChat( )
: m_nReadPosition(0)
{
RmcVisumMake();
} // CChat::CChat( CQueueString *pqsText )
// s: IN, incoming from the client
long CChat::Send(const std::string &s)
{
TRACE("[char send \"") TRACE(s) TRACE("\"]\n")
SLEEP(5000);
s_vsText.push_back(s);
TRACE("\tdone.\n")
return CHAT_SUCCESS;
} // long Send(const string &s)
// s: OUT, outgoing to the client
long CChat::Receive(std::string &s)
{
TRACE("[chat receive]\n")
if ( s_vsText.size() <= (size_t) m_nReadPosition )
{
s = "";
return CHAT_SUCCESS;
}
s = s_vsText[m_nReadPosition++];
if (s.length() == 0)
{
s = "<EMPTY>";
} // if (s.length() == 0)
TRACE("\t\"") TRACE(s) TRACE("\"]\n")
return CHAT_SUCCESS;
} // long Receive(string &s)
// nIndex: IN, index in the history relative
// to the starting point of the stub instance
// s.....: OUT, transport as "char*"
// the OUT(-only) attribut is given by declaration
void CChat::GetHistory(long nIndex, /* out */ std::string &s)
{
TRACE("[get history <0>] - FAKE\n")
s = "faked parameter";
/*========
DUMMY
========*/
} // void CChat::GetHistory(long nIndex, /* out */ string &s)
// return: the next line from the history (backward)
// the answer (read index) is managed by the stub (server sided)
std::string CChat::GetHistory()
{
TRACE("[get history <1>] - FAKE\n")
return "fake as return value";
/*========
DUMMY
========*/
std::string s;
return s;
} // string CChat::GetHistory()
// IN: sNick
// IN: nOptions
void CChat::SetParameter(const std::string &sNick, long nOptions)
{
TRACE("[set parameter] - DUMMY\n")
/*========
DUMMY
========*/
} // void CChat::SetParameter(const string &sNick, long nOptions)
// IN: roAgent
void CChat::Send(CAgent &roAgent)
{
TRACE("[send an agent] - DUMMY\n")
/*========
DUMMY
========*/
} // void CChat::Send(CAgent &roAgent)
void CChat::StartAgents()
{
TRACE("[start agents] - DUMMY\n")
/*========
DUMMY
========*/
} // void CChat::StartAgents()
--- NEW FILE ---
/***************************************************************************
Chat_s.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. *
* *
***************************************************************************
TECHNICAL HINT:
special member prefixes to prevent naming conflicts in methode wrappers
rmc_c_v_: RMC Client Variable
rmc_c_r_: RMC Client Result
ABOUT:
This is the server sided declaration for the "somple chat demo" for the
RMC.2 project. Here you may see, how incoming calls are handled.
The purpose of the source is
* RMC.2 development and optimisation
* Sample code for the code generator development
***************************************************************************/
#ifndef __CHAT_SERVER_CLASS_H
#define __CHAT_SERVER_CLASS_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#if __GNU__ >= 2
# pragma interface
#endif // __GNU__ >= 2
// -> server sided user code
#include <string>
#include <vector>
#ifdef _DEBUG
// for "cout", "<<" and "endl"
# include <ostream.h>
#endif // _DEBUG
typedef std::vector<std::string> CVectorString;
#define CHAT_SUCCESS 0L
#define CHAT_FAILURE -1L
// <- server sided user code
// RMC Helper
#include "RmcServer.h"
//* #include "RmcObject.h"
/***************************************************************************
THIS IS A SAMPLE CLASS! IN A REAL PROJECT THE CLASS DEFINTION
AND IMPLEMENTATION HAS TO GO INTO TWO OTHER FILES CURRENTLY
THIS DEMONSTRATION AND DEVELOPMENT APPLICATION HAS TO HAVE A
SIMPLE PROJECT STRUCTURE. THATS WHY I INSERTED THE COMPLETE DUMMY
CLASS FOR TESTING PRPOSE ON THIS POINT.
For technical information: See Client_c.h
***************************************************************************/
class CAgent // for development reason declared and implemented here
{
std::string m_sCode;
public:
// RMC transport helper methods
long _RMC_size()
{
return m_sCode.length() +1;
}
/*
bool _RMC_put(TRmcData*& rpData)
{
strcpy(rpData, m_sCode.c_str());
return true;
}
*/
bool _RMC_get(rmc::TRmcData* rpData)
{
m_sCode = (char*)rpData;
return true;
}
}; // class CAgent
/***************************************************************************
END OF SPECIAL SEQUENCE
***************************************************************************/
// the RTTI -> same as on the client side
#define RTTI_CCHAT 0x77973323
// the size of the RMT (remote methode table)
#define CHAT_RMT_SIZE 7
using namespace rmc;
//- Enabeling objects for RMC must not make any inheritance
//- necessary. The whole RMC specific code has to go into the
//- object as it is. Otherwise we break down usability and
//- prevent exisiting objects from becoming RMC enabled.
class CChat //* : public CRmcObject
{
friend CRmcObjectFactory;
private:
// the RTTI code
// decoration (special) :
// static rmc-related server-sided numerical value
// contains the Runtime Type Information for the class
// this value is unique for the class. the rtti from the
// client side is used to select the class to instanciate
// in the server side. typical the server instanciates a
// class that is derived from the class the clietn requests.
// e.g.: if the client request a "meter"-class, the server
// may instanciate a "thermo-meter" class.
static long s_rmc_s_nRTTI;
// -> server sided user code
protected:
long m_nReadPosition;
static CVectorString s_vsText; // the chat queue
public:
CChat();
// <- server sided user code
// DECLARED RMC API
// to implement by the programmer in the CXX file
// the
public:
// s: IN, incoming from the client
long Send(const std::string &s);
// s: OUT, outgoing to the client
long Receive(std::string &s);
// nIndex: IN, index in the history relative
// to the starting point of the stub instance
// s.....: OUT, transport as "char*"
// the OUT(-only) attribut is given by declaration
void GetHistory(long nIndex, /* out */ std::string &s);
// return: the next line from the history (backward)
// the answer (read index) is managed by the stub (server sided)
std::string GetHistory();
// IN: sNick
// IN: nOptions
void SetParameter(const std::string &sNick, long nOptions);
// IN: roAgent
void Send(CAgent &roAgent);
void StartAgents();
protected:
// RMT (remote methode table)
static long (CChat::*CChat::s_rmc_s_apmRmt[])(TRmcSize&, TRmcData*&);
// the RMC visum - for security check
TRmcVisum m_rmc_s_nVisum;
// route the remote methode call to the requested object
//
// INPUT..: nMethode - The index of the methode in the RMT
// (RMT = remote methode table)
// rnSize - the size of the given datablock (rpcData)
// rpcData - the data for the methode
// rnVisum - the visum for accessing the object as such
//
// OUTPUT.: rnSize - the size of the returned datablock (rpcData)
// rpcData - the data from the methode
// rnVisum - the visum for the next access to the object as such
TRmcResult RmcWrapperCall(TRmcMethode nMethode,
TRmcSize &rnSize,
TRmcData *&rpcData,
TRmcVisum &rnVisum)
{
TRACE("Chat::RmcWrapperCall\n")
// if the visum doesnt match, we reject the access
if (rnVisum != m_rmc_s_nVisum)
{
TRACE("\t\tvisum does not match\n")
return RMC_E_INVALID_ACCESS;
} // if (rnVisum != m_rmc_s_nVisum)
TRACE("\t\tvisum ok\n")
// a new visum for the next call
// we give a new "visum", even if we don't know if the call will
// become executed or successfull.
rnVisum = RmcVisumMake();
#ifdef _DEBUG
cout << "\tNew visum : " << rnVisum << endl;
#endif // _DEBUG
// we have to check, if the given index is in the range of the
// RMT (remote methode table). if not, we have to return immediately
if ( (nMethode < 0) || (nMethode >= CHAT_RMT_SIZE) )
{
return RMC_E_RMT_IDX;
} // if ( (nMethode < 0) || (nMethode >= CHAT_RMT_SIZE) )
return (this->*s_rmc_s_apmRmt[nMethode])(rnSize, rpcData);
} // TRmcResult RmcWrapperCall(nMethode, rnSize, rpcData)
// generate a new visum for the next contact
// must not be virtual, because it is called from the constructor
TRmcVisum RmcVisumMake()
{
// random();
static double dRange = (double)((unsigned long) -1);
return m_rmc_s_nVisum = (TRmcVisum) ( dRange * rand()/(RAND_MAX +1));
} // TRmcVisum CRmcObject::MakeVisum()
// rmc methode wrapper
public:
// wrappers for the REM (remote enabled methodes)
// all call wrapper mathods are getting the same parameter list
//
// INPUT..: rnSize - the size of the data block in "rpcData"
// rpcData - the data for the real methode call
//
// OUTPUT.: rnSize - the size of the resulting data block (rpcData)
// rpcData - the data from the methode call
//+ for stability and protection agains memory overflow by malicuse
//+ received data, each methode wrapper should contain a protcection
//+ against memory overflow. unfortunately, this means different
//+ procedures in different operations systgem. that's why, we will
//+ add this stuff after porting the first stable alpha verison to
//+ at least Windows and BSD. for now, we expect, that these procedures
//+ all will be able to implement in a way, that the given "general
//+ protection macros" will be implementable
//+
//+ #define RMC_TRY_CALL
//+ #define RMC_CATCH_GPF
//+ #define RMC_END_CATCH
// calls:
// long Send(const string &s);
TTransResult RmcSend0(TRmcSize& rnSize, TRmcData*& rpcData)
{
RMC_TRY_CALL
TRACE("Chat::RmcSend0 : \"")
TRACE(rpcData)
TRACE("\"\n")
// super special case:
// the one and only argument is a string
// this makes the convertion of the incoming parameters very easy
std::string rmc_c_v_s = rpcData; // should we use length control ?
// call the real methode
// we have to return the function result as defined
long rmc_c_r_nResult = Send(rmc_c_v_s);
// there was somethings in the buffer, we have to delete it.
#ifndef WIN32
delete rpcData;
#endif
rnSize = sizeof(rmc_c_r_nResult); // the methode result
rpcData = new char[rnSize];
// special case:
// only one value goes back to the server, we don't need
// buffer indexing
memcpy ((void*)rpcData, &rmc_c_r_nResult, sizeof(rmc_c_r_nResult));
RMC_CATCH_GPF
return RMC_E_REMOTE_GPF;
RMC_END_CATCH
return RMC_SUCCESS;
} // TTransResult RmcSend0(..)
// calls:
// long Receive(/* OUT */ string &s);
TTransResult RmcReceive0(TRmcSize& rnSize, TRmcData*& rpcData)
{
TRACE("Chat::RmcReceive\n")
// the function argument
// we do not initialize it because we have no IN data
std::string rmc_c_v_s;
// the real call
long rmc_c_r_nResult = Receive(rmc_c_v_s);
// "s" is an OUT value (defined in the source script)
// that's why, the buffer is uninitialized
// - EMPTY BUFFER - delete rpcData;
// prepaire the return buffer
rnSize = sizeof(rmc_c_r_nResult); // the methode result
rnSize += rmc_c_v_s.length() +1; // the received string (if any)
rpcData = new char[rnSize];
long nOutPos = 0;
memcpy ((void*)&((rpcData)[nOutPos]), &rmc_c_r_nResult,
sizeof(rmc_c_r_nResult));
nOutPos += sizeof(rmc_c_r_nResult);
strncpy((char*)&(rpcData[nOutPos]), rmc_c_v_s.c_str(),
rmc_c_v_s.length()+1);
// not neccessary: nInsPos += rmc_c_v_s.length() +1;
return RMC_SUCCESS;
} // TTransportResult RmcReceive0(..)
// calls:
// void GetHistory(long nIndex, /* out */ string &s);
// special:
// nIndex is a IN-value ("write only" into the server)
TTransResult RmcGetHistory0(TRmcSize& rnSize, TRmcData*& rpcData)
{
TRACE("Chat::RmcGetHistroy\n")
// the function arguments
// we do not initialize "s" because we have no IN data
std::string rmc_c_v_s;
// the IN value "nIndex"
// Remember: this is a very special case!
// if more than one arguments are coming in, we need
// buffer indexing. this will result in a mor complex
// casting statement like:
// .. = *((long*)&(rpcData[nInPos]))
// in other cases we need memcpy() or strncpy() calls
long rmc_c_v_nIndex = *((long*)rpcData);
// the real call
GetHistory(rmc_c_v_nIndex, rmc_c_v_s);
// there was somethings in the buffer, we have to delete it.
#ifndef WIN32
delete rpcData;
#endif
// prepaire the return buffer
rnSize = rmc_c_v_s.length() +1; // the received string (if any)
rpcData = new char[rnSize];
// special case, only one result is to return ->
// we do not need any write position handling and so
// no indexing into the transport buffer too.
strncpy(rpcData, rmc_c_v_s.c_str(), rmc_c_v_s.length()+1);
return RMC_SUCCESS;
} // TTransResult RmcGetHistory0(..)
// calls:
// string GetHistory();
TTransResult RmcGetHistory1(TRmcSize& rnSize, TRmcData*& rpcData)
{
TRACE("Chat::RmcGetHistroy\n")
// no function arguments given (neighter IN nor OUT),
// -> nothings to initialize
// the real call
std::string rmc_c_r_sResult = GetHistory();
// nothings is coming in. this means, the buffer is not
// initialzed and does not contain any pointer to any
// allocated memory block. we don't delete this buffer, because
// if we do so, the system is in danger
// - EMPTY BUFFER - delete rpcData;
// prepaire the return buffer
rnSize = rmc_c_r_sResult.length() +1; // the received string
rpcData = new char[rnSize];
// special case, only one result is to return ->
// we do not need any write position handling and so
// no indexing into the transport buffer too.
strncpy(rpcData, rmc_c_r_sResult.c_str(), rmc_c_r_sResult.length()+1);
return RMC_SUCCESS;
} // TTransResult RmcGetHistroy1(..)
// calls:
// void SetParameter(const string &sNick, long nOptions);
TTransResult RmcSetParameter0(TRmcSize& rnSize, TRmcData*& rpcData)
{
TRACE("Chat::RmcSetParameter0 : \n")
// get the incoming data
long nInPos = 0;
std::string rmc_c_v_sNick = &(rpcData[nInPos]);
nInPos += rmc_c_v_sNick.length() +1;
long rmc_c_v_nOptions = *(long*)&(rpcData[nInPos]);
// call the real methode
SetParameter(rmc_c_v_sNick, rmc_c_v_nOptions);
// there was somethings in the buffer, we have to delete it.
#ifndef WIN32
delete rpcData;
#endif
// special case:
// no return value
return RMC_SUCCESS;
} // TTransResult RmcSetParameter0(..)
// calls:
// void Send(/*[in,object]*/ CAgent &roAgent)
TTransResult RmcSend1(TRmcSize& rnSize, TRmcData*& rpcData)
{
TRACE("Chat::RmcSend1 : \n")
// the class (parameter)
CAgent oAgent;
// load the class with the transmitted data
oAgent._RMC_get(rpcData);
// call the real methode
Send(oAgent);
// there was somethings in the buffer, we have to delete it.
#ifndef WIN32
delete rpcData;
#endif
return RMC_SUCCESS;
} // TTransResult RmcSend1(..)
// calls:
// void StartAgents()
TTransResult RmcStartAgents0(TRmcSize& rnSize, TRmcData*& rpcData)
{
TRACE("Chat::RmcStartAgents0 : \n")
StartAgents();
return RMC_SUCCESS;
} // TTransResult RmcStartAgents0(..)
}; // class CChat
#endif // __CHAT_SERVER_CLASS_H
--- NEW FILE ---
bin_PROGRAMS = chatserver
CFLAGS=-D_REENTRANT
CXXFLAGS = -Wall -g -O2
INCLUDES=-I../../../../include
chatserver_SOURCES = Chat_s.cxx main.cxx RmcObjectFactory.cxx
#chatserver_LDADD = ../../../../src/Server/libRmcServer.a
../../../../src/family/libFamily.la -ldl -lpthread
chatserver_LDADD = ../../../../src/Server/libRmcServer.a -ldl -lpthread
--- NEW FILE ---
/***************************************************************************
RmcObjectFactory.cxx
-------------------
begin : Mon Jun 18 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. *
* *
***************************************************************************
*
* Application specific object factory methode implementation
*
*/
#include "generic.h"
#include "RmcServer.h"
#include "RmcObject.h"
// user stub class declarations
#include "Chat_s.h"
using namespace rmc;
// TRmcResult CRmcObjectFactory::ObjectMake(<rtti> nClass, <object> &rnObject)
//
//* Hmm, nClass stays the RTTI (a number read from the socket) but here (and
only here)
//* we convert it to a Remote object (instead of long). This object will still
hold
//* the nClass RTTI number (abstract in Remote) and the Visum. In the Call
method, the
//* abstract method RmcWrapperCall will call the correct method of this object
//
//* Only the server class should be a subclass of Remote. There is till a
number for
//* the method, the object and the visum that is transported to and from. But
all this
//* information is held in the Remote Object. This object has then to verify
the object,
//* method and visum and fail when one does not match.
//
// Consequences : every function call with "Visum" or "Class" as argument can
be replaced by
// the RemoteObject argument (in the factory).
//
//* TRmcObject (long) is replaced by CRmcObject (our own class)
//
//- And back, because only the class factory is allowed to know about the
object
//- and only the clas factory is allowed to handle real object pointers.
//- The key is: ENCAPSULATION, as the fundamental paradim in OOP, and RMC
needs to
//- make correct use of OOP paradigms, because it has to provide OOP features
for
//- the outside.
//
//- For example:
//-
//- If the object handles the Visum, only the object is alloed to know what to
do
//- with it.
//-
//- On the other hand: If the class factory needs a handle to manage the
objects,
//- only the class factory knows about it. There is no reason nor is it
allowed to
//- tell the object about the handle used for it from the class factory.
//- Otherwise, this would be as if a person handles the papers the goverment
needs
//- to bill the taxes.
//
TRmcResult CRmcObjectFactory::ObjectMake(TRmcClass nClass,
TRmcObject &rnObject,
TRmcVisum &rnVisum)
{
// generate the object for the clients request
switch (nClass)
{
// CChat
case RTTI_CCHAT:
{
// make a new object, add it to the factory management
// and return the key (ID) to "rnObject" for the client
CChat *pObject = new CChat;
rnVisum = pObject->m_rmc_s_nVisum;
rnObject = ObjectAdd(nClass, pObject);
// make a new visum
//* Object->VisumSet( VisumMake() ); <- Visum is to handle from the inside
of the Object
//* Object->RttiSet( RTTI_CCHAT ); <- RTTI is a implementation dependend
value
//* Object->IdSet( IdMake() ); <- ID is for the class factory, not
for the Object
// insert the new object into the administration map
// should store pair< <handle to object>, <pointer to object> >
// m_mhoStubCheck[ Object->IdGet() ] = Object;
return RMC_SUCCESS;
} // case RTTI_CCHAT:
default:
{
return RMC_E_NO_STUB;
} // default
} // switch (nClass)
return RMC_FAILURE;
} // TRmcResult CRmcObjectFactory::ObjectMake(TRmcClass nClass,..
// methode routing
TRmcResult CRmcObjectFactory::Call(TRmcClass nClass,
void *pObject,
TRmcMethode nMethode,
TRmcSize &rnSize,
TRmcData *&rpcData,
TRmcVisum &rnVisum )
{
TRACE("[RmcObjectFactory::Call]\n")
//-> has to register in the local visum map: rnVisum = MakeVisum();
#ifdef _DEBUG
//? cout << "\tIncoming visum: " << rnVisum << endl;
#endif // _DEBUG
switch (nClass)
{
// CChat
case RTTI_CCHAT:
{
return ((CChat*)pObject)->RmcWrapperCall(nMethode, rnSize, rpcData,
rnVisum);
} // case RTTI_CCHAT:
default:
{
return RMC_E_NO_STUB;
} // default
} // switch (nClass)
return RMC_FAILURE;
} // TRmcResult CRmcObjectFactory::Call(TRmcCla..
--- NEW FILE ---
/***************************************************************************
main.cxx
-------------------
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. *
* *
***************************************************************************/
#include "generic.h"
#include "Chat_s.h"
#include <family/SignalHandler.h>
#include <family/Daemonizer.h>
using namespace family;
CSignalManager *CSignalManager::s_poManager = new CSignalManager;
int main()
{
// family::InitializeSignalHandling ();
CRmcServer oRmcServer;
//! in real, we have to let the object configure itself from his
//! configuration file by calling "oRmcServer.ChangeConfiguration(..)"
//! but currently, there is no configuration file
#ifdef _DEBUG
# ifdef WIN32
oRmcServer.TransportAdd("./../../../Transport/Socket/Server/Debug/RmcTLServerSocket.dll");
# else // WIN32
oRmcServer.TransportAdd("./../../../Transport/Socket/.libs/libRMCTransportServerSocket.so");
# endif // else WIN32
#else
# ifdef WIN32
oRmcServer.TransportAdd("RmcTLServerSocket.dll");
# else // WIN32
oRmcServer.TransportAdd("libRMCTransportServerSocket.so");
# endif // else WIN32
#endif
TRACE( "waiting for call\n" );
for (;;)
{
SLEEP(100);
if ( CSignalManager::s_poManager->Exit() == true )
{
break;
}
} // for (;;)
return 0;
} // main()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Moss-devel] CVS: moss/rmc/src/Demos/Chat/Server Chat_s.cxx,NONE,1.1 Chat_s.h,NONE,1.1 Makefile.am,NONE,1.1 RmcObjectFactory.cxx,NONE,1.1 main.cxx,NONE,1.1,
Alexander Feder <address@hidden> <=
- Prev by Date:
[Moss-devel] CVS: moss/rmc/src/Demos/Chat/Client Chat_c.cxx,NONE,1.1 Chat_c.h,NONE,1.1 Makefile.am,NONE,1.1 main.cxx,NONE,1.1
- Next by Date:
[Moss-devel] CVS: moss/rmc/src/Transport Makefile.am,NONE,1.1 TransportClient.cxx,NONE,1.1 TransportClientHandler.cxx,NONE,1.1 TransportServer.cxx,NONE,1.1
- Previous by thread:
[Moss-devel] CVS: moss/rmc/src/Demos/Chat/Client Chat_c.cxx,NONE,1.1 Chat_c.h,NONE,1.1 Makefile.am,NONE,1.1 main.cxx,NONE,1.1
- Next by thread:
[Moss-devel] CVS: moss/rmc/src/Transport Makefile.am,NONE,1.1 TransportClient.cxx,NONE,1.1 TransportClientHandler.cxx,NONE,1.1 TransportServer.cxx,NONE,1.1
- Index(es):