annotate xsocket.h @ 261:a03df7dc98f8

Add xsocket wrappers
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Tue, 16 Jun 2015 15:09:23 +0200
parents
children ebbe0f198322
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
a03df7dc98f8 Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
21 int msend(struct xsocket *s, const char *data, size_t len);
a03df7dc98f8 Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
22 int mrecv(struct xsocket *s, char *buffer, size_t len);
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 int command(struct xsocket *s, char *frmt, ...);
a03df7dc98f8 Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
25
a03df7dc98f8 Add xsocket wrappers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
26 #endif