Faspstream Manager C/C++ API  1.0
A C and C++ language interface to basic streaming over the fasp protocol
fasp_stream.h
Go to the documentation of this file.
1 #ifndef ASPERA_FASP_STREAM_H
2 #define ASPERA_FASP_STREAM_H
3 
4 #include <stdlib.h>
5 
6 #ifdef WIN32
7 
8 #ifdef FASPSTREAM_CPP_EXPORTS
9 #define FASPSTREAM_C_API __declspec(dllexport)
10 #else
11 #define FASPSTREAM_C_API __declspec(dllimport)
12 #endif
13 
14 #else // NOT WIN32
15 #define FASPSTREAM_C_API
16 #endif
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 struct fasp_stream;
23 typedef struct fasp_stream fasp_stream_t;
24 
32 fasp_stream_create(); // const char *argv0, const char *log_dir, int debug_log_level);
33 
42 int
44 
45 /*
46  * Destroys a previously created context, and closes
47  * the fasp stream if it hasn't already been closed
48  *
49  * @param ctx fasp stream context
50  * @return integer representing success (zero) or failure (non-zero)
51  */
52 
54 int
56 
57 /*
58  * Returns non-zero if end of file (EOF) has been reached for the
59  * stream; else, returns 0.
60  *
61  * @param ctx fasp stream context
62  * @return integer representing eof or not (non-zero, zero)
63  */
65 int
67 
105 int
106 fasp_stream_opts_list(const char **options, const char **data_types);
107 
118 int
119 fasp_stream_opts_set(fasp_stream_t *ctx, const char *option, const char *value);
120 
121 /*
122  * Returns a fasp option (as a string) by name, if option not
123  * found, will return an unrecognized option error string.
124  *
125  * @param ctx fasp stream context
126  * @param option name of option for which you wish to lookup the value
127  * @return null-terminated string with current value of named option
128  */
130 const char*
131 fasp_stream_opts_get(fasp_stream_t *ctx, const char *option);
132 
133 /*
134  * Set path to faspstream executable file
135  *
136  * @param ctx fasp stream context
137  * @param path null-terminated string with path to faspstream executable
138  *
139  */
141 void
142 fasp_stream_set_path(fasp_stream_t *ctx, const char*path);
143 
157 int
158 fasp_stream_start_listening(fasp_stream_t *ctx, const char *port);
159 
173 int
174 fasp_stream_connect(fasp_stream_t *ctx, const char *host, const char *port);
175 
176 
191 size_t
192 fasp_stream_read(fasp_stream_t *ctx, char *buf, size_t len);
193 
205 size_t
206 fasp_stream_write(fasp_stream_t *ctx, const char *buf, size_t len);
207 
208 #ifdef __cplusplus
209 };
210 #endif
211 
212 #endif
213 
FASPSTREAM_C_API int fasp_stream_start_listening(fasp_stream_t *ctx, const char *port)
FASPSTREAM_C_API int fasp_stream_close(fasp_stream_t *ctx)
FASPSTREAM_C_API int fasp_stream_connect(fasp_stream_t *ctx, const char *host, const char *port)
FASPSTREAM_C_API size_t fasp_stream_write(fasp_stream_t *ctx, const char *buf, size_t len)
FASPSTREAM_C_API int fasp_stream_opts_set(fasp_stream_t *ctx, const char *option, const char *value)
#define FASPSTREAM_C_API
Definition: fasp_stream.h:15
FASPSTREAM_C_API void fasp_stream_set_path(fasp_stream_t *ctx, const char *path)
FASPSTREAM_C_API int fasp_stream_opts_list(const char **options, const char **data_types)
FASPSTREAM_C_API int fasp_stream_destroy(fasp_stream_t *ctx)
FASPSTREAM_C_API int fasp_stream_eof(fasp_stream_t *ctx)
struct fasp_stream fasp_stream_t
Definition: fasp_stream.h:23
FASPSTREAM_C_API fasp_stream_t * fasp_stream_create()
FASPSTREAM_C_API size_t fasp_stream_read(fasp_stream_t *ctx, char *buf, size_t len)
FASPSTREAM_C_API const char * fasp_stream_opts_get(fasp_stream_t *ctx, const char *option)