00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef TCP_Socket_h
00038 #define TCP_Socket_h
00039
00040 #include <bool.h>
00041 #include <Socket.h>
00042 #include <Channel.h>
00043 #include <SocketAddress.h>
00044
00045 class TCP_Socket : public Channel
00046 {
00047 public:
00048 TCP_Socket();
00049 TCP_Socket(unsigned int);
00050 TCP_Socket(unsigned int other_Port, char *other_InetAddr);
00051 ~TCP_Socket();
00052
00053 char *addToProgram(void);
00054
00055 virtual int setUpConnection(void);
00056
00057 int setNextAddress(const ChannelAddress &otherChannelAddress);
00058 virtual ChannelAddress *getLastSendersAddress(void){ return 0;};
00059
00060 int sendObj(int commitTag,
00061 MovableObject &theObject,
00062 ChannelAddress *theAddress =0);
00063 int recvObj(int commitTag,
00064 MovableObject &theObject,
00065 FEM_ObjectBroker &theBroker,
00066 ChannelAddress *theAddress =0);
00067
00068 int sendMsg(int dbTag, int commitTag,
00069 const Message &,
00070 ChannelAddress *theAddress =0);
00071 int recvMsg(int dbTag, int commitTag,
00072 Message &,
00073 ChannelAddress *theAddress =0);
00074
00075 int sendMatrix(int dbTag, int commitTag,
00076 const Matrix &theMatrix,
00077 ChannelAddress *theAddress =0);
00078 int recvMatrix(int dbTag, int commitTag,
00079 Matrix &theMatrix,
00080 ChannelAddress *theAddress =0);
00081
00082 int sendVector(int dbTag, int commitTag,
00083 const Vector &theVector, ChannelAddress *theAddress =0);
00084 int recvVector(int dbTag, int commitTag,
00085 Vector &theVector,
00086 ChannelAddress *theAddress =0);
00087
00088 int sendID(int dbTag, int commitTag,
00089 const ID &theID,
00090 ChannelAddress *theAddress =0);
00091 int recvID(int dbTag, int commitTag,
00092 ID &theID,
00093 ChannelAddress *theAddress =0);
00094
00095 protected:
00096 unsigned int getPortNumber(void) const;
00097
00098 private:
00099 socket_type sockfd;
00100
00101 union {
00102 struct sockaddr addr;
00103 struct sockaddr_in addr_in;
00104 } my_Addr;
00105 union {
00106 struct sockaddr addr;
00107 struct sockaddr_in addr_in;
00108 } other_Addr;
00109
00110 socklen_type addrLength;
00111
00112 unsigned int myPort;
00113 int connectType;
00114
00115 char add[40];
00116 };
00117
00118
00119 #endif
00120
00121
00122
00123
00124
00125
00126
00127