Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

UDP_Socket.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.1.1.1 $
00022 // $Date: 2000/09/15 08:23:16 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/actor/channel/UDP_Socket.h,v $
00024                                                                         
00025                                                                         
00026 // File: ~/actor/channel/UDP_Socket.h
00027 //
00028 // Written: fmk 
00029 // Created: 11/96
00030 // Revision: A
00031 //
00032 // Purpose: This file contains the class definition for UDP_Socket.
00033 // UDP_Socket is a sub-class of channel. It is implemented with
00034 // Berkeley datagram sockets using the UDP protocol. Messages delivery
00035 // is thus unreliable.
00036 //
00037 // What: "@(#) UDP_Socket.h, revA"
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 ÿ
Copyright Contact Us