C_ProtocolFrame.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_PROTOCOLFRAME_H
00021 #define    _C_PROTOCOLFRAME_H
00022 
00023 #include "C_MessageFrame.hpp"
00024 #include "list_t.hpp"
00025 #include "ExternalMethod.h"
00026 #include "ParamDefConfig.h"
00027 
00028 
00029 class C_ProtocolStatsFrame ;
00030 
00031 typedef struct _struct_inst_data {
00032   char *m_instance_name  ;
00033   int   m_instance_id    ;
00034   int   m_id             ;
00035 } T_InstanceData, *T_pInstanceData ;
00036 
00037 typedef list_t<T_InstanceData> T_InstanceDataList, 
00038   *T_pInstanceDataList ;
00039 
00040 typedef struct _struct_name_id {
00041   char *m_name;
00042   int   m_id  ;
00043 } T_NameAndId, *T_pNameAndId ;
00044 typedef list_t<T_NameAndId> T_NameAndIdList, *T_pNameAndIdList ;
00045 
00049 class C_ProtocolFrame { // Protocol Frame Definition Class
00050 
00051 public:
00052 
00053 
00055   typedef enum _protocol_type {
00056     E_PROTOCOL_BINARY, 
00057     E_PROTOCOL_EXTERNAL, 
00058     E_PROTOCOL_TEXT, 
00059     E_PROTOCOL_UNKNOWN 
00060   } T_ProtocolType, *T_pProtocolType ;
00061 
00063   typedef enum _msg_error_code {
00064     E_MSG_OK = 0,
00065     E_MSG_ERROR_DECODING, 
00066     E_MSG_ERROR_DECODING_SIZE_LESS, 
00067     E_MSG_ERROR_ENCODING, 
00068     E_MSG_EXTERNAL_ERROR, 
00069     E_MSG_INTERNAL_ERROR  
00070   } T_MsgError, *T_pMsgError ;
00071 
00072 
00073            C_ProtocolFrame() {m_type = E_PROTOCOL_UNKNOWN; m_name=NULL; m_stats = NULL;} ;
00074   virtual ~C_ProtocolFrame() {} ;
00075 
00077   T_ProtocolType get_type() { return (m_type); }
00078 
00080   virtual C_MessageFrame* create_new_message (C_MessageFrame *P_msg) = 0 ;
00081 
00082   // void * for P_Xml parameter: 
00083   //     Xml internal format not exported for transport  
00085   virtual C_MessageFrame* create_new_message (void               *P_xml,
00086                                               T_pInstanceDataList P_list,
00087                                               int                *P_nb_body_value) = 0 ;
00088 
00089   virtual char*            message_name                 () = 0 ;
00090   virtual char*            message_component_name       () = 0 ;
00091   virtual T_pNameAndIdList message_name_list            () = 0 ;
00092   virtual T_pNameAndIdList message_component_name_list  () = 0 ;
00093   virtual bool             find_present_session (int P_msg_id,int P_id) = 0 ;
00094 
00095 
00096 
00097   // find field id from field name (to be used in the dictionnary)
00098   virtual int              find_field (char *P_name)          = 0 ;
00099   virtual T_TypeType       get_field_type (int P_id,
00100                                            int P_sub_id)      = 0 ;
00101   virtual bool             check_sub_entity_needed (int P_id) = 0 ;
00102 
00103   C_ProtocolStatsFrame*    get_stats () { return (m_stats); }
00104   void                     set_stats (C_ProtocolStatsFrame *P_stats) {
00105     m_stats = P_stats ;
00106   }
00107 
00108   virtual T_ExternalMethod find_method_extern(char *P_name){return NULL;} 
00109 
00110 
00111   char* name() { return(m_name); }
00112 
00113 protected:
00114 
00115   C_ProtocolStatsFrame *m_stats ;
00116   T_ProtocolType        m_type ;
00117   char                 *m_name ;
00118 
00119 } ;
00120 
00121 typedef C_ProtocolFrame *T_pC_ProtocolFrame ;
00122 
00123 
00124 #endif  // _C_PROTOCOLFRAME_H
00125 
00126 
00127 
00128 

Generated on Wed Mar 7 14:57:52 2007 for Seagull by  doxygen 1.4.6