D:/Storage/CVS_Head/h323plus/include/h230/h230.h

00001 /*
00002  * h230.h
00003  *
00004  * H.230 Conference control class.
00005  *
00006  * h323plus library
00007  *
00008  * Copyright (c) 2007 ISVO (Asia) Pte. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.1 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Alternatively, the contents of this file may be used under the terms
00016  * of the General Public License (the  "GNU License"), in which case the
00017  * provisions of GNU License are applicable instead of those
00018  * above. If you wish to allow use of your version of this file only
00019  * under the terms of the GNU License and not to allow others to use
00020  * your version of this file under the MPL, indicate your decision by
00021  * deleting the provisions above and replace them with the notice and
00022  * other provisions required by the GNU License. If you do not delete
00023  * the provisions above, a recipient may use your version of this file
00024  * under either the MPL or the GNU License."
00025  *
00026  * Software distributed under the License is distributed on an "AS IS"
00027  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00028  * the License for the specific language governing rights and limitations
00029  * under the License.
00030  *
00031  *
00032  * The Initial Developer of the Original Code is ISVO (Asia) Pte. Ltd.
00033  *
00034  * Contributor(s): ______________________________________.
00035  *
00036  * $Log: h230.h,v $
00037  * Revision 1.2  2007/10/18 17:44:12  shorne
00038  * Small fixes during test compile
00039  *
00040  * Revision 1.1  2007/10/16 16:35:44  shorne
00041  * Added H.230 Support
00042  *
00043  *
00044  *
00045  *
00046  */
00047 
00048 
00049 #pragma once
00050 
00051 #include <ptlib.h>
00052 #include <h323pdu.h>
00053 #include <gccpdu.h>
00054 
00055 #ifdef H323_H230 
00056 
00057 class H230Control  : public PObject
00058 {
00059    PCLASSINFO(H230Control, PObject);
00060 
00061 public:
00062 
00063         enum AddResponse
00064         {
00065       e_Addsuccess,
00066       e_AddinvalidRequester,
00067       e_AddinvalidNetworkType,
00068       e_AddinvalidNetworkAddress,
00069       e_AddaddedNodeBusy,
00070       e_AddnetworkBusy,
00071       e_AddnoPortsAvailable,
00072       e_AddconnectionUnsuccessful
00073         };
00074 
00075         enum LockResponse
00076         {
00077       e_Locksuccess,
00078       e_LockinvalidRequester,
00079       e_LockalreadyLocked
00080         };
00081 
00082         enum EjectResponse
00083         {
00084       e_Ejectsuccess,
00085       e_EjectinvalidRequester,
00086       e_EjectinvalidNode
00087         };
00088 
00089         enum  TransferResponse
00090         {
00091           e_Transfersuccess,
00092       e_TransferinvalidRequester
00093         };
00094 
00095         struct userInfo
00096         {
00097                 int       m_Token;
00098                 PString   m_Number;
00099                 PString   m_Name;
00100                 PString   m_vCard;
00101         };
00102 
00103         H230Control(const PString & _h323token);
00104 
00105 
00107 // Endpoint Functions
00108     BOOL Invite(const PStringList & aliases);
00109         BOOL LockConference();
00110     BOOL UnLockConference();
00111     BOOL EjectUser(int node);
00112         BOOL TransferUser(PList<int> node,const PString & number);
00113         BOOL TerminalListRequest();
00114         BOOL ChairRequest(BOOL revoke);
00115         BOOL ChairAssign(int node);
00116         BOOL FloorRequest();
00117         BOOL FloorAssign(int node);
00118         BOOL WhoIsChair();
00119         BOOL UserEnquiry(PList<int> node);
00120 
00121 // Endpoint Events
00122         virtual void OnControlsEnabled(BOOL /*success*/) {};
00123         virtual void OnConferenceChair(BOOL /*success*/) {};
00124         virtual void OnConferenceFloor(BOOL /*success*/) {};
00125         virtual void OnInviteResponse(int /*id*/, const PString & /*calledNo*/, AddResponse /*response*/, int /*errCode*/){};
00126         virtual void OnLockConferenceResponse(LockResponse /*lock*/)  {};
00127         virtual void OnUnLockConferenceResponse(LockResponse /*lock*/)  {};
00128         virtual void OnEjectUserResponse(int /*node*/, EjectResponse /*lock*/) {};
00129         virtual void OnTransferUserResponse(PList<int> /*node*/,const PString & /*number*/, TransferResponse /*result*/) {};
00130         virtual void OnTerminalListResponse(PList<int> node) {};
00131         virtual void ConferenceJoined(int /*terminalId*/){};
00132         virtual void ConferenceLeft(int /*terminalId*/) {};
00133         virtual void MakeChairResponse(BOOL /*success*/) {};
00134         virtual void ChairAssigned(int /*node*/) {};
00135         virtual void FloorAssigned(int /*node*/) {};
00136         virtual void OnChairTokenResponse(int /*id*/, const PString & /*name*/) {};
00137         virtual void OnFloorRequested(int /*terminalId*/,BOOL /*cancel*/) {};
00138         virtual void OnUserEnquiryResponse(PList<userInfo>) {};
00139 
00140 
00142 // Server Events
00143         virtual void OnInvite(const PStringList & /*alias*/) const {};
00144         virtual void OnLockConference(BOOL /*state*/) const {};
00145     virtual void OnEjectUser(int /*node*/) const {};
00146         virtual void OnTransferUser(PList<int> /*node*/,const PString & /*number*/) const {};
00147         virtual void OnTerminalListRequest() const {};
00148         virtual void ChairRequested(const int & /*terminalId*/,BOOL /*cancel*/) {};
00149         virtual void OnFloorRequest() {};
00150         virtual void OnChairTokenRequest() const {};
00151         virtual void OnChairAssign(int /*node*/) const {};
00152         virtual void OnFloorAssign(int /*node*/) const {};
00153         virtual void OnUserEnquiry(PList<int>) const {};
00154 
00155 
00156 //  Server Commands
00157         BOOL InviteResponse(int /*id*/, const PString & /*calledNo*/, AddResponse /*response*/, int /*errCode*/);
00158         BOOL LockConferenceResponse(LockResponse lock);
00159         BOOL UnLockConferenceResponse(LockResponse lock);
00160         BOOL EjectUserResponse(int node, EjectResponse lock);
00161         BOOL TransferUserResponse(PList<int> node,const PString & number, TransferResponse result);
00162         BOOL TerminalListResponse(PList<int> node);
00163         BOOL ChairTokenResponse(int termid,const PString & termname);
00164         BOOL ChairAssignResponse(int termid,const PString & termname);
00165         BOOL FloorAssignResponse(int termid,const PString & termname);
00166         BOOL UserEnquiryResponse(PList<userInfo>);
00167 
00168 // Server Indications
00169         BOOL ConferenceJoinedInd(int termId);
00170         BOOL ConferenceLeftInd(int termId);
00171         BOOL ConferenceTokenAssign(int mcuId,int termId);
00172 
00173         void SetChair(BOOL success);
00174         void SetFloor(BOOL success);
00175 
00176 
00178 // Common
00179  // standard incoming requests
00180     BOOL OnHandleConferenceRequest(const H245_ConferenceRequest &);
00181     BOOL OnHandleConferenceResponse(const H245_ConferenceResponse &);
00182     BOOL OnHandleConferenceCommand(const H245_ConferenceCommand &);
00183     BOOL OnHandleConferenceIndication(const H245_ConferenceIndication &);
00184 
00185   // Generic incoming requests
00186         BOOL OnHandleGenericPDU(const H245_GenericMessage & msg);
00187 
00188 
00189  protected:
00190   // H.245
00191         BOOL OnGeneralRequest(int request);
00192         BOOL OnGeneralIndication(int req, const H245_TerminalLabel & label);
00193 
00194         BOOL OnReceiveTerminalListResponse(const H245_ArrayOf_TerminalLabel & list);
00195         BOOL OnReceiveChairResponse(const H245_ConferenceResponse_makeMeChairResponse & resp);
00196         BOOL OnReceiveChairTokenResponse(const H245_ConferenceResponse_chairTokenOwnerResponse & resp);
00197         BOOL OnReceiveChairTokenRequest();
00198         BOOL OnReceiveChairAssignRequest(const H245_TerminalLabel & req);
00199         BOOL OnReceiveChairAssignResponse(const H245_ConferenceResponse_terminalIDResponse & req);
00200     BOOL OnReceiveFloorAssignRequest(const H245_TerminalLabel & req);
00201     BOOL OnReceiveFloorAssignResponse(const H245_ConferenceResponse_conferenceIDResponse & resp);
00202         
00203   // H.230
00204         BOOL ReceivedH230PDU(unsigned msgId, unsigned paramId, const H245_ParameterValue & value);
00205 
00206   // T.124
00207         BOOL ReceivedT124PDU(unsigned msgId, unsigned paramId, const H245_ParameterValue & value);
00208         BOOL OnReceivedT124Request(const GCC_RequestPDU &);
00209     BOOL OnReceivedT124Response(const GCC_ResponsePDU &);
00210     BOOL OnReceivedT124Indication(const GCC_IndicationPDU &);
00211 
00212     BOOL OnConferenceJoinRequest(const GCC_ConferenceJoinRequest &);
00213     BOOL OnConferenceAddRequest(const GCC_ConferenceAddRequest &);
00214     BOOL OnConferenceLockRequest(const GCC_ConferenceLockRequest &);
00215     BOOL OnConferenceUnlockRequest(const GCC_ConferenceUnlockRequest &);
00216     BOOL OnConferenceTerminateRequest(const GCC_ConferenceTerminateRequest &);
00217     BOOL OnConferenceEjectUserRequest(const GCC_ConferenceEjectUserRequest &);
00218     BOOL OnConferenceTransferRequest(const GCC_ConferenceTransferRequest &);
00219 
00220     BOOL OnConferenceJoinResponse(const GCC_ConferenceJoinResponse & pdu);
00221     BOOL OnConferenceAddResponse(const GCC_ConferenceAddResponse & pdu);
00222     BOOL OnConferenceLockResponse(const GCC_ConferenceLockResponse & pdu);
00223     BOOL OnConferenceUnlockResponse(const GCC_ConferenceUnlockResponse & pdu);
00224     BOOL OnConferenceEjectUserResponse(const GCC_ConferenceEjectUserResponse & pdu);
00225     BOOL OnConferenceTransferResponse(const GCC_ConferenceTransferResponse & pdu);
00226     BOOL OnFunctionNotSupportedResponse(const GCC_FunctionNotSupportedResponse & pdu);
00227 
00228 
00229     BOOL H230Control::ReceivedPACKPDU(unsigned msgId, unsigned paramId, const H245_ParameterValue & value);
00230 
00231         BOOL SendPACKGeneric(int msgid, PASN_OctetString & rawpdu);
00232         BOOL OnReceivePACKRequest(const PASN_OctetString & rawpdu);
00233         BOOL OnReceivePACKResponse(const PASN_OctetString & rawpdu);
00234 
00235         virtual BOOL WriteControlPDU(const H323ControlPDU & pdu);
00236 
00237         void SetLocalID(int mcu, int num);
00238         int GetLocalID();
00239         void RemoveLocalID();
00240 
00241         PString m_h323token;
00242         int m_mcuID;
00243     int m_userID;
00244 
00245     BOOL m_ConferenceChair;
00246         BOOL m_ConferenceFloor;
00247 };
00248 
00249 
00250 class H230T124PDU :  public H323ControlPDU
00251 {
00252     PCLASSINFO(H230T124PDU, H323ControlPDU);
00253 
00254 public:
00255         void BuildRequest(GCC_RequestPDU & pdu);
00256         void BuildResponse(GCC_ResponsePDU & pdu);
00257         void BuildIndication(GCC_IndicationPDU & pdu);
00258 
00259 protected:
00260         void BuildGeneric(PASN_OctetString & pdu);
00261 
00262 };
00263 
00264 
00265 
00266 class H230Control_EndPoint   : public H230Control 
00267 {
00268   public:
00269    PCLASSINFO(H230Control_EndPoint, H230Control);
00270 
00271           class result {
00272            public:
00273              result();
00274 
00275          int errCode;
00276                  int node;
00277                  BOOL cancel;
00278                  PString name;
00279                  PList<int> ids;
00280                  PList<userInfo> info;
00281           };
00282 
00283         H230Control_EndPoint(const PString & _h323token);
00284         ~H230Control_EndPoint();
00285 
00286 // Chair Instructions
00287     BOOL ReqInvite(const PStringList & aliases);
00288         BOOL ReqLockConference();
00289     BOOL ReqUnLockConference();
00290     BOOL ReqEjectUser(int node);
00291         BOOL ReqTransferUser(PList<int> node,const PString & number);
00292         BOOL ReqChairAssign(int node);
00293         BOOL ReqFloorAssign(int node);
00294 
00295 // General Requests
00296         BOOL ReqTerminalList(PList<int> & node);
00297         BOOL ReqChair(BOOL revoke);
00298         BOOL ReqFloor();
00299         BOOL ReqWhoIsChair(int & node);
00300         BOOL ReqUserEnquiry(PList<int> node, PList<userInfo> & info);
00301 
00302 // conference Indications
00303         virtual void OnControlsEnabled(BOOL /*success*/) {};
00304         virtual void OnConferenceChair(BOOL /*success*/) {};
00305         virtual void OnConferenceFloor(BOOL /*success*/) {};
00306 
00307 
00308 // Inherited
00309         virtual void ConferenceJoined(int /*terminalId*/){};
00310         virtual void ConferenceJoinInfo(int /*termId*/, PString /*number*/, PString /*name*/, PString /*vcard*/) {}; 
00311         virtual void ConferenceLeft(int /*terminalId*/) {};
00312         virtual void OnFloorRequested(int /*terminalId*/,BOOL /*cancel*/) {};
00313         virtual void OnChairAssigned(int /*node*/) {};
00314         virtual void OnFloorAssigned(int /*node*/) {};
00315         virtual void OnInviteResponse(int /*id*/, const PString & /*calledNo*/, AddResponse /*response*/, int /*errCode*/) {};
00316 
00318 // Endpoint Responses
00319         void OnLockConferenceResponse(LockResponse /*lock*/);
00320         void OnUnLockConferenceResponse(LockResponse /*lock*/);
00321         void OnEjectUserResponse(int /*node*/, EjectResponse /*lock*/);
00322         void OnTransferUserResponse(PList<int> /*node*/,const PString & /*number*/, TransferResponse /*result*/);
00323         void OnTerminalListResponse(PList<int> node);
00324         void MakeChairResponse(BOOL /*success*/);
00325         void OnChairTokenResponse(int /*id*/, const PString & /*name*/);
00326         void OnUserEnquiryResponse(PList<userInfo>);
00327         void ChairAssigned(int /*node*/);
00328         void FloorAssigned(int /*node*/);
00329 
00330  protected:
00331         PMutex requestMutex;
00332         PTimedMutex responseMutex;
00333         result * res;
00334 
00335 };
00336 
00337 #endif

Generated on Thu Oct 25 13:42:09 2007 for h323plus by  doxygen 1.5.2