123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- #ifndef Server_H
- #define Server_H
- #include "Network.h"
- #ifndef HEADER_OPENSSL_TYPES_H
- struct SSL_CTX;
- struct SSL;
- #endif
- namespace Framework
- {
- namespace Encryption
- {
- class Key;
- }
- class Text;
- }
- using namespace Framework;
- namespace Network
- {
- class Server;
- class SKlient;
- class Server
- {
- private:
- SOCKET sock;
- SOCKADDR_IN addresse;
- int klients;
- int ref;
- public:
-
- __declspec( dllexport ) Server();
-
- __declspec( dllexport ) ~Server();
-
- __declspec( dllexport ) bool verbinde( unsigned short port, int warteschlangenLen );
- __declspec( dllexport ) SKlient *getKlient();
- __declspec( dllexport ) int getKlients( bool reset );
- __declspec( dllexport ) bool trenne();
-
- __declspec( dllexport ) unsigned short getPort() const;
- __declspec( dllexport ) bool isConnected() const;
-
- __declspec( dllexport ) Server *getThis();
- __declspec( dllexport ) Server *release();
- };
- class SKlient
- {
- private:
- SOCKET sock;
- sockaddr_in clientAddr;
- Encryption::Key *sendeKey;
- Encryption::Key *empfangKey;
- int downStreamBytes;
- int upStreamBytes;
- int ref;
- public:
-
- __declspec( dllexport ) SKlient( sockaddr_in client, SOCKET sock );
-
- __declspec( dllexport ) ~SKlient();
-
- __declspec( dllexport ) void setSendeKeyZ( Encryption::Key *key );
- __declspec( dllexport ) void setEmpfangKeyZ( Encryption::Key *key );
- __declspec( dllexport ) void setSendeKey( char *key, int len );
- __declspec( dllexport ) void setEmpfangKey( char *key, int len );
- __declspec( dllexport ) bool sende( const char *nachricht, int len );
- __declspec( dllexport ) bool getNachricht( char *nachricht, int len );
- __declspec( dllexport ) bool sendeEncrypted( const char *nachricht, int len );
- __declspec( dllexport ) bool getNachrichtEncrypted( char *nachricht, int len );
- __declspec( dllexport ) int getDownloadBytes( bool reset );
- __declspec( dllexport ) int getUploadBytes( bool reset );
- __declspec( dllexport ) bool trenne();
-
- __declspec( dllexport ) unsigned short getPort() const;
- __declspec( dllexport ) const char *getIp() const;
-
- __declspec( dllexport ) SKlient *getThis();
- __declspec( dllexport ) SKlient *release();
- };
- class SSLSKlient;
- class SSLServer
- {
- private:
- SOCKET s;
- SOCKADDR_IN addr;
- SSL_CTX *ctx;
- Text *passw;
- int klients;
- int ref;
- public:
-
- __declspec( dllexport ) SSLServer();
-
- __declspec( dllexport ) ~SSLServer();
-
-
- __declspec( dllexport ) bool setCertificateFile( const char *file );
-
- __declspec( dllexport ) bool setPrivateKeyFile( const char *file );
-
- __declspec( dllexport ) void setPrivateKeyPassword( const char *password );
-
- __declspec( dllexport ) bool verbinde( unsigned short port, int warteschlangenLen );
-
- __declspec( dllexport ) SSLSKlient *getKlient();
-
- __declspec( dllexport ) int getKlients( bool reset );
-
- __declspec( dllexport ) bool trenne();
-
-
- __declspec( dllexport ) unsigned short getPort() const;
-
- __declspec( dllexport ) bool isConnected() const;
-
- __declspec( dllexport ) SSLServer *getThis();
- __declspec( dllexport ) SSLServer *release();
- };
- class SSLSKlient
- {
- private:
- SOCKET s;
- SSL* ssl;
- sockaddr_in clientAddr;
- int downStreamBytes;
- int upStreamBytes;
- int ref;
- public:
-
- __declspec( dllexport ) SSLSKlient( sockaddr_in client, SSL *ssl, SOCKET s );
-
- __declspec( dllexport ) ~SSLSKlient();
-
- __declspec( dllexport ) bool sende( const char *nachricht, int len );
- __declspec( dllexport ) bool getNachricht( char *nachricht, int len );
- __declspec( dllexport ) int getDownloadBytes( bool reset );
- __declspec( dllexport ) int getUploadBytes( bool reset );
- __declspec( dllexport ) bool trenne();
-
- __declspec( dllexport ) unsigned short getPort() const;
- __declspec( dllexport ) const char *getIp() const;
-
- __declspec( dllexport ) SSLSKlient *getThis();
- __declspec( dllexport ) SSLSKlient *release();
- };
- }
- #endif
|