1 /* 2 * Copyright (C) 2012 FRAFOS GmbH 3 * 4 * Development sponsored by Sipwise GmbH. 5 * 6 * This file is part of SEMS, a free SIP media server. 7 * 8 * SEMS is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. This program is released under 12 * the GPL with the additional exemption that compiling, linking, 13 * and/or using OpenSSL is allowed. 14 * 15 * For a license to use the SEMS software under conditions 16 * other than those described here, or to purchase support for this 17 * software, please contact iptel.org by e-mail at the following addresses: 18 * info@iptel.org 19 * 20 * SEMS is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * You should have received a copy of the GNU General Public License 26 * along with this program; if not, write to the Free Software 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 */ 29 #ifndef _AmSipSubscriptionContainer_h_ 30 #define _AmSipSubscriptionContainer_h_ 31 32 #include "AmSipSubscription.h" 33 #include "AmEventProcessingThread.h" 34 35 typedef map<string,AmSipSubscriptionDialog*> AmSipSubscriptionMap; 36 typedef AmSipSubscriptionMap::iterator AmSipSubscriptionMapIter; 37 38 39 class _AmSipSubscriptionContainer 40 : public AmEventProcessingThread 41 { 42 AmSipSubscriptionMap subscriptions; 43 AmMutex subscriptions_mut; 44 45 void initialize(); 46 bool initialized; 47 public: 48 _AmSipSubscriptionContainer(); 49 ~_AmSipSubscriptionContainer(); 50 51 string createSubscription(const AmSipSubscriptionInfo& info, 52 const string& sess_link, 53 unsigned int wanted_expires=0); 54 55 bool refreshSubscription(const string& sub_handle, 56 unsigned int wanted_expires=0); 57 58 void removeSubscription(const string& sub_handle); 59 60 // AmEventProcessingThread 61 void onEvent(AmEvent* event); 62 }; 63 64 typedef singleton<_AmSipSubscriptionContainer> AmSipSubscriptionContainer; 65 66 #endif 67