q931ie.h
资源名称:h323.zip [点击查看]
上传用户:hnnddl
上传日期:2007-01-06
资源大小:3580k
文件大小:10k
源码类别:
IP电话/视频会议
开发平台:
WINDOWS
- /*
- * $Revision: 1.8 $
- * $Date: 1999/03/30 21:55:47 $
- */
- ////////////////////////////////////////////////////////////////
- // 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 : q931ie.h //
- // //
- // The Q931 information element class //
- // //
- // History: //
- // 18_Dec_1996 Created //
- // 28_Apr_1997 Code Review PASS2 //
- // 08_Jul_1997 Merged Sun5 changes. //
- // 18_Aug_1997 Added Q931CalledPartyNumberIE //
- // 08_Apr_1998 Q931DisplayIE added. //
- // 12_Oct_1998 Q931KeypadFacilityIE added. //
- // //
- ////////////////////////////////////////////////////////////////
- #if !defined(__Q931IE_H__)
- #define __Q931IE_H__
- #include "util/listifc.h"
- #include "util/platform.h"
- #include "api/apierr.h"
- enum Q931CodingStd
- {
- CS_CCITT = 0, // CCITT(ITU-T) standardized coding
- CS_ISO = 1, // ISO/IEC standard
- CS_NS = 2, // National standard
- CS_LOC = 3 // standard specific to identified loction
- };
- enum Q931ProgressIndicatorLoc
- {
- LOC_USER = 0x0, // user
- LOC_PRIV_NET_LOCAL_USER = 0x1, // private n/w serving the local user
- LOC_PUB_NET_LOCAL_USER = 0x2, // public n/w serving the local user
- LOC_TRANSIT_NET = 0x3, // Transit n/w
- LOC_PUB_NET_REMOTE_USER = 0x4, // public n/w serving the remote user
- LOC_PRIV_NET_REMOTE_USER = 0x5, // private n/w serving the remote user
- LOC_BEYOND_IW_POINT = 0xA // n/w beyond the interworking point
- };
- enum Q931ProgressDesc
- {
- DESC_NOT_END_TO_END_ISDN = 0x1, // Call is not end-to-end ISDN
- DESC_DEST_ADDR_NON_ISDN = 0x2, // Destination address in non ISDN
- DESC_ORIG_ADDR_NON_ISDN = 0x3, // Origination address is non ISDN
- DESC_CALL_RETURNED_TO_ISDN = 0x4, // Call has returned to the ISDN
- DESC_IW_OCCURRED = 0x5, // Interworking has occurred
- DESC_INBAND_INFO_AVAIL = 0x8 // inband info available
- };
- enum Q931CauseValues
- {
- CAUSE_NO_ROUTE_TO_DESTINATION = 0x03,
- CAUSE_NORMAL_CALL_CLEARING = 0x10,
- CAUSE_USER_BUSY = 0x11,
- CAUSE_NO_USER_RESPONDING = 0x12, // New: 10/15/1998 Release
- CAUSE_USER_ALERTING_NO_ANSWER = 0x13,
- CAUSE_CALL_REJECTED = 0x15,
- CAUSE_INVALID_NUMBER_FORMAT = 0x1C,
- CAUSE_FACILITY_REJECTED = 0x3D,
- CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 0x1E,
- CAUSE_NORMAL_UNSPECIFIED = 0x1F,
- CAUSE_NO_CIRCUIT_OR_CHANNEL_AVAILABLE = 0x22,
- CAUSE_TEMPORARY_FAILURE = 0x29,
- CAUSE_SWITCHING_EQUIPMENT_CONGESTION = 0x2A,
- CAUSE_RESOURCE_UNAVAILABLE_OR_UNSPECIFIED = 0x2F,
- CAUSE_CHANNEL_TYPE_NOT_IMPLEMENTED = 0x42, // New: 10/15/1998 Release
- CAUSE_INCOMPATIBLE_DESTINATION = 0x58,
- CAUSE_MANDATORY_IE_MISSING = 0x60,
- CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 0x61,
- CAUSE_IE_NO_EXISTENT = 0x63,
- CAUSE_INVALID_IE_CONTENT = 0x64,
- CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_CALL_STATE = 0x65
- };
- // -enum Q931CauseCodingStandards
- //
- // @Version: PX3230S Version 2.3.2
- //
- // @Caveat:
- // Coding standards other than CAUSE_CODING_STANDARD_ITU_T should be used
- // only when the desired cause value cannot be represented with the
- // ITU-T-standardized coding.
- // @See:
- // -H225CSCauseIE
- enum Q931CauseCodingStandards
- {
- CAUSE_CODING_STANDARD_ITU_T = 0x0, //ITU-T standardized coding
- CAUSE_CODING_STANDARD_ISO_IEC = 0x1,//ISO/IEC standard
- CAUSE_CODING_STANDARD_NATIONAL_STANDARD = 0x2,//national standard
- CAUSE_CODING_STANDARD_SPECIFIC = 0x3//standard specific to identified location
- };
- // -enum Q931CauseLocations
- //
- // @Version: PX3230S Version 2.3.2
- //
- // @See:
- // -H225CSCauseIE
- enum Q931CauseLocations
- {
- CAUSE_LOCATION_USER = 0x0, // user (U)
- CAUSE_LOCATION_LPN = 0x1, // private network serving the local user (LPN)
- CAUSE_LOCATION_LN = 0x2, // public network serving the local user (LN)
- CAUSE_LOCATION_TN = 0x3, // transit network (TN)
- CAUSE_LOCATION_RLN = 0x4, // public network serving the remote user (RLN)
- CAUSE_LOCATION_RPN = 0x5, // private network serving the remote user (RPN)
- CAUSE_LOCATION_INTL = 0x7, // international network (INTL)
- CAUSE_LOCATION_BI = 0xA, // network beyond interworking point (BI)
- CAUSE_LOCATION_NTL_RSVD_1 = 0xC, // reserved for national use
- CAUSE_LOCATION_NTL_RSVD_2 = 0xD, // reserved for national use
- CAUSE_LOCATION_NTL_RSVD_3 = 0xE, // reserved for national use
- CAUSE_LOCATION_NTL_RSVD_4 = 0xF //reserved for national use
- };
- enum Q931NumberType
- {
- NUMBERTYPE_UNKNOWN = 0x0,
- NUMBERTYPE_INTERNATIONAL = 0x1,
- NUMBERTYPE_NATIONAL = 0x2,
- NUMBERTYPE_NETWORK_SPECIFIC = 0x3,
- NUMBERTYPE_SUBSCRIBER = 0x4,
- NUMBERTYPE_ABBREVIATED = 0x5
- };
- enum Q931NumberingPlan
- {
- NUMBERINGPLAN_UNKNOWN = 0x0,
- NUMBERINGPLAN_ISDN = 0x1,
- NUMBERINGPLAN_DATA = 0x3,
- NUMBERINGPLAN_TELEX = 0x4,
- NUMBERINGPLAN_NATIONAL_STANDARD = 0x8,
- NUMBERINGPLAN_PRIVATE = 0x9
- };
- class Logger;
- // information element class.
- class DLLEXPORT Q931IE : public ListElementInterface
- {
- public:
- Q931IE(int length_field = 1);
- virtual ~Q931IE();
- virtual int Match(void *key, unsigned long context);
- virtual ProtReturnCode GetID(int& id);
- // Upon successful return buf will contain the
- // complete information element image that begins
- // with id, and is followed by length and data.
- // length indicates the number of valid bytes in
- // buf.
- virtual ProtReturnCode GetRaw(char *buf, int& length);
- // Get the length in octets of the complete ie.
- virtual ProtReturnCode GetRawLength(int &length);
- // Set the entire information element. Buf contains
- // the complete information element image,
- // that includes the id, length etc.
- // If buf contains more than one information
- // element, only the first one is processed and
- // length indicates the number of bytes that were processed.
- virtual ProtReturnCode SetRaw(char *buf, int& length);
- // Get contents of the ie.
- virtual ProtReturnCode GetContent(char *data,
- int &length);
- // Get the length in octets of the ie contents alone.
- virtual ProtReturnCode GetContentLength(int &length);
- // buf contains the contents alone, id specifies the
- // information element id and length specifies the
- // length of the contents.
- virtual ProtReturnCode SetContent(int id, char *buf, int length);
- // buf contains the contents alone, information element
- // id is implicit.
- // This method will be implemented by classes which
- // derive from Q931IE class to implement specific
- // IEs like IE_DISPLAY, IE_REASON or H225UserToUserIE.
- virtual ProtReturnCode Set(char *buf, int length);
- Q931IE& operator=(Q931IE& ie);
- // For Protocol internal use..
- virtual void Dump(Logger *logger);
- protected:
- // the information element as a byte stream.
- char *data;
- // total length of the information element byte stream.
- int total_length;
- // length of the information element data portion.
- int content_length;
- // Length of the length field contents
- int length_field;
- static int is_fixed_length_ie(int id)
- {
- return (int) (((unsigned char) id) & 0x80);
- }
- private:
- virtual ProtReturnCode Copy(Q931IE& ie);
- };
- class DLLEXPORT Q931CauseIE : public Q931IE
- {
- public:
- Q931CauseIE();
- // method to set/get the cause information element.
- virtual ProtReturnCode SetCause(unsigned char cause_value);
- virtual ProtReturnCode GetCause(unsigned char& cause_value);
- Q931CauseIE& operator=(Q931CauseIE&);
- };
- class DLLEXPORT Q931PartyNumberIE : public Q931IE
- {
- public:
- // ie_type is IE_CALLED_PARTY_NUMBER or
- // IE_CALLING_PARTY_NUMBER
- Q931PartyNumberIE(int ie_type);
- // Methods to set/get the type and plan of the number.
- // see enum Q931NumberType and Q931NumberingPlan
- virtual ProtReturnCode SetNumberParams(int type,int plan);
- virtual ProtReturnCode GetNumberParams(int& type,int& plan);
- // Methods to set/get the IA5 characters(digits) in the
- // number.
- virtual ProtReturnCode SetDigits(char *digits, int length);
- virtual ProtReturnCode GetDigitsLength(int& length);
- virtual ProtReturnCode GetDigits(char *digits, int& length);
- Q931PartyNumberIE& operator=(Q931PartyNumberIE&);
- private:
- int ie_type;
- };
- class DLLEXPORT Q931CalledPartyNumberIE : public Q931PartyNumberIE
- {
- public:
- Q931CalledPartyNumberIE();
- Q931CalledPartyNumberIE& operator=(Q931CalledPartyNumberIE&);
- };
- class DLLEXPORT Q931CallingPartyNumberIE : public Q931PartyNumberIE
- {
- public:
- Q931CallingPartyNumberIE();
- Q931CallingPartyNumberIE& operator=(Q931CallingPartyNumberIE&);
- };
- class DLLEXPORT Q931DisplayIE : public Q931IE
- {
- public:
- Q931DisplayIE();
- virtual ~Q931DisplayIE();
- ProtReturnCode SetDisplayString(char *str, int length);
- ProtReturnCode GetDisplayStringLength(int& length);
- ProtReturnCode GetDisplayString(char *str, int& length);
- Q931DisplayIE& operator=(Q931DisplayIE&);
- };
- //
- // This class encapsulates the Q931 Keypad Facility Information
- // element.
- //
- // @See:
- // -Q931IE
- //
- // @Version: PX3230S Version 2.2
- class DLLEXPORT Q931KeypadFacilityIE : public Q931IE
- {
- public:
- Q931KeypadFacilityIE();
- virtual ~Q931KeypadFacilityIE();
- // Method for setting Keypad information as an IA5 string.
- ProtReturnCode SetKeypadInfo(char *ia5str, int length);
- // Method for getting the length of the keypad information.
- ProtReturnCode GetKeypadInfoLength(int& length);
- // Method to retrieve the keypad information string.
- // ia5str must point to buffer of size 'length'. Upon
- // return from this method, length will contains the actual
- // number of bytes written to the buffer pointed to by
- // ia5str.
- ProtReturnCode GetKeypadInfo(char *ia5str, int& length);
- Q931KeypadFacilityIE& operator=(Q931KeypadFacilityIE&);
- };
- #endif //__Q931IE_H__