core/AmConferenceStatus.h
a2a334f1
 /*
  * $Id: AmConferenceStatus.h,v 1.1.2.1 2005/03/07 21:34:45 sayer Exp $
  *
  * Copyright (C) 2002-2003 Fhg Fokus
  *
  * This file is part of sems, a free SIP media server.
  *
  * sems is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
  * For a license to use the sems software under conditions
  * other than those described here, or to purchase support for this
  * software, please contact iptel.org by e-mail at the following addresses:
  *    info@iptel.org
  *
  * sems is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #ifndef _ConferenceStatus_h_
 #define _ConferenceStatus_h_
 
 #include "AmThread.h"
 #include "AmRtpStream.h"
 #include "AmMultiPartyMixer.h"
 #include "AmEventQueue.h"
 
37abd537
 #include <map>
a2a334f1
 #include <string>
37abd537
 using std::map;
a2a334f1
 using std::string;
 
37abd537
 class AmConferenceChannel;
a2a334f1
 
37abd537
 enum { ConfNewParticipant = 1,
        ConfParticipantLeft };
 
809a2727
 /** \brief event in a conference*/
37abd537
 struct ConferenceEvent: public AmEvent
a2a334f1
 {
37abd537
     unsigned int participants;
9421bbe4
     string       conf_id;
a2a334f1
 
9421bbe4
     ConferenceEvent(int event_id, 
 		    unsigned int participants,
 		    const string& conf_id)
37abd537
 	: AmEvent(event_id),
9421bbe4
 	  participants(participants),
 	  conf_id(conf_id)
37abd537
     {}
 };
a2a334f1
 
809a2727
 /**
  * \brief One conference (room).
  * 
  * The ConferenceStatus manages one conference.
  */
37abd537
 class AmConferenceStatus
 {
     static map<string,AmConferenceStatus*> cid2status;
     static AmMutex                         cid2s_mut;
a2a334f1
 
37abd537
     struct SessInfo {
a2a334f1
 
37abd537
 	string       sess_id;
 	unsigned int ch_id;
a2a334f1
 
37abd537
 	SessInfo(const string& local_tag,
 		 unsigned int  ch_id)
 	    : sess_id(local_tag),
 	      ch_id(ch_id)
 	{}
     };
a2a334f1
 
37abd537
     string                 conf_id;
     AmMultiPartyMixer      mixer;
a2a334f1
     
37abd537
     // sess_id -> ch_id
     map<string, unsigned int> sessions;
a2a334f1
 
37abd537
     // ch_id -> sess_id
     map<unsigned int, SessInfo*> channels;
a2a334f1
 
37abd537
     AmMutex                      sessions_mut;
a2a334f1
 
37abd537
     AmConferenceStatus(const string& conference_id);
     ~AmConferenceStatus();
a2a334f1
 
37abd537
     AmConferenceChannel* getChannel(const string& sess_id);
a2a334f1
 
37abd537
     int releaseChannel(unsigned int ch_id);
a2a334f1
 
37abd537
  public:
     const string&      getConfID() { return conf_id; }
     AmMultiPartyMixer* getMixer()  { return &mixer; }
a2a334f1
 
37abd537
     static AmConferenceChannel* getChannel(const string& cid, 
 					   const string& local_tag);
a2a334f1
 
37abd537
     static void releaseChannel(const string& cid, unsigned int ch_id);
a2a334f1
 };
 
 #endif
 // Local Variables:
 // mode:C++
 // End: