Mercurial > hg > fxanalyse
annotate xsocket.h @ 265:da38cbbc7ec8
Add DDS clients test code
To verify the portabiolity of the clients code and to make testing
easier the test code is independent of the CVI environment and
runtime.
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Sun, 21 Jun 2015 14:44:33 +0200 |
parents | ebbe0f198322 |
children |
rev | line source |
---|---|
261
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
1 #ifndef __XSOCKET_H__ |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
2 #define __XSOCKET_H__ |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
3 |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
4 #ifdef _CVI_ |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
5 #include <ansi_c.h> |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
6 #else |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
7 #include <stdlib.h> |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
8 #endif |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
9 |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
10 struct xsocket { |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
11 char *hostname; |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
12 int port; |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
13 int fd; |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
14 }; |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
15 |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
16 struct xsocket * xsocket(const char *hostname, const int port); |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
17 int xconnect(struct xsocket *s); |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
18 int xsend(struct xsocket *s, const char *data, size_t len); |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
19 int xrecv(struct xsocket *s, char *buffer, size_t len); |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
20 |
262
ebbe0f198322
Fix DDS client connection retry
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
261
diff
changeset
|
21 int xcommand(struct xsocket *s, const char *frmt, ...); |
ebbe0f198322
Fix DDS client connection retry
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
261
diff
changeset
|
22 int xask(struct xsocket *s, const char *data, size_t datalen, char *buffer, size_t len); |
261
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
23 |
a03df7dc98f8
Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff
changeset
|
24 #endif |