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
00038
00039 #ifndef UDP_Socket_h
00040 #define UDP_Socket_h
00041
00042 #include <Socket.h>
00043 #include <Channel.h>
00044 #include <SocketAddress.h>
00045
00047 class UDP_Socket : public Channel
00048 {
00049 public:
00051 UDP_Socket();
00053 UDP_Socket(unsigned int port);
00055 UDP_Socket(unsigned int other_Port, char *other_InetAddr);
00057 ~UDP_Socket();
00058
00060 char *addToProgram(void);
00061
00063 virtual int setUpShadow(void);
00065 virtual int setUpActor(void);
00066
00068 int setNextAddress(const ChannelAddress &otherChannelAddress);
00069
00071 int sendObj(int commitTag,
00072 MovableObject &theObject,
00073 ChannelAddress *theAddress =0);
00075 int recvObj(int commitTag,
00076 MovableObject &theObject,
00077 FEM_ObjectBroker &theBroker,
00078 ChannelAddress *theAddress =0);
00079
00081 int sendMsg(int dbTag, int commitTag,
00082 const Message &,
00083 ChannelAddress *theAddress =0);
00085 int recvMsg(int dbTag, int commitTag,
00086 Message &,
00087 ChannelAddress *theAddress =0);
00088
00090 int sendMatrix(int dbTag, int commitTag,
00091 const Matrix &theMatrix,
00092 ChannelAddress *theAddress =0);
00094 int recvMatrix(int dbTag, int commitTag,
00095 Matrix &theMatrix,
00096 ChannelAddress *theAddress =0);
00097
00099 int sendVector(int dbTag, int commitTag,
00100 const Vector &theVector, ChannelAddress *theAddress =0);
00102 int recvVector(int dbTag, int commitTag,
00103 Vector &theVector,
00104 ChannelAddress *theAddress =0);
00105
00107 int sendID(int dbTag, int commitTag,
00108 const ID &theID,
00109 ChannelAddress *theAddress =0);
00111 int recvID(int dbTag, int commitTag,
00112 ID &theID,
00113 ChannelAddress *theAddress =0);
00114
00115 protected:
00117 unsigned int getPortNumber(void) const;
00118
00119 private:
00121 int sockfd;
00123 struct sockaddr_in my_Addr, last_Addr;
00125 int addrLength;
00127 char *shadow_inetAddr;
00129 unsigned int shadow_port;
00131 unsigned int myPort;
00133 char add[40];
00134 };
00135
00136 #endif
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 ÿ