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_PROTOCOLCONTROL_H 00021 #define _C_PROTOCOLCONTROL_H 00022 00023 #include "string_t.hpp" 00024 #include "map_t.hpp" 00025 00026 #include "C_IdGenerator.hpp" 00027 #include "C_XmlData.hpp" 00028 #include "C_ProtocolFrame.hpp" 00029 00030 #include "C_TransportControl.hpp" 00031 00032 #include "C_GeneratorConfig.hpp" 00033 #include "C_ProtocolStats.hpp" 00034 00035 00036 #define ERROR_PROTOCOL_UNKNOWN -1 00037 typedef map_t<string_t, int> T_ProtocolNameMap, *T_pProtocolNameMap ; 00038 00039 typedef struct _protocol_instance_info { 00040 C_ProtocolFrame *m_instance ; 00041 int m_id ; 00042 char *m_name ; 00043 } T_ProtocolInstanceInfo, *T_pProtocolInstanceInfo ; 00044 typedef list_t<T_pProtocolInstanceInfo> T_ProtocolInstList ; 00045 00046 class C_ProtocolControl { 00047 00048 public: 00049 C_ProtocolControl(C_TransportControl *P_transport_control) ; 00050 ~C_ProtocolControl() ; 00051 00052 bool fromXml (C_XmlData *P_data, 00053 T_pConfigValueList P_config_value_list, 00054 bool P_display_protocol_stats) ; 00055 00056 00057 C_ProtocolFrame* get_protocol (char *P_name); 00058 C_ProtocolFrame* get_protocol (int P_id); 00059 char* get_protocol_name (int P_id); 00060 int get_protocol_id (char *P_name); 00061 00062 int get_nb_protocol (); 00063 00064 00065 00066 protected: 00067 private: 00068 00069 T_pProtocolNameMap m_name_map ; 00070 T_pC_ProtocolFrame *m_protocol_table ; 00071 char **m_protocol_name_table ; 00072 int m_protocol_table_size ; 00073 T_pC_IdGenerator m_id_gen ; 00074 00075 C_TransportControl *m_transport_control ; 00076 00077 // internal methods 00078 char* get_protocol_name(C_XmlData *); 00079 char* get_protocol_type(C_XmlData *); 00080 00081 00082 } ; 00083 00084 #endif 00085 00086 00087 00088 00089 00090 00091