xcoll 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xcoll might be problematic. Click here for more details.
- xcoll/general.py +1 -1
- xcoll/plot.py +1 -1
- {xcoll-0.6.0.dist-info → xcoll-0.6.2.dist-info}/METADATA +5 -4
- xcoll-0.6.2.dist-info/RECORD +61 -0
- {xcoll-0.6.0.dist-info → xcoll-0.6.2.dist-info}/WHEEL +1 -1
- xcoll/scattering_routines/fluka/flukaio/.git +0 -1
- xcoll/scattering_routines/fluka/flukaio/.gitignore +0 -2
- xcoll/scattering_routines/fluka/flukaio/CMakeLists.txt +0 -18
- xcoll/scattering_routines/fluka/flukaio/ComponentMakefile +0 -192
- xcoll/scattering_routines/fluka/flukaio/Makefile +0 -144
- xcoll/scattering_routines/fluka/flukaio/README +0 -26
- xcoll/scattering_routines/fluka/flukaio/doc/Doxyfile +0 -1551
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.asciidoc +0 -1054
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.epub +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.html +0 -1607
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.pdf +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__1.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__2.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__3.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__4.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__5.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__6.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__7.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/Makefile +0 -8
- xcoll/scattering_routines/fluka/flukaio/doc/docbook.xsl +0 -1690
- xcoll/scattering_routines/fluka/flukaio/include/Connection.h +0 -79
- xcoll/scattering_routines/fluka/flukaio/include/FlukaIO.h +0 -58
- xcoll/scattering_routines/fluka/flukaio/include/FlukaIOServer.h +0 -33
- xcoll/scattering_routines/fluka/flukaio/include/FortranFlukaIO.h +0 -277
- xcoll/scattering_routines/fluka/flukaio/include/Message.h +0 -89
- xcoll/scattering_routines/fluka/flukaio/include/ParticleInfo.h +0 -76
- xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
- xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.so +0 -0
- xcoll/scattering_routines/fluka/flukaio/samples/ClientTest.c +0 -156
- xcoll/scattering_routines/fluka/flukaio/samples/ServerTest.c +0 -123
- xcoll/scattering_routines/fluka/flukaio/samples/fclient.f +0 -149
- xcoll/scattering_routines/fluka/flukaio/samples/fserver.f +0 -118
- xcoll/scattering_routines/fluka/flukaio/src/Connection.c +0 -264
- xcoll/scattering_routines/fluka/flukaio/src/Connection.d +0 -69
- xcoll/scattering_routines/fluka/flukaio/src/Connection.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.c +0 -211
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.d +0 -46
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.c +0 -45
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.d +0 -29
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.h +0 -17
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.c +0 -84
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.d +0 -70
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer_private.h +0 -22
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIO_private.h +0 -16
- xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.c +0 -533
- xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.d +0 -40
- xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/NetIO.c +0 -304
- xcoll/scattering_routines/fluka/flukaio/src/NetIO.d +0 -66
- xcoll/scattering_routines/fluka/flukaio/src/NetIO.h +0 -30
- xcoll/scattering_routines/fluka/flukaio/src/NetIO.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/tags +0 -167
- xcoll/scattering_routines/fluka/flukaio/tests/AllTests.cpp +0 -8
- xcoll/scattering_routines/fluka/flukaio/tests/CommonTest.h +0 -10
- xcoll/scattering_routines/fluka/flukaio/tests/ConnectionTest.cpp +0 -99
- xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOServerTest.cpp +0 -104
- xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOTest.cpp +0 -439
- xcoll/scattering_routines/fluka/flukaio/tests/FortranFlukaIOTest.cpp +0 -682
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.c +0 -19
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.h +0 -16
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.c +0 -74
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.h +0 -50
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.c +0 -16
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.h +0 -20
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.c +0 -12
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.h +0 -18
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFortranFlukaIO.h +0 -19
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.c +0 -80
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.h +0 -35
- xcoll-0.6.0.dist-info/LICENSE +0 -201
- xcoll-0.6.0.dist-info/NOTICE +0 -2
- xcoll-0.6.0.dist-info/RECORD +0 -135
- /LICENSE → /xcoll-0.6.2.dist-info/LICENSE +0 -0
- /NOTICE → /xcoll-0.6.2.dist-info/NOTICE +0 -0
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
#include <stdlib.h>
|
|
2
|
-
#include <stdio.h>
|
|
3
|
-
#include <string.h>
|
|
4
|
-
#include <unistd.h>
|
|
5
|
-
#include <errno.h>
|
|
6
|
-
#include <assert.h>
|
|
7
|
-
|
|
8
|
-
#include "Connection.h"
|
|
9
|
-
#include "NetIO.h"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Connect to a host and port
|
|
14
|
-
* @return -1 if error
|
|
15
|
-
*/
|
|
16
|
-
int connection_connect(flukaio_connection_t *conn, const char *host, int port) {
|
|
17
|
-
conn->fd = conn->connect(host, port);
|
|
18
|
-
return conn->fd;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Creates a connection object given a socket (file descriptor)
|
|
23
|
-
* @return returns a connection, NULL if memory error
|
|
24
|
-
*/
|
|
25
|
-
flukaio_connection_t *connection_create(int fd)
|
|
26
|
-
{
|
|
27
|
-
flukaio_connection_t *conn = (flukaio_connection_t *)malloc(sizeof(flukaio_connection_t));
|
|
28
|
-
if (conn)
|
|
29
|
-
{
|
|
30
|
-
conn->fd = fd;
|
|
31
|
-
|
|
32
|
-
conn->in_buffer_size = sizeof(conn->in_buffer);
|
|
33
|
-
conn->out_buffer_size = sizeof(conn->out_buffer);
|
|
34
|
-
conn->in_buffer_len = 0;
|
|
35
|
-
conn->in_buffer_start = 0;
|
|
36
|
-
conn->in_buffer_end = 0;
|
|
37
|
-
conn->out_buffer_len = 0;
|
|
38
|
-
conn->read_timeout = DEFAULT_READ_TIMEOUT;
|
|
39
|
-
conn->write_timeout = DEFAULT_WRITE_TIMEOUT;
|
|
40
|
-
|
|
41
|
-
conn->connect = &netio_connect;
|
|
42
|
-
conn->read = &netio_read;
|
|
43
|
-
conn->write = &netio_write;
|
|
44
|
-
conn->can_read = &netio_can_read;
|
|
45
|
-
conn->can_write = &netio_can_write;
|
|
46
|
-
conn->set_nonblocking = &netio_set_nonblocking;
|
|
47
|
-
conn->set_nodelay = &netio_set_nodelay;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return conn;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Closes connection and frees structures
|
|
55
|
-
*/
|
|
56
|
-
void connection_destroy(flukaio_connection_t *conn)
|
|
57
|
-
{
|
|
58
|
-
if (conn == NULL)
|
|
59
|
-
return;
|
|
60
|
-
|
|
61
|
-
if(conn->fd != -1)
|
|
62
|
-
{
|
|
63
|
-
shutdown(conn->fd, SHUT_RDWR);
|
|
64
|
-
close(conn->fd);
|
|
65
|
-
}
|
|
66
|
-
free(conn);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Send message through connection
|
|
71
|
-
* @return bytes sent, -1 if error
|
|
72
|
-
*/
|
|
73
|
-
ssize_t connection_push_message(flukaio_connection_t * conn,
|
|
74
|
-
unsigned char type, const void *data, size_t datalen)
|
|
75
|
-
{
|
|
76
|
-
if (conn == NULL)
|
|
77
|
-
return -1;
|
|
78
|
-
|
|
79
|
-
size_t out_buffer_space = conn->out_buffer_size - conn->out_buffer_len;
|
|
80
|
-
ssize_t n = connection_write_message_bin(
|
|
81
|
-
type, data, datalen,
|
|
82
|
-
conn->out_buffer + conn->out_buffer_len,
|
|
83
|
-
out_buffer_space);
|
|
84
|
-
|
|
85
|
-
if (n <= 0) return n;
|
|
86
|
-
conn->out_buffer_len += n;
|
|
87
|
-
|
|
88
|
-
return n;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Write message in buffer
|
|
93
|
-
* @return number of bytes written, -1 if error
|
|
94
|
-
*/
|
|
95
|
-
ssize_t connection_write_message_bin(
|
|
96
|
-
const unsigned char type,
|
|
97
|
-
const void *data, const size_t datalen,
|
|
98
|
-
void *buf, const size_t buflen)
|
|
99
|
-
{
|
|
100
|
-
if (buf == NULL) return -2;
|
|
101
|
-
if (data == NULL && datalen > 0) return -3;
|
|
102
|
-
if (buflen < (datalen + MSG_HEADER_LEN)) return -4;
|
|
103
|
-
|
|
104
|
-
void *bufp = buf;
|
|
105
|
-
flukaio_message_t msg;
|
|
106
|
-
|
|
107
|
-
msg.size = MSG_HEADER_LEN + datalen;
|
|
108
|
-
msg.type = type;
|
|
109
|
-
|
|
110
|
-
memcpy(bufp, &msg, MSG_HEADER_LEN);
|
|
111
|
-
memcpy(bufp+MSG_HEADER_LEN, data, datalen);
|
|
112
|
-
|
|
113
|
-
return msg.size;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Returns a message if inmediately available
|
|
118
|
-
* Stores read message in msg
|
|
119
|
-
* @return bytes read, -1 if error (disconnect, etc.)
|
|
120
|
-
*/
|
|
121
|
-
ssize_t connection_receive_message(flukaio_connection_t *conn, flukaio_message_t *msg)
|
|
122
|
-
{
|
|
123
|
-
if (conn == NULL)
|
|
124
|
-
return -1;
|
|
125
|
-
|
|
126
|
-
ssize_t len = connection_read_message_from(msg, conn->in_buffer + conn->in_buffer_start, conn->in_buffer_len);
|
|
127
|
-
|
|
128
|
-
if (len > 0)
|
|
129
|
-
{
|
|
130
|
-
conn->in_buffer_len -= len;
|
|
131
|
-
conn->in_buffer_start += len;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return len;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Write/transmit output buffer, blocks until done
|
|
140
|
-
* @return number of bytes written, -1 if connection error (disconnect, etc.)
|
|
141
|
-
*/
|
|
142
|
-
ssize_t connection_write(flukaio_connection_t *conn)
|
|
143
|
-
{
|
|
144
|
-
if (conn == NULL)
|
|
145
|
-
return -1;
|
|
146
|
-
|
|
147
|
-
ssize_t n;
|
|
148
|
-
n = conn->write(conn->fd, conn->out_buffer, conn->out_buffer_len);
|
|
149
|
-
// write always sends the full buffer or reports an error
|
|
150
|
-
if (n > 0)
|
|
151
|
-
conn->out_buffer_len -= n;
|
|
152
|
-
return n;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Write all contents of connection
|
|
157
|
-
* exactly the same as connection_write
|
|
158
|
-
*/
|
|
159
|
-
ssize_t connection_flush(flukaio_connection_t *conn)
|
|
160
|
-
{
|
|
161
|
-
return connection_write(conn);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Read from network and store in input buffer
|
|
166
|
-
* @return number of read bytes, -1 if connection error (disconnect, etc.)
|
|
167
|
-
*/
|
|
168
|
-
ssize_t connection_read(flukaio_connection_t *conn)
|
|
169
|
-
{
|
|
170
|
-
if (conn == NULL)
|
|
171
|
-
return -1;
|
|
172
|
-
|
|
173
|
-
if (conn->in_buffer_start > (conn->in_buffer_size>>1)) {
|
|
174
|
-
memmove(conn->in_buffer, conn->in_buffer + conn->in_buffer_start, conn->in_buffer_len);
|
|
175
|
-
conn->in_buffer_start = 0;
|
|
176
|
-
conn->in_buffer_end = conn->in_buffer_len;
|
|
177
|
-
}
|
|
178
|
-
ssize_t n = conn->read(conn->fd,
|
|
179
|
-
conn->in_buffer + conn->in_buffer_end,
|
|
180
|
-
conn->in_buffer_size-conn->in_buffer_end);
|
|
181
|
-
if (n > 0) {
|
|
182
|
-
conn->in_buffer_end += n;
|
|
183
|
-
conn->in_buffer_len += n;
|
|
184
|
-
}
|
|
185
|
-
return n;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* @return 1 if can read, -1 on error
|
|
190
|
-
*/
|
|
191
|
-
int connection_can_read(flukaio_connection_t *conn)
|
|
192
|
-
{
|
|
193
|
-
if (conn == NULL)
|
|
194
|
-
return -1;
|
|
195
|
-
|
|
196
|
-
return conn->can_read(conn->fd, conn->read_timeout, 0);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* @return 1 if can write, -1 on error
|
|
201
|
-
*/
|
|
202
|
-
int connection_can_write(flukaio_connection_t *conn)
|
|
203
|
-
{
|
|
204
|
-
if (conn == NULL)
|
|
205
|
-
return -1;
|
|
206
|
-
|
|
207
|
-
return conn->can_write(conn->fd, conn->write_timeout, 0);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Sets the read timeout for this specific connection
|
|
212
|
-
* @param time to wait in seconds
|
|
213
|
-
* @return set timeout, -1 if error
|
|
214
|
-
*/
|
|
215
|
-
int connection_set_read_timeout(flukaio_connection_t *conn, long timeout)
|
|
216
|
-
{
|
|
217
|
-
if (conn == NULL)
|
|
218
|
-
return -1;
|
|
219
|
-
|
|
220
|
-
return conn->read_timeout = timeout;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
int connection_set_write_timeout(flukaio_connection_t *conn, long timeout)
|
|
224
|
-
{
|
|
225
|
-
if (conn == NULL)
|
|
226
|
-
return -1;
|
|
227
|
-
|
|
228
|
-
return conn->write_timeout = timeout;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* read message from a given buffer
|
|
233
|
-
* Stores read message in msg
|
|
234
|
-
* @return bytes read, -1 if error (disconnect, etc.)
|
|
235
|
-
*/
|
|
236
|
-
inline ssize_t connection_read_message_from(flukaio_message_t *msg, const void *buffer, size_t buffer_len)
|
|
237
|
-
{
|
|
238
|
-
flukaio_message_t *mymsg = msg;
|
|
239
|
-
flukaio_message_t m;
|
|
240
|
-
|
|
241
|
-
if (mymsg == NULL)
|
|
242
|
-
mymsg = &m;
|
|
243
|
-
|
|
244
|
-
if (buffer == NULL)
|
|
245
|
-
return -1;
|
|
246
|
-
|
|
247
|
-
if (buffer_len < MSG_HEADER_LEN)
|
|
248
|
-
return -1;
|
|
249
|
-
|
|
250
|
-
memcpy(mymsg, buffer, MSG_HEADER_LEN);
|
|
251
|
-
|
|
252
|
-
// Full data not ready
|
|
253
|
-
if (buffer_len < mymsg->size)
|
|
254
|
-
return -1;
|
|
255
|
-
|
|
256
|
-
if (msg != NULL)
|
|
257
|
-
{
|
|
258
|
-
memcpy(msg, buffer, mymsg->size);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return mymsg->size;
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
src/Connection.o src/Connection.d: src/Connection.c \
|
|
2
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdlib.h \
|
|
3
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/features.h \
|
|
4
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/cdefs.h \
|
|
5
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/wordsize.h \
|
|
6
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/gnu/stubs.h \
|
|
7
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/gnu/stubs-64.h \
|
|
8
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stddef.h \
|
|
9
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/waitflags.h \
|
|
10
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/waitstatus.h \
|
|
11
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/endian.h \
|
|
12
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/endian.h \
|
|
13
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/byteswap.h \
|
|
14
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/types.h \
|
|
15
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/types.h \
|
|
16
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/typesizes.h \
|
|
17
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/time.h \
|
|
18
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/select.h \
|
|
19
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/select.h \
|
|
20
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/sigset.h \
|
|
21
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/time.h \
|
|
22
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/sysmacros.h \
|
|
23
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/pthreadtypes.h \
|
|
24
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/alloca.h \
|
|
25
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h \
|
|
26
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/libio.h \
|
|
27
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/_G_config.h \
|
|
28
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/wchar.h \
|
|
29
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stdarg.h \
|
|
30
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/stdio_lim.h \
|
|
31
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/sys_errlist.h \
|
|
32
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/string.h \
|
|
33
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/xlocale.h \
|
|
34
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/unistd.h \
|
|
35
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/posix_opt.h \
|
|
36
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/environments.h \
|
|
37
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/confname.h \
|
|
38
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/getopt.h \
|
|
39
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/errno.h \
|
|
40
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/errno.h \
|
|
41
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/linux/errno.h \
|
|
42
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm/errno.h \
|
|
43
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm-generic/errno.h \
|
|
44
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm-generic/errno-base.h \
|
|
45
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/assert.h \
|
|
46
|
-
include/Connection.h include/Message.h \
|
|
47
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stdint.h \
|
|
48
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdint.h \
|
|
49
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/wchar.h \
|
|
50
|
-
include/ParticleInfo.h src/NetIO.h \
|
|
51
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/socket.h \
|
|
52
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/uio.h \
|
|
53
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/uio.h \
|
|
54
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/socket.h \
|
|
55
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/sockaddr.h \
|
|
56
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm/socket.h \
|
|
57
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm-generic/socket.h \
|
|
58
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm/sockios.h \
|
|
59
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm-generic/sockios.h \
|
|
60
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/arpa/inet.h \
|
|
61
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/netinet/in.h \
|
|
62
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/in.h \
|
|
63
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/fcntl.h \
|
|
64
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/fcntl.h \
|
|
65
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/stat.h \
|
|
66
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/netinet/tcp.h \
|
|
67
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/netdb.h \
|
|
68
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/rpc/netdb.h \
|
|
69
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/netdb.h
|
|
Binary file
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
#include "FlukaIO_private.h"
|
|
2
|
-
|
|
3
|
-
flukaio_connection_t* flukaio_conn() {
|
|
4
|
-
return connection_create(-1);
|
|
5
|
-
} // flukaio_conn
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Blocks until a message is read.
|
|
9
|
-
* Stores read message in msg
|
|
10
|
-
* @return number bytes read, -1 if error (timeout, disconnect, etc.)
|
|
11
|
-
*/
|
|
12
|
-
ssize_t flukaio_wait_message(flukaio_connection_t *conn, flukaio_message_t *msg) {
|
|
13
|
-
ssize_t n;
|
|
14
|
-
int retries = 0;
|
|
15
|
-
|
|
16
|
-
if (conn == NULL)
|
|
17
|
-
return -100;
|
|
18
|
-
|
|
19
|
-
while (retries < 2 && (n = flukaio_receive_message(conn, msg)) < 0) {
|
|
20
|
-
// blocks waiting for data
|
|
21
|
-
int retval = connection_can_read(conn);
|
|
22
|
-
|
|
23
|
-
if (retval <= 0)
|
|
24
|
-
return -101;
|
|
25
|
-
|
|
26
|
-
retries++;
|
|
27
|
-
}
|
|
28
|
-
return n;
|
|
29
|
-
} // flukaio_wait_message
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Returns a message if inmediately available
|
|
33
|
-
* Stores read message in msg
|
|
34
|
-
* @return bytes read, -1 if error (disconnect, etc.)
|
|
35
|
-
*/
|
|
36
|
-
ssize_t flukaio_receive_message(flukaio_connection_t *conn, flukaio_message_t *msg)
|
|
37
|
-
{
|
|
38
|
-
if (conn == NULL)
|
|
39
|
-
return -102;
|
|
40
|
-
|
|
41
|
-
if (conn->in_buffer_len <= conn->in_buffer_size * FLUKAIO_IN_CACHE)
|
|
42
|
-
connection_read(conn);
|
|
43
|
-
|
|
44
|
-
int n = connection_receive_message(conn, msg);
|
|
45
|
-
if (n > 0) {
|
|
46
|
-
if (msg) {
|
|
47
|
-
switch(msg->type) {
|
|
48
|
-
case N_PART:
|
|
49
|
-
case N_EOB:
|
|
50
|
-
case N_IPT:
|
|
51
|
-
case N_END:
|
|
52
|
-
case N_CONF:
|
|
53
|
-
case N_HSK:
|
|
54
|
-
case N_INT:
|
|
55
|
-
case N_DBLE:
|
|
56
|
-
break;
|
|
57
|
-
default:
|
|
58
|
-
msg->type = N_ERR;
|
|
59
|
-
return -103;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return n;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (msg) msg->type = N_ERR;
|
|
67
|
-
return -104;
|
|
68
|
-
} // flukaio_receive_message
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Send particle
|
|
72
|
-
* @param part particle to send
|
|
73
|
-
* @return bytes sent, -1 if error
|
|
74
|
-
*/
|
|
75
|
-
ssize_t flukaio_send_particle(flukaio_connection_t *conn, const particle_info_t *part)
|
|
76
|
-
{
|
|
77
|
-
ssize_t n = connection_push_message(conn, N_PART, part, sizeof(particle_info_t));
|
|
78
|
-
|
|
79
|
-
if (n < 0) return n;
|
|
80
|
-
|
|
81
|
-
if(conn->out_buffer_len >= conn->out_buffer_size * FLUKAIO_OUT_CACHE)
|
|
82
|
-
connection_flush(conn);
|
|
83
|
-
|
|
84
|
-
return n;
|
|
85
|
-
|
|
86
|
-
} // flukaio_send_particle
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Send End Of Batch
|
|
90
|
-
* @return bytes sent, -1 if error
|
|
91
|
-
*/
|
|
92
|
-
ssize_t flukaio_send_eob(flukaio_connection_t *conn)
|
|
93
|
-
{
|
|
94
|
-
ssize_t n = connection_push_message(conn, N_EOB, NULL, 0);
|
|
95
|
-
connection_flush(conn);
|
|
96
|
-
return n;
|
|
97
|
-
} // flukaio_send_eob
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Send Insertion Point
|
|
101
|
-
* @param turn Current turn number
|
|
102
|
-
* @param ipt Insertion point number
|
|
103
|
-
* @return bytes sent, -1 if error
|
|
104
|
-
*/
|
|
105
|
-
ssize_t flukaio_send_ipt(flukaio_connection_t *conn, uint32_t turn, uint16_t ipt)
|
|
106
|
-
{
|
|
107
|
-
flukaio_ipt_data_t data;
|
|
108
|
-
data.turn = turn;
|
|
109
|
-
data.ipt = ipt;
|
|
110
|
-
|
|
111
|
-
ssize_t n = connection_push_message(conn, N_IPT, &data, sizeof(data));
|
|
112
|
-
return n;
|
|
113
|
-
} // flukaio_send_ipt
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Send Handshake
|
|
117
|
-
*/
|
|
118
|
-
ssize_t flukaio_send_hsk(flukaio_connection_t *conn, uint16_t major, uint16_t minor, uint32_t key)
|
|
119
|
-
{
|
|
120
|
-
flukaio_hsk_data_t data;
|
|
121
|
-
data.minor = minor;
|
|
122
|
-
data.major = major;
|
|
123
|
-
data.key = key;
|
|
124
|
-
|
|
125
|
-
ssize_t n = connection_push_message(conn, N_HSK, &data, sizeof(data));
|
|
126
|
-
connection_flush(conn);
|
|
127
|
-
return n;
|
|
128
|
-
} // flukaio_send_hsk
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Send End Of Computation
|
|
132
|
-
* @return bytes sent, -1 if error
|
|
133
|
-
*/
|
|
134
|
-
ssize_t flukaio_send_eoc(flukaio_connection_t *conn)
|
|
135
|
-
{
|
|
136
|
-
ssize_t n = connection_push_message(conn, N_END, NULL, 0);
|
|
137
|
-
connection_flush(conn);
|
|
138
|
-
return n;
|
|
139
|
-
} // flukaio_send_eoc
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Send an int message
|
|
143
|
-
* @param conn connection structrure
|
|
144
|
-
* @param id message id
|
|
145
|
-
* @param value integer value to send
|
|
146
|
-
* @return bytes sent, -1 if error
|
|
147
|
-
*/
|
|
148
|
-
ssize_t flukaio_send_int(flukaio_connection_t *conn, const int id, const int value)
|
|
149
|
-
{
|
|
150
|
-
flukaio_int_data_t data;
|
|
151
|
-
|
|
152
|
-
data.id = id;
|
|
153
|
-
data.value = value;
|
|
154
|
-
|
|
155
|
-
ssize_t n = connection_push_message(conn, N_INT, &data, sizeof(data));
|
|
156
|
-
connection_flush(conn);
|
|
157
|
-
return n;
|
|
158
|
-
} // flukaio_send_int
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Send a double message
|
|
162
|
-
* @param conn connection structrure
|
|
163
|
-
* @param id message id
|
|
164
|
-
* @param value double value to send
|
|
165
|
-
* @return bytes sent, -1 if error
|
|
166
|
-
*/
|
|
167
|
-
ssize_t flukaio_send_double(flukaio_connection_t *conn, const int id, const double value)
|
|
168
|
-
{
|
|
169
|
-
flukaio_dble_data_t data;
|
|
170
|
-
|
|
171
|
-
data.id = id;
|
|
172
|
-
data.value = value;
|
|
173
|
-
|
|
174
|
-
ssize_t n = connection_push_message(conn, N_DBLE, &data, sizeof(data));
|
|
175
|
-
connection_flush(conn);
|
|
176
|
-
return n;
|
|
177
|
-
} // flukaio_send_double
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Send maximum Number of particles
|
|
181
|
-
* @return bytes sent, -1 if error
|
|
182
|
-
*/
|
|
183
|
-
ssize_t flukaio_send_npart(flukaio_connection_t *conn, const uint32_t npart)
|
|
184
|
-
{
|
|
185
|
-
return flukaio_send_int(conn, N_NPART, npart);
|
|
186
|
-
} // flukaio_send_npart
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Helper routine, connect to server at host and port
|
|
190
|
-
* @return 0 if success, -1 if error
|
|
191
|
-
*/
|
|
192
|
-
flukaio_connection_t *flukaio_connect(flukaio_connection_t *conn, const char *host, int port) {
|
|
193
|
-
if (connection_connect(conn, host, port) < 0) return conn;
|
|
194
|
-
|
|
195
|
-
if (flukaio_handshake_client(conn) < 0) {
|
|
196
|
-
// Handshake failed
|
|
197
|
-
errno = EPROTO;
|
|
198
|
-
flukaio_disconnect(conn);
|
|
199
|
-
return NULL;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return conn;
|
|
203
|
-
} // flukaio_connect
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Disconnect from server
|
|
207
|
-
* @param conn Connection object
|
|
208
|
-
*/
|
|
209
|
-
void flukaio_disconnect(flukaio_connection_t *conn) {
|
|
210
|
-
connection_destroy(conn);
|
|
211
|
-
} // flukaio_disconnect
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
src/FlukaIO.o src/FlukaIO.d: src/FlukaIO.c src/FlukaIO_private.h \
|
|
2
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/assert.h \
|
|
3
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/features.h \
|
|
4
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/cdefs.h \
|
|
5
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/wordsize.h \
|
|
6
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/gnu/stubs.h \
|
|
7
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/gnu/stubs-64.h \
|
|
8
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h \
|
|
9
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stddef.h \
|
|
10
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/types.h \
|
|
11
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/typesizes.h \
|
|
12
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/libio.h \
|
|
13
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/_G_config.h \
|
|
14
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/wchar.h \
|
|
15
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stdarg.h \
|
|
16
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/stdio_lim.h \
|
|
17
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/sys_errlist.h \
|
|
18
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/string.h \
|
|
19
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/xlocale.h \
|
|
20
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/errno.h \
|
|
21
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/errno.h \
|
|
22
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/linux/errno.h \
|
|
23
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm/errno.h \
|
|
24
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm-generic/errno.h \
|
|
25
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/asm-generic/errno-base.h \
|
|
26
|
-
include/Connection.h \
|
|
27
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdlib.h \
|
|
28
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/waitflags.h \
|
|
29
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/waitstatus.h \
|
|
30
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/endian.h \
|
|
31
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/endian.h \
|
|
32
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/byteswap.h \
|
|
33
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/types.h \
|
|
34
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/time.h \
|
|
35
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/select.h \
|
|
36
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/select.h \
|
|
37
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/sigset.h \
|
|
38
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/time.h \
|
|
39
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/sysmacros.h \
|
|
40
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/pthreadtypes.h \
|
|
41
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/alloca.h \
|
|
42
|
-
include/Message.h \
|
|
43
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stdint.h \
|
|
44
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdint.h \
|
|
45
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/wchar.h \
|
|
46
|
-
include/ParticleInfo.h include/FlukaIO.h include/Connection.h
|
|
Binary file
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
#include "FlukaIOHandshake.h"
|
|
2
|
-
|
|
3
|
-
int (*flukaio_handshake_client)(flukaio_connection_t * conn) = &impl_flukaio_handshake_client;
|
|
4
|
-
int (*flukaio_handshake_server)(flukaio_connection_t * conn) = &impl_flukaio_handshake_server;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Handshake the server (used by the client)
|
|
8
|
-
* checks if server implements a compatible version of the protocol
|
|
9
|
-
* @param conn Connection object
|
|
10
|
-
* @return true if versions are compatible, otherwise it disconnects
|
|
11
|
-
*/
|
|
12
|
-
int impl_flukaio_handshake_client(flukaio_connection_t * conn) {
|
|
13
|
-
uint32_t key = 123141;
|
|
14
|
-
ssize_t n = flukaio_send_hsk(conn, FLUKAIO_MAJOR_VERSION, FLUKAIO_MINOR_VERSION, key);
|
|
15
|
-
if (n < 0) return -1;
|
|
16
|
-
|
|
17
|
-
// Redundant check
|
|
18
|
-
flukaio_message_t msg;
|
|
19
|
-
n = flukaio_wait_message(conn, &msg);
|
|
20
|
-
if (msg.type != N_HSK) return -1;
|
|
21
|
-
if (msg.data.hsk.major != FLUKAIO_MAJOR_VERSION) return -1;
|
|
22
|
-
if (msg.data.hsk.key != key) return -1;
|
|
23
|
-
return 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Handshake the client (used by the server)
|
|
28
|
-
* checks if client implements a compatible version of the protocol
|
|
29
|
-
* @param conn Connection object
|
|
30
|
-
* @return true if versions are compatible, otherwise it disconnects
|
|
31
|
-
*/
|
|
32
|
-
int impl_flukaio_handshake_server(flukaio_connection_t * conn) {
|
|
33
|
-
flukaio_message_t msg;
|
|
34
|
-
ssize_t n = flukaio_wait_message(conn, &msg);
|
|
35
|
-
|
|
36
|
-
if (n < 0) return -1;
|
|
37
|
-
if (msg.type != N_HSK) return -1;
|
|
38
|
-
if (msg.data.hsk.major != FLUKAIO_MAJOR_VERSION) return -1;
|
|
39
|
-
|
|
40
|
-
// Reply with our version plus the original key
|
|
41
|
-
n = flukaio_send_hsk(conn, FLUKAIO_MAJOR_VERSION, FLUKAIO_MINOR_VERSION, msg.data.hsk.key);
|
|
42
|
-
if (n < 0) return -1;
|
|
43
|
-
return 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
src/FlukaIOHandshake.o src/FlukaIOHandshake.d: src/FlukaIOHandshake.c \
|
|
2
|
-
src/FlukaIOHandshake.h include/FlukaIO.h \
|
|
3
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdlib.h \
|
|
4
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/features.h \
|
|
5
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/cdefs.h \
|
|
6
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/wordsize.h \
|
|
7
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/gnu/stubs.h \
|
|
8
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/gnu/stubs-64.h \
|
|
9
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stddef.h \
|
|
10
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/waitflags.h \
|
|
11
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/waitstatus.h \
|
|
12
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/endian.h \
|
|
13
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/endian.h \
|
|
14
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/byteswap.h \
|
|
15
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/types.h \
|
|
16
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/types.h \
|
|
17
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/typesizes.h \
|
|
18
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/time.h \
|
|
19
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/select.h \
|
|
20
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/select.h \
|
|
21
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/sigset.h \
|
|
22
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/time.h \
|
|
23
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/sysmacros.h \
|
|
24
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/pthreadtypes.h \
|
|
25
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/alloca.h \
|
|
26
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stdint.h \
|
|
27
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdint.h \
|
|
28
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/wchar.h \
|
|
29
|
-
include/Message.h include/ParticleInfo.h include/Connection.h
|