Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_TransIP.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_TRANS_IP_
00021 #define _C_TRANS_IP_
00022 
00023 #define NO_TRANS_IP_CONTEXT 0L
00024 
00025 #include <sys/time.h>
00026 
00027 #include "list_t.hpp"
00028 #include "C_Transport.hpp"
00029 #include "S_IpAddr.hpp"
00030 
00031 #include "C_Socket.hpp"
00032 #include "C_ProtocolBinaryFrame.hpp"
00033 
00034 class C_TransIP : public C_Transport {
00035 
00036 public:
00037 
00038    C_TransIP ();
00039   virtual ~C_TransIP ();
00040 
00041   virtual int init (char *P_buf,
00042                     T_logFunction P_logError,
00043                     T_logFunction P_logInfo) ;
00044 
00045   virtual int         config (T_pConfigValueList P_config_param_list) ;
00046 
00047   int         open (int              P_channel_id,
00048                     char            *P_buf, 
00049                     T_pOpenStatus    P_status,
00050                     C_ProtocolFrame *P_protocol);
00051   
00052   int         pre_select (int             P_n, 
00053                           fd_set         *P_readfds,  
00054                           fd_set         *P_writefds,
00055                           fd_set         *P_exceptfds, 
00056                           struct timeval *P_timeout, 
00057                           int            *P_cnx, 
00058                           size_t          P_nb) ;
00059 
00060   int         post_select (int                 P_n, 
00061                            fd_set             *P_readfds,  
00062                            fd_set             *P_writefds,
00063                            fd_set             *P_exceptfds, 
00064                            T_pC_TransportEvent P_eventTable,
00065                            size_t             *P_nb);
00066 
00067   int         send_message    (int             P_id,
00068                                C_MessageFrame *P_msg);
00069 
00070   bool        get_message (int P_id, T_pReceiveMsgContext P_ctxt) ;
00071 
00072   int         set_channel_id (int P_id, int P_channel_id);
00073   
00074   int         close (); 
00075   int         close (int P_id);
00076   
00077   T_SelectDef select_definition () ;
00078 
00079 protected:
00080 
00081   T_SocketType    m_trans_type ;
00082   T_SocketMap     m_socket_map ;
00083 
00084   int             m_max_fd     ;
00085   
00086   T_IpAddrMap     m_ip_addr_map ;
00087 
00088   virtual bool      analyze_init_string (char *P_buf) ;
00089   void              analyze_optional_init_string (char *P_buf) ;
00090   bool              analyze_open_string (char *P_buf, T_pIpAddr P_addr) ;
00091   virtual C_Socket* open              (int              P_channel_id, 
00092                                        T_pIpAddr        P_Addr,
00093                                        T_pOpenStatus    P_status,
00094                                        C_ProtocolBinaryFrame *P_protocol) ;
00095   int               extract_ip_addr(T_pIpAddr P_pIpAddr);
00096   int               resolve_addr(T_pIpAddr P_pIpAddr);
00097   int               inet_addr   (char                   **P_addr, 
00098                                  T_SockAddrStorage       *P_AddrS);
00099 
00100   void              decode_from_protocol (C_Socket *P_socket);
00101 
00102   bool              analyze_ulong_value (char* P_buf, 
00103                                          char* P_pattern,
00104                                          size_t* P_value);
00105 
00106   bool              analyze_string_value (char* P_buf, 
00107                                           char* P_pattern,
00108                                           char* P_value);
00109   
00110   size_t                        m_buffer_size ;
00111 
00112   size_t                        m_encode_buffer_size, 
00113                                 m_decode_buffer_size, 
00114                                 m_read_buffer_size ;
00115   unsigned char                *m_encode_buffer, 
00116                                *m_decode_buffer ;
00117 
00118   list_t<T_SocketMap::iterator> m_delete_list ;
00119   list_t<C_Socket *>            m_insert_list ;
00120 
00121   T_logFunction                 m_logError, 
00122                                 m_logInfo ;
00123 
00124 } ;
00125 
00126 typedef C_TransIP *T_pC_TransIP ;
00127 
00128 extern "C" T_pTransport create_cipio_instance () ;
00129 extern "C" void         delete_cipio_instance (T_ppTransport) ;
00130 
00131 #endif // _C_TRANS_IP_

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