Faspstream Manager C/C++ API  3.6.1
A C and C++ language interface to basic streaming over the fasp protocol
fasp_stream_client.h File Reference
#include "fasp_stream_constants.h"
#include <stdlib.h>
#include <fasp_stream_channel.h>

Go to the source code of this file.

Macros

#define ASPERA_FASP_STREAM_CLIENT_WRAPPER_H
 
#define FASPSTREAM_C_API
 

Typedefs

typedef struct fasp_stream_client fasp_stream_client_t
 

Functions

FASPSTREAM_C_API int fasp_stream_client_new (char *app_id, fasp_stream_client_t **fsc)
 
FASPSTREAM_C_API int fasp_stream_channel_client_new (char *app_id, fasp_stream_client_t **fsc, fasp_stream_socket_wrapper_t *sock)
 
FASPSTREAM_C_API int fasp_stream_client_cleanup (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API int fasp_stream_client_abort (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API int fasp_stream_client_destroy (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API int fasp_stream_client_connect (fasp_stream_client_t *fsc, char *host)
 
FASPSTREAM_C_API int fasp_stream_client_write (fasp_stream_client_t *fsc, char *buff, size_t len)
 
FASPSTREAM_C_API int fasp_stream_client_read (fasp_stream_client_t *fsc, char *buff, size_t len)
 
FASPSTREAM_C_API int fasp_stream_client_get_max_memory (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_max_memory (fasp_stream_client_t *fsc, int max_mem)
 
FASPSTREAM_C_API int fasp_stream_client_get_udp_port (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_udp_port (fasp_stream_client_t *fsc, int port)
 
FASPSTREAM_C_API int fasp_stream_client_get_port (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_port (fasp_stream_client_t *fsc, int tcp_port)
 
FASPSTREAM_C_API int fasp_stream_client_get_datagram_size (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_datagram_size (fasp_stream_client_t *fsc, int size)
 
FASPSTREAM_C_API int fasp_stream_client_get_chunk_size (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_chunk_size (fasp_stream_client_t *fsc, int size)
 
FASPSTREAM_C_API const char * fasp_stream_client_get_hostname (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_hostname (fasp_stream_client_t *fsc, char *name)
 
FASPSTREAM_C_API int fasp_stream_client_get_rate_target (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_rate_target (fasp_stream_client_t *fsc, int target)
 
FASPSTREAM_C_API int fasp_stream_client_get_cipher_type (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_cipher_type (fasp_stream_client_t *fsc, int type)
 
FASPSTREAM_C_API int fasp_stream_client_is_lock_target (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_lock_target (fasp_stream_client_t *fsc, int target)
 
FASPSTREAM_C_API int fasp_stream_client_get_rate_minimum (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_rate_minimum (fasp_stream_client_t *fsc, int minimum)
 
FASPSTREAM_C_API int fasp_stream_client_is_lock_minimum (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_lock_minimum (fasp_stream_client_t *fsc, int lock_min)
 
FASPSTREAM_C_API int fasp_stream_client_get_policy (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_policy (fasp_stream_client_t *fsc, int new_policy)
 
FASPSTREAM_C_API int fasp_stream_client_is_lock_policy (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_lock_policy (fasp_stream_client_t *fsc, int lock)
 
FASPSTREAM_C_API int fasp_stream_client_get_aggressiveness (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_aggressiveness (fasp_stream_client_t *fsc, int aggressive)
 
FASPSTREAM_C_API const char * fasp_stream_client_get_faspstream_path (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_faspstream_path (fasp_stream_client_t *fsc, char *path)
 
FASPSTREAM_C_API int fasp_stream_client_get_force_send_milliseconds (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_force_send_milliseconds (fasp_stream_client_t *fsc, int milliseconds)
 
FASPSTREAM_C_API void fasp_stream_client_set_transfer_mode (fasp_stream_client_t *fsc, int transfer_mode)
 
FASPSTREAM_C_API int fasp_stream_client_get_transfer_mode (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_private_key_file (fasp_stream_client_t *fsc, char *private_key_file)
 
FASPSTREAM_C_API const char * fasp_stream_client_get_private_key_file (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_ssh_user (fasp_stream_client_t *fsc, char *ssh_user)
 
FASPSTREAM_C_API const char * fasp_stream_client_get_ssh_user (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_log_directory (fasp_stream_client_t *fsc, char *log_directory)
 
FASPSTREAM_C_API const char * fasp_stream_client_get_log_directory (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_command_to_execute (fasp_stream_client_t *fsc, char *command_to_execute)
 
FASPSTREAM_C_API const char * fasp_stream_client_get_command_to_execute (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_set_license (fasp_stream_client_t *fsc, char *license)
 
FASPSTREAM_C_API const char * fasp_stream_client_get_license (fasp_stream_client_t *fsc)
 
FASPSTREAM_C_API void fasp_stream_client_register_log_callback (fasp_stream_client_t *fsc, log_callback_f log_function)
 

Macro Definition Documentation

#define ASPERA_FASP_STREAM_CLIENT_WRAPPER_H
#define FASPSTREAM_C_API

Typedef Documentation

typedef struct fasp_stream_client fasp_stream_client_t

Function Documentation

FASPSTREAM_C_API int fasp_stream_channel_client_new ( char *  app_id,
fasp_stream_client_t **  fsc,
fasp_stream_socket_wrapper_t sock 
)

Wrapper around FaspStreamClient constructor for tunneling.

Parameters
app_idstring id that is unique to this app
fscout parameter for new fasp stream client
sockthe socket to use for tunneling fasp control data
Returns
status, non-zero on error
FASPSTREAM_C_API int fasp_stream_client_abort ( fasp_stream_client_t fsc)

Wrapper around FaspStream abort(). This will kill the faspstream process in case an error has occurred or process is "hung". This is intended to be used in error / exception handling code.

Parameters
fscthe fasp stream client to clean up
Returns
non-zero on failure
FASPSTREAM_C_API int fasp_stream_client_cleanup ( fasp_stream_client_t fsc)

Wrapper around FaspStreamClient clean up. This will reap the faspstream process and ensure it closes properly.

IMPORTANT: Call this before calling destroy. If the faspstream process is still working and destroy is called, it will be killed.

Parameters
fscthe fasp stream client to clean up
Returns
non-zero on failure
FASPSTREAM_C_API int fasp_stream_client_connect ( fasp_stream_client_t fsc,
char *  host 
)

Wrapper around FaspStreamClient::connect.

Parameters
fscfasp stream client
hosthost to connect to
Returns
non-zero on failure
FASPSTREAM_C_API int fasp_stream_client_destroy ( fasp_stream_client_t fsc)

Wrapper around FaspStreamClient destructor.

IMPORTANT: Call cleanup before calling destroy. If the faspstream process is still working and destroy is called, it will be killed.

Parameters
fscthe fasp stream client to destroy / free
Returns
non-zero on failure
FASPSTREAM_C_API int fasp_stream_client_get_aggressiveness ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_chunk_size ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_cipher_type ( fasp_stream_client_t fsc)
FASPSTREAM_C_API const char* fasp_stream_client_get_command_to_execute ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_datagram_size ( fasp_stream_client_t fsc)
FASPSTREAM_C_API const char* fasp_stream_client_get_faspstream_path ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_force_send_milliseconds ( fasp_stream_client_t fsc)
FASPSTREAM_C_API const char* fasp_stream_client_get_hostname ( fasp_stream_client_t fsc)
FASPSTREAM_C_API const char* fasp_stream_client_get_license ( fasp_stream_client_t fsc)
FASPSTREAM_C_API const char* fasp_stream_client_get_log_directory ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_max_memory ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_policy ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_port ( fasp_stream_client_t fsc)
FASPSTREAM_C_API const char* fasp_stream_client_get_private_key_file ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_rate_minimum ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_rate_target ( fasp_stream_client_t fsc)
FASPSTREAM_C_API const char* fasp_stream_client_get_ssh_user ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_transfer_mode ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_get_udp_port ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_is_lock_minimum ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_is_lock_policy ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_is_lock_target ( fasp_stream_client_t fsc)
FASPSTREAM_C_API int fasp_stream_client_new ( char *  app_id,
fasp_stream_client_t **  fsc 
)

Wrapper around FaspStreamClient constructor.

Parameters
app_idstring id that is unique to this app
fscout parameter for new fasp stream client
Returns
status, non-zero on error
FASPSTREAM_C_API int fasp_stream_client_read ( fasp_stream_client_t fsc,
char *  buff,
size_t  len 
)

Wrapper around reading from FaspStreamClient's input stream. The transfer mode must be FASPSTREAM_TRANSFER_TYPE_RECEIVE (fasp_stream_enums.h) - set it with fasp_stream_client_set_transfer_mode). Otherwise, the child fasp stream process won't provide anything for you to read.

Parameters
fscfasp stream client
buffbuffer to receive incoming data
lenlength of buffer
Returns
number of bytes read, zero means EOF, negative means error
FASPSTREAM_C_API void fasp_stream_client_register_log_callback ( fasp_stream_client_t fsc,
log_callback_f  log_function 
)

Function for registering a logging callback

When a new log entry is available the function specified will be called (signature: void return, const char* argument). (Will not log if NULL, as is by default)

Parameters
log_callbackpointer to log function you have implemented

The simplest implementation of the callback might look like this:

static void log_function( char const *s ) {
  fprintf( stderr, "%s\n", s );
}

FASPSTREAM_C_API void fasp_stream_client_set_aggressiveness ( fasp_stream_client_t fsc,
int  aggressive 
)
FASPSTREAM_C_API void fasp_stream_client_set_chunk_size ( fasp_stream_client_t fsc,
int  size 
)
FASPSTREAM_C_API void fasp_stream_client_set_cipher_type ( fasp_stream_client_t fsc,
int  type 
)
FASPSTREAM_C_API void fasp_stream_client_set_command_to_execute ( fasp_stream_client_t fsc,
char *  command_to_execute 
)
FASPSTREAM_C_API void fasp_stream_client_set_datagram_size ( fasp_stream_client_t fsc,
int  size 
)
FASPSTREAM_C_API void fasp_stream_client_set_faspstream_path ( fasp_stream_client_t fsc,
char *  path 
)
FASPSTREAM_C_API void fasp_stream_client_set_force_send_milliseconds ( fasp_stream_client_t fsc,
int  milliseconds 
)
FASPSTREAM_C_API void fasp_stream_client_set_hostname ( fasp_stream_client_t fsc,
char *  name 
)
FASPSTREAM_C_API void fasp_stream_client_set_license ( fasp_stream_client_t fsc,
char *  license 
)
FASPSTREAM_C_API void fasp_stream_client_set_lock_minimum ( fasp_stream_client_t fsc,
int  lock_min 
)
FASPSTREAM_C_API void fasp_stream_client_set_lock_policy ( fasp_stream_client_t fsc,
int  lock 
)
FASPSTREAM_C_API void fasp_stream_client_set_lock_target ( fasp_stream_client_t fsc,
int  target 
)
FASPSTREAM_C_API void fasp_stream_client_set_log_directory ( fasp_stream_client_t fsc,
char *  log_directory 
)
FASPSTREAM_C_API void fasp_stream_client_set_max_memory ( fasp_stream_client_t fsc,
int  max_mem 
)
FASPSTREAM_C_API void fasp_stream_client_set_policy ( fasp_stream_client_t fsc,
int  new_policy 
)
FASPSTREAM_C_API void fasp_stream_client_set_port ( fasp_stream_client_t fsc,
int  tcp_port 
)
FASPSTREAM_C_API void fasp_stream_client_set_private_key_file ( fasp_stream_client_t fsc,
char *  private_key_file 
)
FASPSTREAM_C_API void fasp_stream_client_set_rate_minimum ( fasp_stream_client_t fsc,
int  minimum 
)
FASPSTREAM_C_API void fasp_stream_client_set_rate_target ( fasp_stream_client_t fsc,
int  target 
)
FASPSTREAM_C_API void fasp_stream_client_set_ssh_user ( fasp_stream_client_t fsc,
char *  ssh_user 
)
FASPSTREAM_C_API void fasp_stream_client_set_transfer_mode ( fasp_stream_client_t fsc,
int  transfer_mode 
)
FASPSTREAM_C_API void fasp_stream_client_set_udp_port ( fasp_stream_client_t fsc,
int  port 
)
FASPSTREAM_C_API int fasp_stream_client_write ( fasp_stream_client_t fsc,
char *  buff,
size_t  len 
)

Wrapper around writing to FaspStreamClient's output stream. The transfer mode must be FASPSTREAM_TRANSFER_TYPE_SEND (fasp_stream_enums.h) - set it with fasp_stream_client_set_transfer_mode. Otherwise, the child fasp stream process will ignore what you write. Always writes entire buffer to output stream unless there's an error.

Parameters
fscfasp stream client
buffbuffer to write to output stream
lenlength of buffer
Returns
non-zero on error