00001 /* BEGIN_COPYRIGHT */ 00002 /* */ 00003 /* Open Diameter: Open-source software for the Diameter and */ 00004 /* Diameter related protocols */ 00005 /* */ 00006 /* Copyright (C) 2002-2004 Open Diameter Project */ 00007 /* */ 00008 /* This library is free software; you can redistribute it and/or modify */ 00009 /* it under the terms of the GNU Lesser General Public License as */ 00010 /* published by the Free Software Foundation; either version 2.1 of the */ 00011 /* License, or (at your option) any later version. */ 00012 /* */ 00013 /* This library is distributed in the hope that it will be useful, */ 00014 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 00015 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ 00016 /* Lesser General Public License for more details. */ 00017 /* */ 00018 /* You should have received a copy of the GNU Lesser General Public */ 00019 /* License along with this library; if not, write to the Free Software */ 00020 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 */ 00021 /* USA. */ 00022 /* */ 00023 /* In addition, when you copy and redistribute some or the entire part of */ 00024 /* the source code of this software with or without modification, you */ 00025 /* MUST include this copyright notice in each copy. */ 00026 /* */ 00027 /* If you make any changes that are appeared to be useful, please send */ 00028 /* sources that include the changed part to */ 00029 /* diameter-developers@lists.sourceforge.net so that we can reflect your */ 00030 /* changes to one unified version of this software. */ 00031 /* */ 00032 /* END_COPYRIGHT */ 00033 00034 #include "pana_node.h" 00035 #include "pana_config_manager.h" 00036 #include "pana_message.h" 00037 00041 typedef enum { 00042 PANA_AVP_MAC, 00043 PANA_AVP_DEVICE 00044 } PANA_AVPDataType; 00045 00046 void PANA_Node::Start(std::string &cfg_file) 00047 { 00048 PANA_CONFIG_OPEN(cfg_file); 00049 00050 // TBD: temporary protection against re-entrancy into parser 00051 static bool bAlreadyLoaded = false; 00052 if (bAlreadyLoaded) { 00053 return; 00054 } 00055 bAlreadyLoaded = true; 00056 00057 AAADictionaryManager dm; 00058 00059 // Registering AVP types and AVP value parsers. 00060 static AvpValueParserCreator<PANA_TVDataParser> deviceIdParserCreator; 00061 00062 static AvpValueParserCreator<PANA_TVDataParser> macParserCreator; 00063 00064 static AvpContainerEntryCreator<AAATVDataAvpContainerEntry> deviceIdContainerEntryCreator; 00065 00066 static AvpContainerEntryCreator<AAATVDataAvpContainerEntry> macContainerEntryCreator; 00067 00068 AvpTypeList::instance()->add(new AvpType("DeviceId", (AAA_AVPDataType)AAA_AVP_DEVICEID_TYPE, 0, 00069 deviceIdParserCreator, deviceIdContainerEntryCreator)); 00070 00071 AvpTypeList::instance()->add(new AvpType("Mac", (AAA_AVPDataType)AAA_AVP_MAC_TYPE, 0, 00072 macParserCreator, macContainerEntryCreator)); 00073 00074 dm.init((char*)PANA_CONFIG_GENERAL().dictionary_fname_.c_str()); 00075 } 00076 00077 void PANA_Node::Stop() 00078 { 00079 PANA_CONFIG_CLOSE(); 00080 } 00081 00082 00083 00084 00085 00086