TSP: The Transport Sample Protocol



Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Ascii_Writer
[TSP_Consumers]

A TSP ascii writer consumer. More...

Functions

int32_t tsp_ascii_writer_initialise (int *argc, char **argv[])
 Initialise ascii TSP consumer.

int32_t tsp_ascii_writer_load_config (const char *conffilename, TSP_consumer_symbol_requested_t **tsp_symbols, int32_t *nb_symbols)
 Load a configuration file and build the array of of requested symbol in config file.

int32_t tsp_ascii_writer_validate_symbols (TSP_consumer_symbol_requested_t *tsp_symbols, int32_t nb_symbols, const char *tsp_provider_hostname, TSP_consumer_symbol_requested_list_t *tsp_symbol_list)
 Validate the requested symbol against the TSP provider located on tsp_provider_hostname.

int32_t tsp_ascii_writer_start (FILE *sfile, int32_t nb_sample_max_infile)
 Start TSP data receive and archive.

void * tsp_ascii_writer_thread (void *sfile)
 Function to be used with pthread_create(3).

int32_t tsp_ascii_writer_stop ()
 Stop data archiving.

int32_t tsp_ascii_writer_finalise ()
 Finalise TSP consumer.


Detailed Description

A TSP ascii writer consumer.


Function Documentation

int32_t tsp_ascii_writer_finalise  ) 
 

Finalise TSP consumer.

Returns:
0 if OK -1 otherwise.

Definition at line 470 of file tsp_ascii_writer.c.

References TSP_consumer_end(), and TSP_consumer_request_sample_destroy().

int32_t tsp_ascii_writer_initialise int *  argc,
char **  argv[]
 

Initialise ascii TSP consumer.

We must pass main arguments to TSP lib for specific TSP arg handling. Parameter unknown to TSP are unchanged on return.

Parameters:
argc The main 'argc' argument
argv The main 'argv' argument
Returns:
0 if init OK -1 otherwise.

Definition at line 72 of file tsp_ascii_writer.c.

References TSP_consumer_init().

int32_t tsp_ascii_writer_load_config const char *  conffilename,
TSP_consumer_symbol_requested_t **  tsp_symbols,
int32_t *  nb_symbols
 

Load a configuration file and build the array of of requested symbol in config file.

Parameters:
conffilename IN, the name of the config file.
tsp_symbols OUT, pointer to the array of symbols found in config file. the array is allocated by the function.
nb_symbols OUT, the number of symbols found in file
Returns:
0 if config file loaded properly (no syntax error) -1 otherwise.

Definition at line 183 of file tsp_ascii_writer.c.

int32_t tsp_ascii_writer_start FILE *  sfile,
int32_t  nb_sample_max_infile
 

Start TSP data receive and archive.

Should have called tsp_ascii_writer_validate_symbols first.

Parameters:
sfile IN, the stream file used for data saving.
nb_sample_max_infile IN, the maximum number of sample stored in the file if 0<= then no limit, if >0 then when about to save the nb_sample_max_infile-th sample we rewind the file.
Returns:
0 OK -1 otherwise.

Definition at line 359 of file tsp_ascii_writer.c.

References TSP_consumer_get_requested_sample(), TSP_consumer_read_sample(), TSP_consumer_request_sample_init(), and TSP_sample_t::user_value.

Referenced by tsp_ascii_writer_thread().

int32_t tsp_ascii_writer_stop  ) 
 

Stop data archiving.

Returns:
0 if OK -1 otherwise.

Definition at line 457 of file tsp_ascii_writer.c.

void* tsp_ascii_writer_thread void *  sfile  ) 
 

Function to be used with pthread_create(3).

Parameters:
sfile pointer to an opened stdio file stream (FILE*).
Returns:
0 if OK -1 otherwise.

Definition at line 448 of file tsp_ascii_writer.c.

References tsp_ascii_writer_start().

int32_t tsp_ascii_writer_validate_symbols TSP_consumer_symbol_requested_t tsp_symbols,
int32_t  nb_symbols,
const char *  tsp_provider_hostname,
TSP_consumer_symbol_requested_list_t *  tsp_symbol_list
 

Validate the requested symbol against the TSP provider located on tsp_provider_hostname.

If symbol name match an array symbol all element aoff the array are requested.

Parameters:
tsp_symbols IN/OUT, array of symbols to be validated.
nb_symbols IN, the size of the tsp_symbols array.
tsp_provider_hostname IN, TSP provider hostname used for validating symbols.
tsp_symbol_list TSP IN/OUT, TSP validated symbol list.
Returns:
0 OK -1 otherwise.

Definition at line 228 of file tsp_ascii_writer.c.

References TSP_consumer_symbol_requested_t::period, TSP_consumer_symbol_requested_t::phase, TSP_consumer_information_t::symbols, TSP_consumer_connect_url(), TSP_consumer_get_connected_name(), TSP_consumer_get_information(), TSP_consumer_request_information(), TSP_consumer_request_open(), TSP_consumer_request_sample(), and TSP_provider_t.

Framework Home Page.


Beware !! TSP wave is coming...