|
reSIProcate/repro
9694
|
00001 #if defined(HAVE_CONFIG_H) 00002 #include "config.h" 00003 #endif 00004 00005 #include "repro/Registrar.hxx" 00006 #include "resip/dum/ServerRegistration.hxx" 00007 #include "rutil/Logger.hxx" 00008 00009 #define RESIPROCATE_SUBSYSTEM resip::Subsystem::REPRO 00010 00011 using namespace resip; 00012 using namespace repro; 00013 using namespace std; 00014 00015 Registrar::Registrar() 00016 { 00017 } 00018 00019 Registrar::~Registrar() 00020 { 00021 } 00022 00023 void 00024 Registrar::addRegistrarHandler(RegistrarHandler* handler) 00025 { 00026 mRegistrarHandlers.push_back(handler); 00027 } 00028 00029 void 00030 Registrar::onRefresh(resip::ServerRegistrationHandle sr, 00031 const resip::SipMessage& reg) 00032 { 00033 DebugLog (<< "Registrar::onRefresh " << reg.brief()); 00034 std::list<RegistrarHandler*>::iterator it = mRegistrarHandlers.begin(); 00035 bool continueProcessing = true; 00036 for(; it != mRegistrarHandlers.end() && continueProcessing; it++) 00037 { 00038 continueProcessing = (*it)->onRefresh(sr, reg); 00039 } 00040 if(continueProcessing) 00041 { 00042 sr->accept(); 00043 } 00044 } 00045 00046 void 00047 Registrar::onRemove(resip::ServerRegistrationHandle sr, 00048 const resip::SipMessage& reg) 00049 { 00050 DebugLog (<< "Registrar::onRemove " << reg.brief()); 00051 std::list<RegistrarHandler*>::iterator it = mRegistrarHandlers.begin(); 00052 bool continueProcessing = true; 00053 for(; it != mRegistrarHandlers.end() && continueProcessing; it++) 00054 { 00055 continueProcessing = (*it)->onRemove(sr, reg); 00056 } 00057 if(continueProcessing) 00058 { 00059 sr->accept(); 00060 } 00061 } 00062 00063 void 00064 Registrar::onRemoveAll(resip::ServerRegistrationHandle sr, 00065 const resip::SipMessage& reg) 00066 { 00067 DebugLog (<< "Registrar::onRemoveAll " << reg.brief()); 00068 std::list<RegistrarHandler*>::iterator it = mRegistrarHandlers.begin(); 00069 bool continueProcessing = true; 00070 for(; it != mRegistrarHandlers.end() && continueProcessing; it++) 00071 { 00072 continueProcessing = (*it)->onRemoveAll(sr, reg); 00073 } 00074 if(continueProcessing) 00075 { 00076 sr->accept(); 00077 } 00078 } 00079 00080 void 00081 Registrar::onAdd(resip::ServerRegistrationHandle sr, 00082 const resip::SipMessage& reg) 00083 { 00084 DebugLog (<< "Registrar::onAdd " << reg.brief()); 00085 std::list<RegistrarHandler*>::iterator it = mRegistrarHandlers.begin(); 00086 bool continueProcessing = true; 00087 for(; it != mRegistrarHandlers.end() && continueProcessing; it++) 00088 { 00089 continueProcessing = (*it)->onAdd(sr, reg); 00090 } 00091 if(continueProcessing) 00092 { 00093 sr->accept(); 00094 } 00095 } 00096 00097 void 00098 Registrar::onQuery(resip::ServerRegistrationHandle sr, 00099 const resip::SipMessage& reg) 00100 { 00101 std::list<RegistrarHandler*>::iterator it = mRegistrarHandlers.begin(); 00102 bool continueProcessing = true; 00103 for(; it != mRegistrarHandlers.end() && continueProcessing; it++) 00104 { 00105 continueProcessing = (*it)->onQuery(sr, reg); 00106 } 00107 if(continueProcessing) 00108 { 00109 sr->accept(); 00110 } 00111 } 00112 00113 /* ==================================================================== 00114 * The Vovida Software License, Version 1.0 00115 * 00116 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00117 * 00118 * Redistribution and use in source and binary forms, with or without 00119 * modification, are permitted provided that the following conditions 00120 * are met: 00121 * 00122 * 1. Redistributions of source code must retain the above copyright 00123 * notice, this list of conditions and the following disclaimer. 00124 * 00125 * 2. Redistributions in binary form must reproduce the above copyright 00126 * notice, this list of conditions and the following disclaimer in 00127 * the documentation and/or other materials provided with the 00128 * distribution. 00129 * 00130 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00131 * and "Vovida Open Communication Application Library (VOCAL)" must 00132 * not be used to endorse or promote products derived from this 00133 * software without prior written permission. For written 00134 * permission, please contact vocal@vovida.org. 00135 * 00136 * 4. Products derived from this software may not be called "VOCAL", nor 00137 * may "VOCAL" appear in their name, without prior written 00138 * permission of Vovida Networks, Inc. 00139 * 00140 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00141 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00142 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00143 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00144 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00145 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00146 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00147 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00148 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00149 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00150 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00151 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00152 * DAMAGE. 00153 * 00154 * ==================================================================== 00155 * 00156 * This software consists of voluntary contributions made by Vovida 00157 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00158 * Inc. For more information on Vovida Networks, Inc., please see 00159 * <http://www.vovida.org/>. 00160 * 00161 */
1.7.5.1