q931event.h
资源名称:h323.zip [点击查看]
上传用户:hnnddl
上传日期:2007-01-06
资源大小:3580k
文件大小:8k
源码类别:
IP电话/视频会议
开发平台:
WINDOWS
- /*
- * $Revision: 1.7 $
- * $Date: 1999/03/17 18:41:06 $
- */
- ////////////////////////////////////////////////////////////////
- // Copyright (c) 1996,97 Lucent Technologies //
- // All Rights Reserved //
- // //
- // THIS IS UNPUBLISHED //
- // PROPRIETARY SOURCE //
- // CODE OF Lucent Technologies //
- // AND elemedia //
- // //
- // The copyright notice above does not evidence any //
- // actual or intended publication of such source code//
- ////////////////////////////////////////////////////////////////
- //
- /////////////////////////////////////////////////////////////////
- // File : q931event.h //
- // //
- // This file declares the Q931Event and related classes. //
- // //
- // History: //
- // 18_Dec_1996 Created //
- // 8_Feb_1997 Added Q931Event, Q931Timeout etc... //
- // 28_Feb_1997 Fixed bug in SetCRV/GetCRV //
- // 25_Apr_1997 Code Review. PASS1. Added Dump routine, //
- // Removed ununsed calls, GetUUPD and SetUUPD. //
- // 29_Apr_1997 Code Review. PASS2. ~Q931Message made virtual, //
- // added ~Q931Event //
- // 01_Jul_1997 Added CCP_FACILITY_REQUEST //
- // 17_Sep_1997 Added CCP_STATUS_ENQUIRY_REQUEST //
- // and CCP_STATUS_REQUEST //
- // 12_Oct_1998 Support for Progress Message. //
- // 10_Mar_1999 Added CCP_NOTIFY_REQUEST & CCP_INFO_REQEST //
- // Added new message types: NOTIFY,INFORMATION & //
- // SETUP_ACK. //
- // Added new Q.931 state OVERLAP_RECEIVING //
- /////////////////////////////////////////////////////////////////
- #if (!defined(__Q931EVENT_H__))
- #define __Q931EVENT_H__
- #include "util/listifc.h"
- #include "util/platform.h"
- #include "q931/q931err.h"
- class ListManager;
- class Logger;
- // The various states of the Q.931 FSM
- // These values will be returned in the NotifyStateChange methods.
- enum Q931FSMStates
- {
- STATE_NULL = 0x0,
- STATE_CALL_PRESENT = 0x6,
- STATE_INCOMING_CALL_PROCEEDING = 0x9,
- STATE_OUTGOING_CALL_PROCEEDING = 0x3,
- STATE_CALL_RECEIVED = 0x7,
- STATE_CALL_INITIATED = 0x1,
- STATE_OVERLAP_SENDING = 0x2,
- STATE_CALL_DELIVERED = 0x4,
- STATE_OVERLAP_RECEIVING = 0x19,
- STATE_CALL_ACTIVE = 0xA
- };
- enum Q931CallDir
- {
- DIR_OUTGOING,
- DIR_INCOMING
- };
- // The various timeouts supported by the q.931 engine
- enum Q931TimerTypes
- {
- Q931TT_T301, // alert recd, awaiting connect (180 secs)
- Q931TT_T303, // setup sent, awaiting cp, alerting or connect (4 secs)
- Q931TT_T310, // call proc recd, awaiting connect (10 secs)
- Q931TT_T304, // Started upon receipt of setup_ack (30 secs)
- Q931TT_T302 // Started before entering overlap recv state (15 secs)
- };
- // The various q931 message types
- enum Q931MessageType
- {
- MESSAGE_INVALID = 0x00,
- // Q931 message types.
- MESSAGE_ALERTING = 0x01,
- MESSAGE_CALL_PROCEEDING = 0x02,
- MESSAGE_PROGRESS = 0x3,
- MESSAGE_SETUP = 0x05,
- MESSAGE_CONNECT = 0x07,
- MESSAGE_SETUP_ACK = 0x0D,
- MESSAGE_STATUS_ENQUIRY = 0x75,
- MESSAGE_RELEASE_COMPLETE = 0x5A,
- MESSAGE_STATUS = 0x7D,
- MESSAGE_FACILITY = 0x62,
- MESSAGE_NOTIFY = 0x6E,
- MESSAGE_INFORMATION = 0x7B,
- // Q932 message types.
- MESSAGE_Q932_FACILITY = 0x62,
- MESSAGE_Q932_REGISTER = 0x64,
- MESSAGE_Q932_HOLD = 0x24,
- MESSAGE_Q932_HOLD_ACK = 0x28,
- MESSAGE_Q932_HOLD_REJECT= 0x30
- };
- // Information elements types.
- enum Q931IEType
- {
- IE_BEARER_CAPABILITY = 0x04,
- IE_CHANNEL_ID = 0x18, // For Futher Study as per H225v2
- IE_PROGRESS_INDICATOR = 0x1E,
- IE_DISPLAY = 0x28,
- IE_SIGNAL = 0x34,
- IE_HIGHER_LAYER_COMPAT = 0x7D, // For Futher Study as per H225v2
- IE_USER_TO_USER = 0x7E,
- IE_DATE_TIME = 0x29,
- IE_LOWER_LAYER_COMPAT = 0x7C, // For Futher Study as per H225v2
- IE_SENDING_COMPLETE = 0xA1,
- IE_KEYPAD_FACILITY = 0x2C,
- IE_CALLED_PARTY_NUMBER = 0x70,
- IE_CALLED_PARTY_SUB_ADDRESS = 0x71,
- IE_CAUSE = 0x08,
- IE_CALLING_PARTY_NUMBER = 0x6C,
- IE_CALLING_PARTY_SUB_ADDRESS = 0x6D,
- IE_FACILITY = 0x1C,
- IE_EXTENDED_FACILITY = 0x0D,
- IE_CALL_STATE = 0x14,
- IE_NOTIFICATION_INDICATOR = 0x27
- };
- // The various types the Q931Event class can be polymorphed into..
- enum Q931EventTypes
- {
- Q931EVENT_INVALID,
- Q931EVENT_MESSAGE,
- Q931EVENT_CALL_CONTROL_PRIMITIVE,
- Q931EVENT_ERROR
- };
- //
- // various user generated stimuli for the q931 fsm.
- //
- enum Q931Primitives
- {
- CCP_SETUP_REQUEST,
- CCP_PROCEEDING_REQUEST,
- CCP_ALERTING_REQUEST,
- CCP_SETUP_RESPONSE,
- CCP_REJECT_REQUEST,
- CCP_RELEASE_REQUEST,
- CCP_FACILITY_REQUEST,
- CCP_STATUS_ENQUIRY_REQUEST,
- CCP_STATUS_REQUEST,
- CCP_PROGRESS_REQUEST,
- CCP_INFO_REQUEST,
- CCP_MORE_INFO_REQUEST,// Will cause the stack to send a SETUP_ACK
- CCP_NOTIFY_REQUEST
- };
- //
- // The stimlus object for the Q931FSM,
- // Currently there are 3 different events
- // defined, 1. Q931Message, 2. Q931CallControlPrimitive
- // 3. Q931Error
- class DLLEXPORT Q931Event
- {
- public:
- // event_type specifies the type of event.
- Q931Event(int event_type);
- virtual ~Q931Event();
- virtual int GetEventType();
- Q931Event& operator=(Q931Event& ev);
- protected:
- int event_type;
- };
- class DLLEXPORT Q931CallCtrlPrim : public Q931Event
- {
- public:
- Q931CallCtrlPrim(int prim_type);
- ProtReturnCode GetType(int& prim);
- Q931CallCtrlPrim& operator=(Q931CallCtrlPrim& ccp);
- protected:
- int prim_type;
- };
- class DLLEXPORT Q931Error : public Q931Event
- {
- public:
- Q931Error(ProtReturnCode error);
- ProtReturnCode GetError();
- Q931Error& operator=(Q931Error& err);
- protected:
- ProtReturnCode error;
- };
- class Q931IE;
- // This class abstracts a Q931 message.
- class DLLEXPORT Q931Message : public Q931Event
- {
- public:
- Q931Message(int msg_type);
- virtual ~Q931Message();
- // Get and set the protocol discriminator field.
- ProtReturnCode GetPD(unsigned char &pd);
- ProtReturnCode SetPD(unsigned char pd);
- // Get and set the message type field.
- ProtReturnCode GetType(int& type);
- ProtReturnCode SetType(int type);
- // Get the Call Reference Value field.
- ProtReturnCode GetCRV(unsigned short& crv);
- // Methods to Get/Set/Delete information elements.
- ProtReturnCode GetIE(int id, Q931IE* &ie);
- ProtReturnCode SetIE(Q931IE& ie);
- ProtReturnCode DeleteIE(int id);
- Q931Message& operator=(Q931Message&);
- // ie_id is one of enum Q931IEType.
- boolean IsIEValid(int ie_id);
- // For protocol internal use..
- void Dump(Logger *logger);
- protected:
- int message_type;
- unsigned short call_reference_value;
- unsigned char protocol_discriminator;
- int crv_length;
- private:
- friend class Q931Engine;
- // List of information elements in this message.
- ListManager *ie_list;
- // The list of allowed information elements for this message in sorted
- // order.
- int* ie_table;
- int ie_table_length;
- // Private constructors, used by Q931Engine class.
- Q931Message(int msg_type,
- unsigned char protocol_disc,
- unsigned short crv,
- int crv_length = 2);
- Q931Message();
- // Methods to manipulate the Q931 message as a byte stream.
- ProtReturnCode GetMessageData(char *buf, int& length);
- ProtReturnCode SetMessageData(char *buf, int length);
- ProtReturnCode DeleteMessageData();
- ProtReturnCode GetMessageDataLength(int &length);
- void SetIETable();
- ProtReturnCode GetValidIEList(int *& list, int & length);
- boolean IsIEAllowed(int id);
- // flag indicates if the CRV is inclusive of the flag or not.
- // this is saved in the message. Flag also indicates that
- // the CRV value is in network byte order.
- ProtReturnCode SetCRV(
- unsigned short crv, int flag);
- // flag == non-zero then set flag bit
- // else unset it.
- void SetCRVFlag(int flag);
- };
- #endif