TSP: The Transport Sample Protocol



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

tsp_request.h

Go to the documentation of this file.
00001 
00038 #ifndef _TSP_REQUEST_H
00039 #define _TSP_REQUEST_H
00040 
00041 #include "tsp_prjcfg.h"
00042 #include "tsp_sys_headers.h"
00043 
00068 struct TSP_provider_request_handler_t;
00069 typedef int   (* tsp_request_handler_config_ft)(struct TSP_provider_request_handler_t*);
00070 typedef void* (* tsp_request_handler_run_ft)   (struct TSP_provider_request_handler_t*);
00071 typedef int   (* tsp_request_handler_stop_ft)  (struct TSP_provider_request_handler_t*);
00072 typedef char* (* tsp_request_handler_url_ft)   (struct TSP_provider_request_handler_t*);
00076 enum TSP_request_handler_status_t
00077 {
00083   TSP_RQH_STATUS_NOTINSTALLED=0,
00085   TSP_RQH_STATUS_IDLE,
00087   TSP_RQH_STATUS_CONFIGURED,
00089   TSP_RQH_STATUS_RUNNING,
00091   TSP_RQH_STATUS_STOPPED
00092 };
00093 typedef enum TSP_request_handler_status_t TSP_request_handler_status_t;
00094 
00101 struct TSP_provider_request_handler_t {
00102 
00103   pthread_t tid;          
00104   int status;             
00106   void* config_param;     
00108   tsp_request_handler_config_ft  config; 
00110   tsp_request_handler_run_ft     run;    
00111   tsp_request_handler_stop_ft    stop;   
00113   tsp_request_handler_url_ft     url;    
00114 };
00115 
00116 typedef struct TSP_provider_request_handler_t TSP_provider_request_handler_t;
00117 typedef int   (* tsp_request_handler_ft)       (TSP_provider_request_handler_t*);
00118 
00123 struct rqh_manager_data_t {
00124 
00125   pthread_cond_t cond;    
00128   pthread_mutex_t mutex;   
00129   int             nb_running_rhq; 
00130   TSP_provider_request_handler_t request_handlers[TSP_MAX_REQUEST_HANDLERS];
00131 };
00132 
00133 typedef struct rqh_manager_data_t rqh_manager_data_t;
00134 
00135 /* Don't forget to statically initialize the structure */
00136 static rqh_manager_data_t rqh_manager_if;
00137                                           
00138 
00143 int TSP_provider_rqh_manager_get_max_nb(void);
00144 
00149 int TSP_provider_rqh_manager_get_nb(void);
00150 
00155 int TSP_provider_rqh_manager_get_nb_running(void);
00156 
00162 TSP_provider_request_handler_t* TSP_provider_rqh_manager_get(int rank);
00163 
00169 char* TSP_provider_rqh_manager_get_url(int rank);
00170 
00175 int TSP_provider_rqh_manager_install(int rank, tsp_request_handler_ft rqh_constructor);
00176 
00181 int TSP_provider_rqh_manager_init(void);
00182 
00189 int TSP_provider_rqh_manager_refresh(void);
00190 
00196 void TSP_provider_rqh_manager_waitend(void);
00197 
00200 #endif /* _TSP_REQUEST_H */
Framework Home Page.

Beware !! TSP wave is coming...