MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
s2s.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/utils/s2s.h,v 1.24 2017/01/12 15:10:28 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 #ifndef S2S_H
33 #define S2S_H
34 
35 const int S2S_BUFSIZE = 1024;
36 
38  int ms_type;
39  int ms_domain;
40  union {
41  struct sockaddr ms_addr_generic;
42  struct sockaddr_in ms_addr_inet;
43  struct sockaddr_un ms_addr_local;
44  } ms_addr;
46 };
47 
48 enum {
52 };
53 
54 struct s2s_t {
55  // depend on configuration
56  int nChannels;
57  const char *path;
58  // path and [host:][port] are mutually exclusive
59  const char *host;
60  int port;
62  int create;
63  int block;
64 
65  // internal data
66  int sock;
67 
68  std::string buf;
69  std::vector<double> dbuf;
71  const char *progname;
72 
73  s2s_t(void);
74  ~s2s_t(void);
75 
76  void usage(int rc) const;
77  void parse(int argc, char *argv[]);
78  void prepare(void);
79  void shutdown(void);
80 
81  bool is_blocking(void) const;
82 
83  ssize_t send(int flags) const;
84  ssize_t recv(int flags);
85 
86  struct s2s_t *next;
87 };
88 
89 #endif /* S2S_H */
std::string buf
Definition: s2s.h:68
int ms_type
Definition: s2s.h:38
union s2s_sockaddr_t::@54 ms_addr
Definition: s2s.h:50
void usage(int rc) const
const char * progname
Definition: s2s.h:71
socklen_t ms_len
Definition: s2s.h:45
struct sockaddr_in ms_addr_inet
Definition: s2s.h:42
struct sockaddr ms_addr_generic
Definition: s2s.h:41
ssize_t send(int flags) const
void prepare(void)
ssize_t recv(int flags)
s2s_sockaddr_t addr
Definition: s2s.h:61
int nChannels
Definition: s2s.h:56
int ms_domain
Definition: s2s.h:39
Definition: s2s.h:51
bool is_blocking(void) const
struct sockaddr_un ms_addr_local
Definition: s2s.h:43
std::vector< double > dbuf
Definition: s2s.h:69
int sock
Definition: s2s.h:66
s2s_t(void)
const char * path
Definition: s2s.h:57
const char * host
Definition: s2s.h:59
Definition: s2s.h:54
int block
Definition: s2s.h:63
void parse(int argc, char *argv[])
bool stream2socket
Definition: s2s.h:70
int create
Definition: s2s.h:62
struct s2s_t * next
Definition: s2s.h:86
const int S2S_BUFSIZE
Definition: s2s.h:35
~s2s_t(void)
int port
Definition: s2s.h:60
void shutdown(void)