XC Open source finite element analysis program
UDP_Socket.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 /* ****************************************************************** **
28 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 1999, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.3 $
48 // $Date: 2003/10/15 00:31:47 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/actor/channel/UDP_Socket.h,v $
50 
51 
52 // Written: fmk
53 // Created: 11/96
54 // Revision: A
55 //
56 // Purpose: This file contains the class definition for UDP_Socket.
57 // UDP_Socket is a sub-class of channel. It is implemented with
58 // Berkeley datagram sockets using the UDP protocol. Messages delivery
59 // is thus unreliable.
60 //
61 // What: "@(#) UDP_Socket.h, revA"
62 
63 #ifndef UDP_Socket_h
64 #define UDP_Socket_h
65 
66 #include "utility/actor/channel/Socket.h"
67 #include "utility/actor/channel/Channel.h"
68 namespace XC {
69 class SocketAddress;
70 
72 //
76 class UDP_Socket : public Channel
77  {
78  private:
79  int sockfd;
80  int connectType;
81  union {
82  struct sockaddr addr;
83  struct sockaddr_in addr_in;
84  } my_Addr;
85  union {
86  struct sockaddr addr;
87  struct sockaddr_in addr_in;
88  } last_Addr;
89 
90  socklen_t addrLength;
91  char *shadow_inetAddr;
92  unsigned int shadow_port;
93  unsigned int myPort;
94  char add[40];
95  protected:
96  unsigned int getPortNumber(void) const;
97  public:
98  UDP_Socket(void);
99  UDP_Socket(unsigned int port);
100  UDP_Socket(unsigned int other_Port, char *other_InetAddr);
101  ~UDP_Socket(void);
102 
103  char *addToProgram(void);
104 
105  virtual int setUpConnection(void);
106 
107  int setNextAddress(const ChannelAddress &otherChannelAddress);
108 
109  int sendObj(int commitTag, MovableObject &, ChannelAddress *theAddress =0);
110  int recvObj(int commitTag, MovableObject &, FEM_ObjectBroker &, ChannelAddress *theAddress =0);
111 
112  int sendMsg(int dbTag, int commitTag, const Message &, ChannelAddress *theAddress =0);
113  int recvMsg(int dbTag, int commitTag, Message &, ChannelAddress *theAddress =0);
114 
115  int sendMatrix(int dbTag, int commitTag, const Matrix &, ChannelAddress *theAddress =0);
116  int recvMatrix(int dbTag, int commitTag, Matrix &, ChannelAddress *theAddress =0);
117 
118  int sendVector(int dbTag, int commitTag, const Vector &, ChannelAddress *theAddress =0);
119  int recvVector(int dbTag, int commitTag, Vector &, ChannelAddress *theAddress =0);
120 
121  int sendID(int dbTag, int commitTag, const ID &, ChannelAddress *theAddress =0);
122  int recvID(int dbTag, int commitTag, ID &, ChannelAddress *theAddress =0);
123  };
124 } // end of XC namespace
125 
126 #endif
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
Definition: Vector.h:82
FEM_ObjectBroker is is an object broker class for the finite element method. All methods are virtual ...
Definition: FEM_ObjectBroker.h:138
DP_Socket is a sub-class of channel. It is implemented with Berkeley datagram sockets using the UDP p...
Definition: UDP_Socket.h:76
Definition: ChannelAddress.h:69
int sendObj(int commitTag, MovableObject &, ChannelAddress *theAddress=0)
Envía el objeto a través de éste canal.
Definition: UDP_Socket.cpp:221
Object that can move between processes.
Definition: MovableObject.h:91
Definition: ID.h:77
int recvObj(int commitTag, MovableObject &, FEM_ObjectBroker &, ChannelAddress *theAddress=0)
Recibe el objeto a través de éste canal.
Definition: UDP_Socket.cpp:249
Definition: Matrix.h:82
Channel is an abstract base class which defines the channel interface. A channel is a point of commun...
Definition: Channel.h:85
Message between processes.
Definition: Message.h:67
================================================================================
Definition: ContinuaReprComponent.h:34