GlobalObjects
Lade ...
Suche ...
Keine Treffer
TcpMessage.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_TCPMESSAGE_H
2#define INC_TCPMESSAGE_H
3//-----------------------------------------------------------------------------
44//-----------------------------------------------------------------------------
45#include "TcpTypes.h"
46#include <cstring>
47#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
48 #include <winsock.h>
49#elif defined(__GNUC__)
50 /*
51 #include <stdio.h>
52 #include <stdlib.h>
53 #include <unistd.h>
54 */
55 #include <string.h>
56
57 #include <errno.h>
58 #include <sys/types.h>
59 #include <sys/socket.h>
60 #include <netinet/in.h>
61 #include <netdb.h>
62 #include <arpa/inet.h>
63 #define SOCKET uintptr_t
64 #define SOCKADDR_IN sockaddr_in
65 #define SOCKADDR sockaddr
66 #define HOSTENT hostent
67 #define INVALID_SOCKET (SOCKET)(~0)
68 #define SOCKET_ERROR (-1)
69#endif
70//-----------------------------------------------------------------------------
71#ifdef _MSC_VER
72 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
73 #pragma warning( disable : 4251 )
74#endif
75//-----------------------------------------------------------------------------
76namespace tcp
77{
78 //---------------------------------------------------------------------------
79 // >>>>>>>>>>>>>>>>>>>>>>>>> AbstractMessage >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
80 //---------------------------------------------------------------------------
97 {
98 protected:
99 //============== Konstruktor
100 //-----------------------------------------------------------------------
111 //-----------------------------------------------------------------------
112
113 public:
114 //============== Destruktore
115 //-----------------------------------------------------------------------
126 //-----------------------------------------------------------------------
127 };
128 //---------------------------------------------------------------------------
129 // <<<<<<<<<<<<<<<<<<<<<<<<< AbstractMessage <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
130 //---------------------------------------------------------------------------
131
132 //---------------------------------------------------------------------------
133 // >>>>>>>>>>>>>>>>>>>>>>>>>>> Message >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
134 //---------------------------------------------------------------------------
168 {
169 private:
170 //============== Attribute
171 //-----------------------------------------------------------------------
181 unsigned int m_uiMessageID;
182 //-----------------------------------------------------------------------
203 //-----------------------------------------------------------------------
213 std::string m_strInfo;
214 //-----------------------------------------------------------------------
224 std::size_t m_nRawMessageSize;
225 //-----------------------------------------------------------------------
236 //-----------------------------------------------------------------------
247 //-----------------------------------------------------------------------
258 //-----------------------------------------------------------------------
259
260 protected:
261 //============== Konstruktoren
262 //-----------------------------------------------------------------------
273 //-----------------------------------------------------------------------
274
275 public:
276 //============== Konstruktoren
277 //-----------------------------------------------------------------------
322 Message( char * pszTransmitData, std::size_t nTransmitDataSize );
323 //-----------------------------------------------------------------------
353 Message( char * pszRawMsg,
354 std::size_t nRawMsgSize,
355 unsigned int uiMessageID,
356 int iActionCode,
357 const std::string & rstrInfo );
358 //-----------------------------------------------------------------------
368 virtual ~Message();
369 //-----------------------------------------------------------------------
370
371 private:
372 //============== Copy-Konstruktor
373 //-----------------------------------------------------------------------
383 Message( const Message & );
384 //-----------------------------------------------------------------------
385
386 //+ ============ Methoden
387 //-----------------------------------------------------------------------
403 //-----------------------------------------------------------------------
419 //-----------------------------------------------------------------------
420
421 public:
422 //============== Methoden
423 //-----------------------------------------------------------------------
433 char * getRawMsgPt();
434 //-----------------------------------------------------------------------
444 std::size_t getRawMsgSize() const;
445 //-----------------------------------------------------------------------
456 //-----------------------------------------------------------------------
466 std::size_t getTransmitDataSize() const;
467 //-----------------------------------------------------------------------
477 unsigned int getMsgID() const;
478 //-----------------------------------------------------------------------
490 int getActionCode() const;
491 //-----------------------------------------------------------------------
501 std::string getInfo() const;
502 //-----------------------------------------------------------------------
524 std::size_t getRawMsg( char *& prszRawMsg, bool bCopy = true );
525 //-----------------------------------------------------------------------
546 std::size_t getTransmitData( char *& prszSendMsg, bool bCopy = true );
547 //-----------------------------------------------------------------------
548
549 private:
550 //============== Operatoren
551 //-----------------------------------------------------------------------
561 Message & operator= ( const Message & );
562 //-----------------------------------------------------------------------
563 };
564 //---------------------------------------------------------------------------
565 // <<<<<<<<<<<<<<<<<<<<<<<<<<< Message <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
566 //---------------------------------------------------------------------------
567
568 //---------------------------------------------------------------------------
569 // >>>>>>>>>>>>>>>>>>>>>>>>> ServerAcceptMessage >>>>>>>>>>>>>>>>>>>>>>>>>>>>
570 //---------------------------------------------------------------------------
587 {
588 private:
589 //============== Attribute
590 //-----------------------------------------------------------------------
601 //-----------------------------------------------------------------------
602
603 protected:
604 //============== Konstruktoren
605 //-----------------------------------------------------------------------
616 //-----------------------------------------------------------------------
617
618 public:
619 //============== Konstruktoren
620 //-----------------------------------------------------------------------
632 ServerAcceptMessage( SOCKET NewSocket );
633 //-----------------------------------------------------------------------
644 //-----------------------------------------------------------------------
645
646 private:
647 //============== Copy-Konstruktor
648 //-----------------------------------------------------------------------
659 //-----------------------------------------------------------------------
660
661 public:
662 //============== Methoden
663 //-----------------------------------------------------------------------
673 SOCKET getSocket();
674 //-----------------------------------------------------------------------
685 //-----------------------------------------------------------------------
686
687 private:
688 //============== Operatoren
689 //-----------------------------------------------------------------------
700 //-----------------------------------------------------------------------
701 };
702 //---------------------------------------------------------------------------
703 // <<<<<<<<<<<<<<<<<<<<<<<<< ServerAcceptMessage <<<<<<<<<<<<<<<<<<<<<<<<<<<<
704 //---------------------------------------------------------------------------
705
706 //---------------------------------------------------------------------------
707 // >>>>>>>>>>>>>>>>>>>>>>>>>>> ServerMessage >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
708 //---------------------------------------------------------------------------
725 {
726 protected:
727 //============== Konstruktoren
728 //-----------------------------------------------------------------------
739 //-----------------------------------------------------------------------
749 ServerMessage( char *, std::size_t );
750 //-----------------------------------------------------------------------
751
752 public:
753 //============== Konstruktoren
754 //-----------------------------------------------------------------------
799 ServerMessage( SOCKET ClientSocket,
800 char * pszTransmitData,
801 std::size_t nTransmitDataSize );
802 //-----------------------------------------------------------------------
831 ServerMessage( SOCKET ClientSocket,
832 char * pszRawMsg,
833 std::size_t nRawMsgSize,
834 unsigned int uiMessageID,
835 int iActionCode,
836 const std::string & rstrInfo);
837 //-----------------------------------------------------------------------
847 virtual ~ServerMessage();
848 //-----------------------------------------------------------------------
849 private:
850 //============== Copy-Konstruktor
851 //-----------------------------------------------------------------------
862
863 //============== Operatoren
864 //-----------------------------------------------------------------------
874 ServerMessage & operator= ( const ServerMessage & );
875 //-----------------------------------------------------------------------
876 };
877 //---------------------------------------------------------------------------
878 // <<<<<<<<<<<<<<<<<<<<<<<<<< ServerMessage <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
879 //---------------------------------------------------------------------------
880 #ifdef _MSC_VER
881 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
882 #pragma warning( default : 4251 )
883 #endif
884 //---------------------------------------------------------------------------
885} // namespace tcp
886//-----------------------------------------------------------------------------
887#endif
Für jede Bibliothek, hier 'TcpLib' gibt es eine Typen-Datei.
#define __tcp_export_dll
Definition TcpTypes.h:59
Basisklasse für Nachrichten, welche von den Tcp-Klassen verschickt, empfangen und bearbeitet werden k...
Definition TcpMessage.h:97
virtual ~AbstractMessage()
Beinhaltet einen Datenstrom, welcher von den Tcp-Klassen versendet und empfangen werden kann.
Definition TcpMessage.h:168
std::size_t getRawMsg(char *&prszRawMsg, bool bCopy=true)
int m_iActionCode
Definition TcpMessage.h:202
int getActionCode() const
std::size_t getRawMsgSize() const
Message(char *pszTransmitData, std::size_t nTransmitDataSize)
virtual ~Message()
int initSendMsgFromData()
std::size_t m_nTransmitDataSize
Definition TcpMessage.h:246
unsigned int m_uiMessageID
Definition TcpMessage.h:181
char * getRawMsgPt()
Message(const Message &)
char * m_pszRawMessage
Definition TcpMessage.h:235
Message(char *pszRawMsg, std::size_t nRawMsgSize, unsigned int uiMessageID, int iActionCode, const std::string &rstrInfo)
unsigned int getMsgID() const
char * getTransmitDataPt()
int initDataFromSendMsg()
std::string getInfo() const
std::size_t getTransmitData(char *&prszSendMsg, bool bCopy=true)
char * m_pszTransmitData
Definition TcpMessage.h:257
std::string m_strInfo
Definition TcpMessage.h:213
std::size_t m_nRawMessageSize
Definition TcpMessage.h:224
std::size_t getTransmitDataSize() const
Ein spezielle Tcp-Message, damit kann der ServerAcceptReceiver einen neuen Client anmelden.
Definition TcpMessage.h:587
ServerAcceptMessage(const ServerAcceptMessage &)
ServerAcceptMessage(SOCKET NewSocket)
SOCKET m_ClientSocket
Definition TcpMessage.h:600
Ist eine spezielle Tcp-Message für den Server. Damit dieser weiß, an wen er die Daten senden soll,...
Definition TcpMessage.h:725
virtual ~ServerMessage()
ServerMessage(const ServerMessage &)
ServerMessage(SOCKET ClientSocket, char *pszRawMsg, std::size_t nRawMsgSize, unsigned int uiMessageID, int iActionCode, const std::string &rstrInfo)
ServerMessage(char *, std::size_t)
ServerMessage(SOCKET ClientSocket, char *pszTransmitData, std::size_t nTransmitDataSize)
Definition TcpClient.h:55