Building Controls Virtual Test Bed
dummy/utilSocket.h
Go to the documentation of this file.
1 // Dummy methods for interfacing clients using BSD sockets.
2 
3 /*
4 ********************************************************************
5 Copyright Notice
6 ----------------
7 
8 Building Controls Virtual Test Bed (BCVTB) Copyright (c) 2008-2009, The
9 Regents of the University of California, through Lawrence Berkeley
10 National Laboratory (subject to receipt of any required approvals from
11 the U.S. Dept. of Energy). All rights reserved.
12 
13 If you have questions about your rights to use or distribute this
14 software, please contact Berkeley Lab's Technology Transfer Department
15 at TTD@lbl.gov
16 
17 NOTICE. This software was developed under partial funding from the U.S.
18 Department of Energy. As such, the U.S. Government has been granted for
19 itself and others acting on its behalf a paid-up, nonexclusive,
20 irrevocable, worldwide license in the Software to reproduce, prepare
21 derivative works, and perform publicly and display publicly. Beginning
22 five (5) years after the date permission to assert copyright is obtained
23 from the U.S. Department of Energy, and subject to any subsequent five
24 (5) year renewals, the U.S. Government is granted for itself and others
25 acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide
26 license in the Software to reproduce, prepare derivative works,
27 distribute copies to the public, perform publicly and display publicly,
28 and to permit others to do so.
29 
30 
31 Modified BSD License agreement
32 ------------------------------
33 
34 Building Controls Virtual Test Bed (BCVTB) Copyright (c) 2008-2009, The
35 Regents of the University of California, through Lawrence Berkeley
36 National Laboratory (subject to receipt of any required approvals from
37 the U.S. Dept. of Energy). All rights reserved.
38 
39 Redistribution and use in source and binary forms, with or without
40 modification, are permitted provided that the following conditions are met:
41 
42  1. Redistributions of source code must retain the above copyright
43  notice, this list of conditions and the following disclaimer.
44  2. Redistributions in binary form must reproduce the above copyright
45  notice, this list of conditions and the following disclaimer in
46  the documentation and/or other materials provided with the
47  distribution.
48  3. Neither the name of the University of California, Lawrence
49  Berkeley National Laboratory, U.S. Dept. of Energy nor the names
50  of its contributors may be used to endorse or promote products
51  derived from this software without specific prior written permission.
52 
53 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
54 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
55 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
56 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
57 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
58 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
59 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
60 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
61 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
62 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
63 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 
65 You are under no obligation whatsoever to provide any bug fixes,
66 patches, or upgrades to the features, functionality or performance of
67 the source code ("Enhancements") to anyone; however, if you choose to
68 make your Enhancements available either publicly, or directly to
69 Lawrence Berkeley National Laboratory, without imposing a separate
70 written license agreement for such Enhancements, then you hereby grant
71 the following license: a non-exclusive, royalty-free perpetual license
72 to install, use, modify, prepare derivative works, incorporate into
73 other computer software, distribute, and sublicense such enhancements or
74 derivative works thereof, in binary and source code form.
75 
76 ********************************************************************
77 */
78 
98 #ifndef _UTILSOCKET_H_
99 #define _UTILSOCKET_H_
100 
107 int getsocketportnumber(const char *const docname);
108 
118 
126 int establishclientsocket(const char *const docname);
127 
143 int sendclientmessage(const int *sockfd, const int *flaWri);
144 
155 int sendclienterror(const int *sockfd, const int *flaWri){
156  return sendclientmessage(sockfd, flaWri);
157 }
158 
174 int exchangedoubleswithsocket(const int *sockfd,
175  const int *flaWri, int *flaRea,
176  const int *nDblWri,
177  int *nDblRea,
178  double *simTimWri,
179  double dblValWri[],
180  double *simTimRea,
181  double dblValRea[]);
182 
188 int closeipc(int* sockfd);
189 
190 #endif /* _UTILSOCKET_H_ */
191 
function sockfd
int getmainversionnumber()
Returns the main version number.
int closeipc(int *sockfd)
Closes the inter process communication socket.
int sendclienterror(const int *sockfd, const int *flaWri)
Writes an error flag to the socket stream.
int getsocketportnumber(const char *const docname)
Gets the port number for the BSD socket communication.
int exchangedoubleswithsocket(const int *sockfd, const int *flaWri, int *flaRea, const int *nDblWri, int *nDblRea, double *simTimWri, double dblValWri[], double *simTimRea, double dblValRea[])
Exchanges data with the socket.
end Get return values from pointers flaRea
int sendclientmessage(const int *sockfd, const int *flaWri)
Writes a message flag to the socket stream.
int establishclientsocket(const char *const docname)
Establishes a connection to the socket.