TSP: The Transport Sample Protocol



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

tsp_session.c File Reference

#include "tsp_sys_headers.h"
#include "tsp_session.h"
#include "tsp_group_algo.h"
#include "tsp_data_sender.h"
#include "tsp_datapool.h"

Go to the source code of this file.

Functions

void TSP_session_init (void)
 Session initialisation.

void TSP_session_close_session_by_channel (channel_id_t channel_id)
 Close a session.

int TSP_session_get_nb_session (void)
 Get current total number of session.

int TSP_add_session (channel_id_t *new_channel_id, GLU_handle_t glu_h)
 Add a new session.

void TSP_session_destroy_symbols_table_by_channel (channel_id_t channel_id)
 destroy a session.

int TSP_session_create_symbols_table_by_channel (const TSP_request_sample_t *req_sample, TSP_answer_sample_t *ans_sample)
 Calculate the symbol table.

void TSP_session_create_symbols_table_by_channel_free_call (TSP_answer_sample_t *ans_sample)
 Calculate the symbol table.

int TSP_session_get_sample_symbol_info_list_by_channel (channel_id_t channel_id, TSP_sample_symbol_info_list_t *symbol_list)
 Get the whole list of symbols managed by the GLU.

int TSP_session_send_msg_ctrl_by_channel (channel_id_t channel_id, TSP_msg_ctrl_t msg_ctrl)
 Send control message to one client.

int TSP_session_send_data_by_channel (channel_id_t channel_id, time_stamp_t t)
 Send data to one client.

void TSP_session_all_session_send_data (time_stamp_t t)
 Send data to all connected clients.

void TSP_session_all_session_send_msg_ctrl (TSP_msg_ctrl_t msg_ctrl)
 Send control message to all connected clients.

int TSP_session_create_data_sender_by_channel (channel_id_t channel_id, int no_fifo)
 Create the data sender object for a session.

int TSP_session_destroy_data_sender_by_channel (channel_id_t channel_id, int stop_local_thread)
 Destroy the data sender object for a session.

const char * TSP_session_get_data_address_string_by_channel (channel_id_t channel_id)
 Get the address string to which the client must connect to receive data.(format depends on the used protocol ; for TCP/IP it is 'hostname : port').

int TSP_session_is_consumer_connected_by_channel (channel_id_t channel_id)
 Is a consumer already connected for the session ?

int TSP_session_get_symbols_global_index_by_channel (channel_id_t channel_id, TSP_sample_symbol_info_list_t *symbol_list)
 Get the provider global index for a list of symbols.

int TSP_session_get_garbage_session (channel_id_t *channel_id)
 Returns a session that must be destroyed.


Variables

int X_session_nb = 0
 Memorize the highest session in X_session_t.


Detailed Description

Header
/cvsroot/tsp/tsp/src/core/ctrl/tsp_session.c,v 1.18 2004/09/22 14:25:58 tractobob Exp

-----------------------------------------------------------------------

TSP Library - core components for a generic Transport Sampling Protocol.

Copyright (c) 2002 Yves DUFRENNE, Stephane GALLES, Eric NOULARD and Robert PAGNOT

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

-----------------------------------------------------------------------

Project : TSP Maintainer : tsp@astrium-space.com Component : Provider

-----------------------------------------------------------------------

Purpose : Implementation for the object TSP_session_t that embody the opened session from a client

-----------------------------------------------------------------------

Definition in file tsp_session.c.


Function Documentation

int TSP_add_session channel_id_t *  new_channel_id,
GLU_handle_t  glu_h
 

Add a new session.

Parameters:
new_channel_id The created session number
glu_h The GLU handled that will be linked to the session
Returns:
TRUE or FALSE. TRUE = OK.

Definition at line 207 of file tsp_session.c.

References GLU_get_sample_symbol_info_list(), GLU_handle_t, UNDEFINED_CHANNEL_ID, and X_session_nb.

void TSP_session_all_session_send_data time_stamp_t  t  ) 
 

Send data to all connected clients.

Parameters:
t current time stamp sent with the data

Definition at line 399 of file tsp_session.c.

References TSP_data_sender_send(), and X_session_nb.

Referenced by TSP_datapool_push_commit().

void TSP_session_all_session_send_msg_ctrl TSP_msg_ctrl_t  msg_ctrl  ) 
 

Send control message to all connected clients.

Parameters:
msg_ctrl Control message to that must be sent

Definition at line 427 of file tsp_session.c.

References TSP_data_sender_send_msg_ctrl(), and X_session_nb.

Referenced by TSP_datapool_push_commit().

void TSP_session_close_session_by_channel channel_id_t  channel_id  ) 
 

Close a session.

Parameters:
channed_id The channel id that must be close

Definition at line 185 of file tsp_session.c.

int TSP_session_create_data_sender_by_channel channel_id_t  channel_id,
int  no_fifo
 

Create the data sender object for a session.

Parameters:
channel_id The session id for which the data sender must be created.
no_fifo If no_fifo = FALSE, the data sender is created with a ringbuf and a thread to send the data
Returns:
TRUE or FALSE. TRUE = OK

Definition at line 452 of file tsp_session.c.

References GLU_get_base_frequency(), TSP_data_sender_create(), TSP_group_algo_get_biggest_group_size(), and TSP_STREAM_SENDER_RINGBUF_SIZE.

int TSP_session_create_symbols_table_by_channel const TSP_request_sample_t *  req_sample,
TSP_answer_sample_t *  ans_sample
 

Calculate the symbol table.

FIXME : remove thoses RPC struct for this function

Parameters:
req_sample The symbols list
ans_sample The computed answer
Returns:
TRUE or FALSE. TRUE = OK.

Definition at line 275 of file tsp_session.c.

References TSP_global_datapool_get_instance(), TSP_group_algo_create_symbols_table(), and TSP_group_algo_get_group_number().

void TSP_session_create_symbols_table_by_channel_free_call TSP_answer_sample_t *  ans_sample  ) 
 

Calculate the symbol table.

FIXME : remove thoses RPC struct for this function

Parameters:
ans_sample The computed answer
Returns:
TRUE or FALSE. TRUE = OK.

Definition at line 316 of file tsp_session.c.

References TSP_group_algo_create_symbols_table_free_call().

int TSP_session_destroy_data_sender_by_channel channel_id_t  channel_id,
int  stop_local_thread
 

Destroy the data sender object for a session.

Parameters:
channel_id The session id for which the data sender must be destroyed.
stop_local_thread If TRUE, when the function wait for the ringbuf thread to stop
Returns:
TRUE or FALSE. TRUE = OK

Definition at line 525 of file tsp_session.c.

References TSP_data_sender_destroy(), and TSP_data_sender_stop().

void TSP_session_destroy_symbols_table_by_channel channel_id_t  channel_id  ) 
 

destroy a session.

Parameters:
channed_id The channel id that must be destroyed

Definition at line 261 of file tsp_session.c.

const char* TSP_session_get_data_address_string_by_channel channel_id_t  channel_id  ) 
 

Get the address string to which the client must connect to receive data.(format depends on the used protocol ; for TCP/IP it is 'hostname : port').

Parameters:
channel_id The session id matching the asked adresse
Returns:
data address. An error return 0;

Definition at line 553 of file tsp_session.c.

References TSP_data_sender_get_data_address_string().

int TSP_session_get_garbage_session channel_id_t *  channel_id  ) 
 

Returns a session that must be destroyed.

For each call this function returns a channel_id for which the session must be destoyed (ex : consumer disconnected)

Parameters:
channel_id The session that must be destroyed
Returns:
FALSE = there isn't any session that must be destroyed

Definition at line 642 of file tsp_session.c.

References X_session_nb.

int TSP_session_get_nb_session void   ) 
 

Get current total number of session.

Returns:
Total number of session

Definition at line 194 of file tsp_session.c.

References X_session_nb.

int TSP_session_get_sample_symbol_info_list_by_channel channel_id_t  channel_id,
TSP_sample_symbol_info_list_t *  symbol_list
 

Get the whole list of symbols managed by the GLU.

Parameters:
channel_id The session id for the list must be known
symbol_list The GLU symbol list for this session
Returns:
TRUE or FALSE. TRUE = OK

Definition at line 321 of file tsp_session.c.

References GLU_get_sample_symbol_info_list().

int TSP_session_get_symbols_global_index_by_channel channel_id_t  channel_id,
TSP_sample_symbol_info_list_t *  symbol_list
 

Get the provider global index for a list of symbols.

The each symbol will be recongnized with its string name, and the provider global id will be set in the symbol structure

Parameters:
channel_id The session id
symbol_list The list of symbol that must be updated
Returns:
TRUE or FALSE. TRUE = OK

Definition at line 593 of file tsp_session.c.

References GLU_get_sample_symbol_info_list().

void TSP_session_init void   ) 
 

Session initialisation.

Definition at line 174 of file tsp_session.c.

int TSP_session_is_consumer_connected_by_channel channel_id_t  channel_id  ) 
 

Is a consumer already connected for the session ?

Returns:
TRUE or FALSE. TRUE = A consumer is connected

Definition at line 576 of file tsp_session.c.

References TSP_data_sender_is_consumer_connected().

int TSP_session_send_data_by_channel channel_id_t  channel_id,
time_stamp_t  t
 

Send data to one client.

Parameters:
channel_id Session id for this client
t current time stamp sent with the data
Returns:
TRUE or FALSE. TRUE = OK

Definition at line 368 of file tsp_session.c.

References TSP_data_sender_send().

int TSP_session_send_msg_ctrl_by_channel channel_id_t  channel_id,
TSP_msg_ctrl_t  msg_ctrl
 

Send control message to one client.

Parameters:
channel_id Session id for this client
msg_ctrl Control message to that must be sent
Returns:
TRUE or FALSE. TRUE = OK

Definition at line 340 of file tsp_session.c.

References TSP_data_sender_send_msg_ctrl().


Variable Documentation

int X_session_nb = 0
 

Memorize the highest session in X_session_t.

Definition at line 99 of file tsp_session.c.

Referenced by TSP_add_session(), TSP_session_all_session_send_data(), TSP_session_all_session_send_msg_ctrl(), TSP_session_get_garbage_session(), and TSP_session_get_nb_session().

Framework Home Page.


Beware !! TSP wave is coming...