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 UDP_Socket_h
00038 #define UDP_Socket_h
00039
00040 #include <Socket.h>
00041 #include <Channel.h>
00042 class SocketAddress;
00043
00044 class UDP_Socket : public Channel
00045 {
00046 public:
00047 UDP_Socket();
00048 UDP_Socket(unsigned int port);
00049 UDP_Socket(unsigned int other_Port, char *other_InetAddr);
00050 ~UDP_Socket();
00051
00052 char *addToProgram(void);
00053
00054 virtual int setUpConnection(void);
00055
00056 int setNextAddress(const ChannelAddress &otherChannelAddress);
00057
00058 int sendObj(int commitTag,
00059 MovableObject &theObject,
00060 ChannelAddress *theAddress =0);
00061 int recvObj(int commitTag,
00062 MovableObject &theObject,
00063 FEM_ObjectBroker &theBroker,
00064 ChannelAddress *theAddress =0);
00065
00066 int sendMsg(int dbTag, int commitTag,
00067 const Message &,
00068 ChannelAddress *theAddress =0);
00069 int recvMsg(int dbTag, int commitTag,
00070 Message &,
00071 ChannelAddress *theAddress =0);
00072
00073 int sendMatrix(int dbTag, int commitTag,
00074 const Matrix &theMatrix,
00075 ChannelAddress *theAddress =0);
00076 int recvMatrix(int dbTag, int commitTag,
00077 Matrix &theMatrix,
00078 ChannelAddress *theAddress =0);
00079
00080 int sendVector(int dbTag, int commitTag,
00081 const Vector &theVector, ChannelAddress *theAddress =0);
00082 int recvVector(int dbTag, int commitTag,
00083 Vector &theVector,
00084 ChannelAddress *theAddress =0);
00085
00086 int sendID(int dbTag, int commitTag,
00087 const ID &theID,
00088 ChannelAddress *theAddress =0);
00089 int recvID(int dbTag, int commitTag,
00090 ID &theID,
00091 ChannelAddress *theAddress =0);
00092
00093 protected:
00094 unsigned int getPortNumber(void) const;
00095
00096 private:
00097 int sockfd;
00098 int connectType;
00099 union {
00100 struct sockaddr addr;
00101 struct sockaddr_in addr_in;
00102 } my_Addr;
00103 union {
00104 struct sockaddr addr;
00105 struct sockaddr_in addr_in;
00106 } last_Addr;
00107
00108 socklen_t addrLength;
00109 char *shadow_inetAddr;
00110 unsigned int shadow_port;
00111 unsigned int myPort;
00112 char add[40];
00113 };
00114
00115 #endif
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125