📄 h323caps.h
字号:
); //@}};////////////////////////////////////////////////////////////////////////////////**This class describes the UserInput psuedo-channel. */class H323_UserInputCapability : public H323Capability{ PCLASSINFO(H323_UserInputCapability, H323Capability); public: /**@name Construction */ //@{ /**Create the capability for User Input. The subType parameter is a value from the enum H245_UserInputCapability::Choices. */ H323_UserInputCapability( unsigned subType = 1 ); //@} /**@name Overrides from class PObject */ //@{ /**Create a copy of the object. */ virtual PObject * Clone() const; //@} /**@name Identification functions */ //@{ /**Get the main type of the capability. This function is overridden by one of the three main sub-classes off which real capabilities would be descendend. */ virtual MainTypes GetMainType() const; /**Get the sub-type of the capability. This is a code dependent on the main type of the capability. */ virtual unsigned GetSubType() const; /**Get the name of the media data format this class represents. */ virtual PString GetFormatName() const; //@} /**@name Operations */ //@{ /**Create the channel instance, allocating resources as required. This creates a logical channel object appropriate for the parameters provided. Not if param is NULL, sessionID must be provided, otherwise this is taken from the fields in param. */ virtual H323Channel * CreateChannel( H323Connection & connection, /// Owner connection for channel H323Channel::Directions dir, /// Direction of channel unsigned sessionID, /// Session ID for RTP channel const H245_H2250LogicalChannelParameters * param /// Parameters for channel ) const; /**Create the codec instance, allocating resources as required. */ virtual H323Codec * CreateCodec( H323Codec::Direction direction /// Direction in which this instance runs ) const; //@} /**@name Protocol manipulation */ //@{ /**This function is called whenever and outgoing TerminalCapabilitySet PDU is being constructed for the control channel. It allows the capability to set the PDU fields from information in members specific to the class. The default behaviour is pure. */ virtual BOOL OnSendingPDU( H245_Capability & pdu /// PDU to set information on ) const; /**This function is called whenever and outgoing OpenLogicalChannel PDU is being constructed for the control channel. It allows the capability to set the PDU fields from information in members specific to the class. The default behaviour is pure. */ virtual BOOL OnSendingPDU( H245_DataType & pdu /// PDU to set information on ) const; /**This function is called whenever and incoming TerminalCapabilitySet PDU is received on the control channel, and a new H323Capability descendent was created. This completes reading fields from the PDU into the classes members. If the function returns FALSE then the received PDU codec description is not supported, so will be ignored. The default behaviour simply returns TRUE. */ virtual BOOL OnReceivedPDU( const H245_Capability & pdu /// PDU to get information from ); /**This function is called whenever and incoming OpenLogicalChannel PDU has been used to construct the control channel. It allows the capability to set from the PDU fields, information in members specific to the class. The default behaviour is pure. */ virtual BOOL OnReceivedPDU( const H245_DataType & pdu, /// PDU to get information from BOOL receiver /// Is receiver OLC ); //@} protected: unsigned subType;};///////////////////////////////////////////////////////////////////////////////PLIST(H323CapabilitiesList, H323Capability);PARRAY(H323CapabilitiesListArray, H323CapabilitiesList);class H323SimultaneousCapabilities : public H323CapabilitiesListArray{ PCLASSINFO(H323SimultaneousCapabilities, H323CapabilitiesListArray); public: BOOL SetSize(PINDEX newSize);};PARRAY(H323CapabilitiesSetArray, H323SimultaneousCapabilities);class H323CapabilitiesSet : public H323CapabilitiesSetArray{ PCLASSINFO(H323CapabilitiesSet, H323CapabilitiesSetArray); public: /// Set the new size of the table, internal use only. BOOL SetSize(PINDEX newSize);};/**This class contains all of the capabilities and their combinations. */class H323Capabilities : public PObject{ PCLASSINFO(H323Capabilities, PObject); public: /**@name Construction */ //@{ /**Construct an empty capability set. */ H323Capabilities(); /**Construct a capability set from the H.245 PDU provided. */ H323Capabilities( const H323Connection & connection, /// Connection for capabilities const H245_TerminalCapabilitySet & pdu /// PDU to convert to a capability set. ); /**Construct a copy of a capability set. Note this will completely duplicate the set by making clones of every capability in the original set. */ H323Capabilities( const H323Capabilities & original /// Original capabilities to duplicate ); /**Assign a copy of a capability set. Note this will completely duplicate the set by making clones of every capability in the original set. */ H323Capabilities & operator=( const H323Capabilities & original /// Original capabilities to duplicate ); //@} /**@name OVerrides from class PObject */ //@{ /**Print out the object to the stream, virtual version of << operator. */ void PrintOn( ostream & strm /// Stream to print out to. ) const; //@} /**@name Operations */ //@{ /**Get the number of capabilities in the set. */ PINDEX GetSize() const { return table.GetSize(); } /**Get the capability at the specified index. */ H323Capability & operator[](PINDEX i) const { return table[i]; } /**Set the capability descriptor lists. This is three tier set of codecs. The top most level is a list of particular capabilities. Each of these consists of a list of alternatives that can operate simultaneously. The lowest level is a list of codecs that cannot operate together. See H323 section 6.2.8.1 and H245 section 7.2 for details. If descriptorNum is P_MAX_INDEX, the the next available index in the array of descriptors is used. Similarly if simultaneous is P_MAX_INDEX the the next available SimultaneousCapabilitySet is used. The return value is the index used for the new entry. Note if both are P_MAX_INDEX then the return value is the descriptor index as the simultaneous index must be zero. Note that the capability specified here is automatically added to the capability table using the AddCapability() function. A specific instance of a capability is only ever added once, so multiple SetCapability() calls with the same H323Capability pointer will only add that capability once. */ PINDEX SetCapability( PINDEX descriptorNum, /// The member of the capabilityDescriptor to add PINDEX simultaneous, /// The member of the SimultaneousCapabilitySet to add H323Capability * cap /// New capability specification ); /**Add a codec to the capabilities table. This will assure that the assignedCapabilityNumber field in the capability is unique for all capabilities installed on this set. If the specific instance of the capability is already in the table, it is not added again. Ther can be multiple instances of the same capability class however. */ void Add( H323Capability * capability /// New capability specification ); /**Copy a codec to the capabilities table. This will make a clone of the capability and assure that the assignedCapabilityNumber field in the capability is unique for all capabilities installed on this set. Returns the copy that is put in the table. */ H323Capability * Copy( const H323Capability & capability /// New capability specification ); /**Remove a capability from the table. Note that the the parameter must be the actual instance of the capability in the table. The instance is deleted when removed from the table. */ void Remove( H323Capability * capability /// Existing capability specification ); /**Remove all capabilities matching the string. This uses FindCapability() to locate the first capability whose format name does a partial match for the argument. */ void Remove( const PString & formatName /// Format name to search for. ); /**Remove all capabilities matching any of the strings provided. This simply calls Remove() for each string in the list. */ void Remove( const PStringArray & formatNames /// Array of format names to remove ); /**Remove all of the capabilities. */ void RemoveAll(); /**Find the capability given the capability number. This number is guarenteed to be unique for a give capability table. Note that is may not be the same as the index into the table. Returns: NULL if no capability meeting the criteria was found */ H323Capability * FindCapability( unsigned capabilityNumber ) const; /**Find the capability given the capability format name string. This does a partial match for the supplied argument. If the argument matches a substring of the actual capabilities name, then it is returned. For example "GSM" or "0610" will match "GSM 0610". The user should be carefull of using short strings such as "G"! Note case is not significant. Returns: NULL if no capability meeting the criteria was found */ H323Capability * FindCapability( const PString & formatName ) const; /**Find the capability given the capability. This does a value compare of the two capabilities. Usually this means the mainType and subType are the same. Returns: NULL if no capability meeting the criteria was found */ H323Capability * FindCapability( const H323Capability & capability ) const; /**Find the capability given the H.245 capability PDU. Returns: NULL if no capability meeting the criteria was found */ H323Capability * FindCapability( const H245_Capability & cap /// H245 capability table entry ) const; /**Find the capability given the H.245 data type PDU. Returns: NULL if no capability meeting the criteria was found */ H323Capability * FindCapability( const H245_DataType & dataType /// H245 data type of codec ) const; /**Find the capability given the type codecs. Returns: NULL if no capability meeting the criteria was found */ H323Capability * FindCapability( H323Capability::MainTypes mainType, /// Main type to find unsigned subType = UINT_MAX /// Sub-type to find (UINT_MAX=ignore) ) const; /**Build a H.245 PDU from the information in the capability set. */ void BuildPDU( H245_TerminalCapabilitySet & pdu ) const; /**Merge the capabilities into this set. */ BOOL Merge( const H323Capabilities & newCaps ); /**Change the order of capabilities in the table to the order specified. Note that this does not change the unique capability numbers assigned when the capability is first added to the set. The string matching rules are as for the FindCapability() function. */ void Reorder( const PStringArray & preferenceOrder /// New order ); /**Test if the capabilities are an allowed combination. */ BOOL IsAllowed( const H323Capability & capability1, const H323Capability & capability2 ); //@} protected: H323CapabilitiesList table; H323CapabilitiesSet set;};#endif // __H323CAPS_H/////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -