|
@@ -16,7 +16,7 @@ KartenServer::KartenServer( InitDatei *zIni )
|
|
|
empfangen = 0;
|
|
|
gesendet = 0;
|
|
|
fehler = new Text();
|
|
|
- ini = zIni->getThis();
|
|
|
+ ini = dynamic_cast<InitDatei *>( zIni->getThis() );
|
|
|
id = *zIni->zWert( "ServerId" );
|
|
|
server = new Server();
|
|
|
aServer = new SSLServer();
|
|
@@ -39,7 +39,7 @@ KartenServer::KartenServer( InitDatei *zIni )
|
|
|
serverStarten();
|
|
|
serverFortsetzen();
|
|
|
}
|
|
|
- updater = new Updater( (KartenServer *)getThis() );
|
|
|
+ updater = new Updater( dynamic_cast<KartenServer *>( getThis() ) );
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
@@ -68,13 +68,13 @@ void KartenServer::runn()
|
|
|
if( end && klient )
|
|
|
{
|
|
|
klient->trenne();
|
|
|
- klient = klient->release();
|
|
|
+ klient = (SSLSKlient *)klient->release();
|
|
|
Sleep( 1000 );
|
|
|
return;
|
|
|
}
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
- KSAKlient * clHandle = new KSAKlient( klient, (KartenServer *)getThis() );
|
|
|
+ KSAKlient *clHandle = new KSAKlient( klient, dynamic_cast<KartenServer *>( getThis() ) );
|
|
|
clHandle->start();
|
|
|
}
|
|
|
}
|
|
@@ -88,7 +88,7 @@ void KartenServer::thread()
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
|
- KSKlient * clHandle = new KSKlient( klient, (KartenServer *)getThis() );
|
|
|
+ KSKlient *clHandle = new KSKlient( klient, dynamic_cast<KartenServer *>( getThis() ) );
|
|
|
EnterCriticalSection( &cs );
|
|
|
klients->set( clHandle, klientAnzahl );
|
|
|
klientAnzahl++;
|
|
@@ -107,13 +107,13 @@ void KartenServer::close()
|
|
|
EnterCriticalSection( &cs );
|
|
|
for( int i = 0; i < klientAnzahl; i++ )
|
|
|
klients->z( i )->absturz();
|
|
|
- klients = klients->release();
|
|
|
+ klients = ( RCArray < KSKlient > * )klients->release();
|
|
|
klientAnzahl = 0;
|
|
|
LeaveCriticalSection( &cs );
|
|
|
ende();
|
|
|
run = 0;
|
|
|
end = 1;
|
|
|
- Klient * klient = new Klient();
|
|
|
+ Klient *klient = new Klient();
|
|
|
klient->verbinde( aServer->getPort(), "127.0.0.1" );
|
|
|
Sleep( 500 );
|
|
|
aServer->trenne();
|
|
@@ -226,7 +226,7 @@ bool KartenServer::absturzKlient( int klientId )
|
|
|
return gefunden;
|
|
|
}
|
|
|
|
|
|
-bool KartenServer::removeKlient( KSKlient * zKlient )
|
|
|
+bool KartenServer::removeKlient( KSKlient *zKlient )
|
|
|
{
|
|
|
bool gefunden = 0;
|
|
|
EnterCriticalSection( &cs );
|
|
@@ -308,7 +308,7 @@ bool KartenServer::wirdKarteGeupdatet( int id ) const
|
|
|
|
|
|
// Inhalt der KSAKlient Klasse aus KartenServer.h
|
|
|
// Konstruktor
|
|
|
-KSAKlient::KSAKlient( SSLSKlient * klient, KartenServer * ks )
|
|
|
+KSAKlient::KSAKlient( SSLSKlient *klient, KartenServer *ks )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
@@ -346,13 +346,13 @@ void KSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned char nLen = 0;
|
|
|
- klient->getNachricht( (char *)& nLen, 1 );
|
|
|
+ klient->getNachricht( (char *)&nLen, 1 );
|
|
|
char *n = new char[ nLen + 1 ];
|
|
|
n[ (int)nLen ] = 0;
|
|
|
if( nLen )
|
|
|
klient->getNachricht( n, nLen );
|
|
|
unsigned char pLen = 0;
|
|
|
- klient->getNachricht( (char *)& pLen, 1 );
|
|
|
+ klient->getNachricht( (char *)&pLen, 1 );
|
|
|
char *p = new char[ pLen + 1 ];
|
|
|
p[ (int)pLen ] = 0;
|
|
|
if( pLen )
|
|
@@ -448,7 +448,7 @@ void KSAKlient::thread()
|
|
|
}
|
|
|
else
|
|
|
ok = 1;
|
|
|
- if( ok &&ks->hatClients() )
|
|
|
+ if( ok && ks->hatClients() )
|
|
|
{
|
|
|
errorZuKlient( "Es sind noch Klients Online. Bitte versuche es später erneut." );
|
|
|
break;
|
|
@@ -544,7 +544,7 @@ void KSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int maxK = 0;
|
|
|
- klient->getNachricht( (char *)& maxK, 4 );
|
|
|
+ klient->getNachricht( (char *)&maxK, 4 );
|
|
|
if( ks->zDB()->adminHatRecht( adminId, Admin_Recht::KSMKChange ) )
|
|
|
{
|
|
|
if( ks->setMaxKarten( maxK ) )
|
|
@@ -566,8 +566,8 @@ void KSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int klientId = 0;
|
|
|
- klient->getNachricht( (char *)& klientId, 4 );
|
|
|
- if( klientId &&ks->absturzKlient( klientId ) )
|
|
|
+ klient->getNachricht( (char *)&klientId, 4 );
|
|
|
+ if( klientId && ks->absturzKlient( klientId ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
klient->sende( "\0", 1 );
|
|
@@ -599,7 +599,7 @@ void KSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehl
|
|
|
|
|
|
// Inhalt der KSKlient aus KartenServer.h
|
|
|
// Konstruktor
|
|
|
-KSKlient::KSKlient( SKlient * klient, KartenServer * ks )
|
|
|
+KSKlient::KSKlient( SKlient *klient, KartenServer *ks )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
@@ -618,7 +618,7 @@ KSKlient::~KSKlient()
|
|
|
}
|
|
|
|
|
|
// privat
|
|
|
-void KSKlient::suchDateien( const char *pf, RCArray< Text > * zDL, const char *rem )
|
|
|
+void KSKlient::suchDateien( const char *pf, RCArray< Text > *zDL, const char *rem )
|
|
|
{
|
|
|
Datei d;
|
|
|
d.setDatei( pf );
|
|
@@ -667,7 +667,7 @@ void KSKlient::thread()
|
|
|
switch( c )
|
|
|
{
|
|
|
case 1: // Klient identifikation
|
|
|
- klient->getNachrichtEncrypted( (char *)& klientNummer, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&klientNummer, 4 );
|
|
|
if( !ks->zDB()->proveKlient( klientNummer, ks->getId() ) )
|
|
|
{
|
|
|
klientNummer = 0;
|
|
@@ -698,8 +698,8 @@ void KSKlient::thread()
|
|
|
if( 1 )
|
|
|
{
|
|
|
int klientId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& klientId, 4 );
|
|
|
- if( klientId &&ks->absturzKlient( klientId ) )
|
|
|
+ klient->getNachrichtEncrypted( (char *)&klientId, 4 );
|
|
|
+ if( klientId && ks->absturzKlient( klientId ) )
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
else
|
|
|
klient->sendeEncrypted( "\0", 1 );
|
|
@@ -742,7 +742,7 @@ void KSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int id = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
if( !ks->zDB()->proveKarte( id, ks->getId() ) )
|
|
|
{
|
|
|
errorZuKlient( "Die Karte wurde nicht gefunden." );
|
|
@@ -762,7 +762,7 @@ void KSKlient::thread()
|
|
|
RCArray< Text > *dList = new RCArray< Text >();
|
|
|
suchDateien( pfad, dList, pfad );
|
|
|
int anz = dList->getEintragAnzahl();
|
|
|
- klient->sendeEncrypted( (char *)& anz, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
Text pf = dList->z( i )->getText();
|
|
@@ -776,10 +776,10 @@ void KSKlient::thread()
|
|
|
klient->sendeEncrypted( "\0", 1 );
|
|
|
continue;
|
|
|
}
|
|
|
- klient->sendeEncrypted( (char *)& len, 1 );
|
|
|
+ klient->sendeEncrypted( (char *)&len, 1 );
|
|
|
klient->sendeEncrypted( pf, len );
|
|
|
__int64 size = d.getSize();
|
|
|
- klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)&size, 8 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size )
|
|
|
{
|
|
@@ -804,7 +804,7 @@ void KSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int id = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
if( !ks->zDB()->proveKarte( id, ks->getId() ) )
|
|
|
{
|
|
|
errorZuKlient( "Die Karte wurde nicht gefunden." );
|
|
@@ -824,7 +824,7 @@ void KSKlient::thread()
|
|
|
RCArray< Text > *dList = new RCArray< Text >();
|
|
|
suchDateien( pfad, dList, pfad );
|
|
|
int anz = dList->getEintragAnzahl();
|
|
|
- klient->sendeEncrypted( (char *)& anz, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
Text pf = dList->z( i )->getText();
|
|
@@ -835,10 +835,10 @@ void KSKlient::thread()
|
|
|
d.setDatei( dp );
|
|
|
if( !len || !d.open( Datei::Style::lesen ) )
|
|
|
continue;
|
|
|
- klient->sendeEncrypted( (char *)& len, 1 );
|
|
|
+ klient->sendeEncrypted( (char *)&len, 1 );
|
|
|
klient->sendeEncrypted( pf, len );
|
|
|
__int64 size = d.getSize();
|
|
|
- klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)&size, 8 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size )
|
|
|
{
|
|
@@ -863,7 +863,7 @@ void KSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int id = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
if( !ks->zDB()->proveKarte( id, ks->getId() ) )
|
|
|
{
|
|
|
errorZuKlient( "Die Karte wurde nicht gefunden." );
|
|
@@ -886,7 +886,7 @@ void KSKlient::thread()
|
|
|
else
|
|
|
errorZuKlient( "Fehler beim lesen der Datei." );
|
|
|
__int64 size = d.getSize();
|
|
|
- klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)&size, 8 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size )
|
|
|
{
|
|
@@ -909,7 +909,7 @@ void KSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int id = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
if( !ks->zDB()->proveKarte( id, ks->getId() ) )
|
|
|
{
|
|
|
errorZuKlient( "Die Karte wurde nicht gefunden." );
|
|
@@ -932,7 +932,7 @@ void KSKlient::thread()
|
|
|
else
|
|
|
errorZuKlient( "Fehler beim lesen der Datei." );
|
|
|
__int64 size = d.getSize();
|
|
|
- klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)&size, 8 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size )
|
|
|
{
|
|
@@ -955,7 +955,7 @@ void KSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int id = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
if( !ks->zDB()->proveKarte( id, ks->getId() ) )
|
|
|
{
|
|
|
errorZuKlient( "Die Karte wurde nicht gefunden." );
|
|
@@ -978,7 +978,7 @@ void KSKlient::thread()
|
|
|
else
|
|
|
errorZuKlient( "Fehler beim lesen der Datei." );
|
|
|
__int64 size = d.getSize();
|
|
|
- klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)&size, 8 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size )
|
|
|
{
|
|
@@ -1001,7 +1001,7 @@ void KSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int id = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
if( !ks->zDB()->proveKarte( id, ks->getId() ) )
|
|
|
{
|
|
|
errorZuKlient( "Die Karte wurde nicht gefunden." );
|
|
@@ -1024,7 +1024,7 @@ void KSKlient::thread()
|
|
|
else
|
|
|
errorZuKlient( "Fehler beim lesen der Datei." );
|
|
|
__int64 size = d.getSize();
|
|
|
- klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)&size, 8 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size )
|
|
|
{
|