AmConferenceStatus.h

Go to the documentation of this file.
00001 /*
00002  * $Id: AmConferenceStatus.h 711 2008-02-10 18:52:44Z sayer $
00003  *
00004  * Copyright (C) 2002-2003 Fhg Fokus
00005  *
00006  * This file is part of sems, a free SIP media server.
00007  *
00008  * sems is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * For a license to use the sems software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * sems is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00028 #ifndef _ConferenceStatus_h_
00029 #define _ConferenceStatus_h_
00030 
00031 #include "AmThread.h"
00032 #include "AmRtpStream.h"
00033 #include "AmMultiPartyMixer.h"
00034 #include "AmEventQueue.h"
00035 
00036 #include <map>
00037 #include <string>
00038 using std::string;
00039 
00040 class AmConferenceChannel;
00041 
00042 enum { ConfNewParticipant = 1,
00043        ConfParticipantLeft };
00044 
00046 struct ConferenceEvent: public AmEvent
00047 {
00048   unsigned int participants;
00049   string       conf_id;
00050   string       sess_id;
00051 
00052   ConferenceEvent(int event_id, 
00053                   unsigned int participants,
00054                   const string& conf_id,
00055                   const string& sess_id)
00056     : AmEvent(event_id),
00057       participants(participants),
00058       conf_id(conf_id),
00059       sess_id(sess_id)
00060   {}
00061 };
00062 
00068 class AmConferenceStatus
00069 {
00070   static std::map<string,AmConferenceStatus*> cid2status;
00071   static AmMutex                         cid2s_mut;
00072 
00073   struct SessInfo {
00074 
00075     string       sess_id;
00076     unsigned int ch_id;
00077 
00078     SessInfo(const string& local_tag,
00079              unsigned int  ch_id)
00080       : sess_id(local_tag),
00081         ch_id(ch_id)
00082     {}
00083   };
00084 
00085   string                 conf_id;
00086   AmMultiPartyMixer      mixer;
00087     
00088   // sess_id -> ch_id
00089   std::map<string, unsigned int> sessions;
00090 
00091   // ch_id -> sess_id
00092   std::map<unsigned int, SessInfo*> channels;
00093 
00094   AmMutex                      sessions_mut;
00095 
00096   AmConferenceStatus(const string& conference_id);
00097   ~AmConferenceStatus();
00098 
00099   AmConferenceChannel* getChannel(const string& sess_id);
00100 
00101   int releaseChannel(unsigned int ch_id);
00102 
00103   void postConferenceEvent(int event_id, const string& sess_id);
00104 
00105 public:
00106   const string&      getConfID() { return conf_id; }
00107   AmMultiPartyMixer* getMixer()  { return &mixer; }
00108 
00109   static AmConferenceChannel* getChannel(const string& cid, 
00110                                          const string& local_tag);
00111 
00112   static void releaseChannel(const string& cid, unsigned int ch_id);
00113 
00114   static void postConferenceEvent(const string& cid, int event_id, 
00115                                   const string& sess_id);
00116 
00117   static size_t getConferenceSize(const string& cid);
00118 };
00119 
00120 #endif
00121 // Local Variables:
00122 // mode:C++
00123 // End:
00124 

Generated on Fri May 16 12:02:05 2008 for SEMS by  doxygen 1.5.1
Home |  Recent changes |  Search |  Glossary |  Sitemap |  Login