Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_Transport.hpp

00001 /*
00002  *  This program is free software; you can redistribute it and/or modify
00003  *  it under the terms of the GNU General Public License as published by
00004  *  the Free Software Foundation; either version 2 of the License, or
00005  *  (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  *
00016  * (c)Copyright 2006 Hewlett-Packard Development Company, LP.
00017  *
00018  */
00019 
00020 #ifndef _C_TRANSPORT_
00021 #define _C_TRANSPORT_
00022 
00023 #include "select_t.hpp"
00024 #include "iostream_t.hpp"
00025 
00026 #include "C_ProtocolFrame.hpp"
00027 #include "C_TransportEvent.hpp"
00028 #include "ReceiveMsgContext.h"
00029 #include "T_ConfigValue.h"
00030 
00031 typedef enum _open_status {
00032   E_OPEN_OK = 0,
00033   E_OPEN_DELAYED,
00034   E_OPEN_FAILED
00035 } T_OpenStatus, *T_pOpenStatus ;
00036 
00037 typedef void (*T_logFunction)(char*);
00038 
00039 
00040 class C_Transport {
00041 
00042 public:
00043 
00044            C_Transport () {} ;
00045   virtual ~C_Transport () {} ;
00046 
00047   virtual int init (char* P_buf, 
00048                     T_logFunction P_logError, 
00049                     T_logFunction P_logInfo) = 0 ;
00050 
00051   virtual int config (T_pConfigValueList P_config_param_list) = 0 ;
00052   virtual int close () = 0 ;
00053 
00054   virtual int open (int              P_channel_id,
00055                     char*            P_buf, 
00056                     T_pOpenStatus    P_status,
00057                     C_ProtocolFrame *P_protocol) = 0 ;
00058   virtual int close (int P_id) = 0 ;
00059 
00060   virtual int         pre_select (int                   P_n, 
00061                                   fd_set               *P_readfds,  
00062                                   fd_set               *P_writefds,
00063                                   fd_set               *P_exceptfds, 
00064                                   struct timeval       *P_timeout, 
00065                                   int                  *P_cnx, 
00066                                   size_t                P_nb) = 0 ;
00067 
00068 
00069   virtual int             post_select     (int                  P_n, 
00070                                            fd_set              *P_readfds,  
00071                                            fd_set              *P_writefds,
00072                                            fd_set              *P_exceptfds, 
00073                                            T_pC_TransportEvent  P_eventTable,
00074                                            size_t              *P_nb) = 0 ;
00075   
00076   virtual bool            get_message(int P_id, T_pReceiveMsgContext P_ctxt) = 0 ;
00077   virtual int             send_message(int P_id, C_MessageFrame *P_msg) = 0 ;
00078 
00079   virtual int             set_option (int P_Channel_Id, char *P_buf) {return (0);} ;
00080   //  virtual int             set_context (int P_id, void *P_context) = 0 ;
00081   virtual T_SelectDef     select_definition () = 0;
00082 
00083 } ;
00084 
00085 typedef C_Transport  *T_pTransport ;
00086 typedef T_pTransport *T_ppTransport ;
00087 
00088 // transport creation related generic functions / structures
00089 typedef T_pTransport (*T_TransportCreateInstance) (void) ;
00090 typedef void         (*T_TransportDeleteInstance) (T_ppTransport) ;
00091 
00092 typedef struct _trans_struct {
00093   T_TransportCreateInstance m_create ;
00094   T_TransportDeleteInstance m_delete ;
00095 } T_ExternalTransportDef, *T_pExternalTransportDef ;
00096 
00097 
00098 #endif // _C_TRANSPORT__
00099 

Generated on Wed Mar 7 14:44:59 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002