# H323Capabilities Class Reference

`#include <h323caps.h>`

Collaboration diagram for H323Capabilities:

[legend]

## Public Member Functions

Construction
| H323Capabilities ()
| H323Capabilities (const H323Connection &connection, const H245_TerminalCapabilitySet &pdu)
| H323Capabilities (const H323Capabilities &original)
H323Capabilities & | operator= (const H323Capabilities &original)
Overrides from class PObject
void | PrintOn (ostream &strm) const
Operations
PINDEX | GetSize () const
H323Capability & | operator[] (PINDEX i) const
PINDEX | SetCapability (PINDEX descriptorNum, PINDEX simultaneous, H323Capability *cap)
PINDEX | AddMediaFormat (PINDEX descriptorNum, PINDEX simultaneous, const OpalMediaFormat &mediaFormat, H323Capability::CapabilityDirection direction=H323Capability::e_Receive)
PINDEX | AddAllCapabilities (PINDEX descriptorNum, PINDEX simultaneous, const PString &name, PBoolean exact=false)
PINDEX | AddAllCapabilities (const H323EndPoint &, PINDEX descriptorNum, PINDEX simultaneous, const PString &name, PBoolean exact=false)
void | Add (H323Capability *capability)
H323Capability * | Copy (const H323Capability &capability)
void | Remove (H323Capability *capability)
void | Remove (const PString &formatName)
void | Remove (const PStringArray &formatNames)
void | RemoveAll ()
H323Capability * | FindCapability (unsigned capabilityNumber) const
H323Capability * | FindCapability (const PString &formatName, H323Capability::CapabilityDirection direction=H323Capability::e_Unknown, PBoolean exact=false) const
H323Capability * | FindCapability (H323Capability::CapabilityDirection direction) const
H323Capability * | FindCapability (const H323Capability &capability) const
H323Capability * | FindCapability (const H245_Capability &cap) const
H323Capability * | FindCapability (const H245_DataType &dataType, const PString &mediaPacketization=PString::Empty()) const
H323Capability * | FindCapability (const H245_ModeElement &modeElement, const PString &mediaPacketization=PString::Empty()) const
H323Capability * | FindCapability (H323Capability::MainTypes mainType, unsigned subType=UINT_MAX) const
void | BuildPDU (const H323Connection &connection, H245_TerminalCapabilitySet &pdu) const
PBoolean | Merge (const H323Capabilities &newCaps)
void | Reorder (const PStringArray &preferenceOrder)
PBoolean | IsAllowed (const H323Capability &capability)
PBoolean | IsAllowed (unsigned capabilityNumber)
PBoolean | IsAllowed (const H323Capability &capability1, const H323Capability &capability2)
PBoolean | IsAllowed (unsigned capabilityNumber1, unsigned capabilityNumber2)
OpalMediaFormatList | GetMediaFormats () const
const PStringSet & | GetMediaPacketizations () const

## Protected Attributes

H323CapabilitiesList | table
H323CapabilitiesSet | set
PStringSet | m_mediaPacketizations

## Detailed Description

This class contains all of the capabilities and their combinations.

## Constructor & Destructor Documentation

H323Capabilities::H323Capabilities | ( |  | ) |

Construct an empty capability set.

H323Capabilities::H323Capabilities | ( | const H323Connection & | connection,
|  | const H245_TerminalCapabilitySet & | pdu |
| ) |  |  |

Construct a capability set from the H.245 PDU provided.

Parameters:

  connection | Connection for capabilities
  pdu | PDU to convert to a capability set.

H323Capabilities::H323Capabilities | ( | const H323Capabilities & | original | ) |

Construct a copy of a capability set. Note this will completely duplicate the set by making clones of every capability in the original set.

Parameters:

  original | Original capabilities to duplicate

## Member Function Documentation

void H323Capabilities::Add | ( | H323Capability * | capability | ) |

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.

Parameters:

  capability | New capability specification

PINDEX H323Capabilities::AddAllCapabilities | ( | const H323EndPoint & | ,
|  | PINDEX | descriptorNum,
|  | PINDEX | simultaneous,
|  | const PString & | name,
|  | PBoolean | exact = `false` |
| ) |  |  | `[inline]`

Parameters:

  descriptorNum | The member of the capabilityDescriptor to add
  simultaneous | The member of the SimultaneousCapabilitySet to add
  name | New capabilities name, if using "known" one.
  exact | Capability name must be exact match

PINDEX H323Capabilities::AddAllCapabilities | ( | PINDEX | descriptorNum,
|  | PINDEX | simultaneous,
|  | const PString & | name,
|  | PBoolean | exact = `false` |
| ) |  |  |

Add all matching capabilities to descriptor lists. All capabilities that match the specified name are added as in the other form of the SetCapability() function.

Parameters:

  descriptorNum | The member of the capabilityDescriptor to add
  simultaneous | The member of the SimultaneousCapabilitySet to add
  name | New capabilities name, if using "known" one.
  exact | Capability name must be exact match

PINDEX H323Capabilities::AddMediaFormat | ( | PINDEX | descriptorNum,
|  | PINDEX | simultaneous,
|  | const OpalMediaFormat & | mediaFormat,
|  | H323Capability::CapabilityDirection | direction = `H323Capability::e_Receive` |
| ) |  |  |

Add matching capability to media format.

Parameters:

  descriptorNum | The member of the capabilityDescriptor to add
  simultaneous | The member of the SimultaneousCapabilitySet to add
  mediaFormat | Media format to add.
  direction | Indicate capability direction

void H323Capabilities::BuildPDU | ( | const H323Connection & | connection,
|  | H245_TerminalCapabilitySet & | pdu |
| ) |  |  | const

Build a H.245 PDU from the information in the capability set.

Parameters:

  connection | Connection building PDU for
  pdu | PDU to build

H323Capability* H323Capabilities::Copy | ( | const H323Capability & | capability | ) |

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.

Parameters:

  capability | New capability specification

H323Capability* H323Capabilities::FindCapability | ( | H323Capability::MainTypes | mainType,
|  | unsigned | subType = `UINT_MAX` |
| ) |  |  | const

Find the capability given the type codecs.

Returns: NULL if no capability meeting the criteria was found

Parameters:

  mainType | Main type to find
  subType | Sub-type to find (UINT_MAX=ignore)

H323Capability* H323Capabilities::FindCapability | ( | const H245_ModeElement & | modeElement,
|  | const PString & | mediaPacketization = `PString::Empty()` |
| ) |  |  | const

Find the capability given the H.245 data type PDU.

Returns: NULL if no capability meeting the criteria was found

Parameters:

  modeElement | H245 data type of codec
  mediaPacketization | Media packetization, if present

H323Capability* H323Capabilities::FindCapability | ( | const H245_DataType & | dataType,
|  | const PString & | mediaPacketization = `PString::Empty()` |
| ) |  |  | const

Find the capability given the H.245 data type PDU.

Returns: NULL if no capability meeting the criteria was found

Parameters:

  dataType | H245 data type of codec
  mediaPacketization | Media packetization, if present

H323Capability* H323Capabilities::FindCapability | ( | const H245_Capability & | cap | ) | const

Find the capability given the H.245 capability PDU.

Returns: NULL if no capability meeting the criteria was found

Parameters:

  cap | H245 capability table entry

H323Capability* H323Capabilities::FindCapability | ( | const H323Capability & | capability | ) | 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

Parameters:

  capability | Capability to search for

H323Capability* H323Capabilities::FindCapability | ( | H323Capability::CapabilityDirection | direction | ) | const

Find the first capability in the table of the specified direction.

Returns: NULL if no capability meeting the criteria was found

Parameters:

  direction | Direction to search for

H323Capability* H323Capabilities::FindCapability | ( | const PString & | formatName,
|  | H323Capability::CapabilityDirection | direction = `H323Capability::e_Unknown`,
|  | PBoolean | exact = `false` |
| ) |  |  | 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". Note case is not significant.

The user should be carefull of using short strings such as "G"!

The direction parameter can further refine the search for specific receive or transmit capabilities. The default value of e_Unknown will wildcard that field.

Returns: NULL if no capability meeting the criteria was found

Parameters:

  formatName | Wildcard format name to search for
  direction | Optional direction to include into search criteria
  exact | Capability name must be exact match

H323Capability* H323Capabilities::FindCapability | ( | unsigned | capabilityNumber | ) | const

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

OpalMediaFormatList H323Capabilities::GetMediaFormats | ( |  | ) | const

Get the list of capabilities as a list of media formats.

const PStringSet& H323Capabilities::GetMediaPacketizations | ( |  | ) | const`[inline]`

PINDEX H323Capabilities::GetSize | ( |  | ) | const`[inline]`

Get the number of capabilities in the set.

PBoolean H323Capabilities::IsAllowed | ( | unsigned | capabilityNumber1,
|  | unsigned | capabilityNumber2 |
| ) |  |  |

Test if the capabilities are an allowed combination.

PBoolean H323Capabilities::IsAllowed | ( | const H323Capability & | capability1,
|  | const H323Capability & | capability2 |
| ) |  |  |

Test if the capabilities are an allowed combination.

PBoolean H323Capabilities::IsAllowed | ( | unsigned | capabilityNumber | ) |

Test if the capability is allowed.

PBoolean H323Capabilities::IsAllowed | ( | const H323Capability & | capability | ) |

Test if the capability is allowed.

PBoolean H323Capabilities::Merge | ( | const H323Capabilities & | newCaps | ) |

Merge the capabilities into this set.

H323Capabilities& H323Capabilities::operator= | ( | const H323Capabilities & | original | ) |

Assign a copy of a capability set. Note this will completely duplicate the set by making clones of every capability in the original set.

Parameters:

  original | Original capabilities to duplicate

H323Capability& H323Capabilities::operator[] | ( | PINDEX | i | ) | const`[inline]`

Get the capability at the specified index.

void H323Capabilities::PrintOn | ( | ostream & | strm | ) | const

Print out the object to the stream, virtual version of << operator.

Parameters:

  strm | Stream to print out to.

void H323Capabilities::Remove | ( | const PStringArray & | formatNames | ) |

Remove all capabilities matching any of the strings provided. This simply calls Remove() for each string in the list.

Parameters:

  formatNames | Array of format names to remove

void H323Capabilities::Remove | ( | const PString & | formatName | ) |

Remove all capabilities matching the string. This uses FindCapability() to locate the first capability whose format name does a partial match for the argument.

Parameters:

  formatName | Format name to search for.

void H323Capabilities::Remove | ( | H323Capability * | capability | ) |

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.

Parameters:

  capability | Existing capability specification

void H323Capabilities::RemoveAll | ( |  | ) |

Remove all of the capabilities.

void H323Capabilities::Reorder | ( | const PStringArray & | preferenceOrder | ) |

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.

Parameters:

  preferenceOrder | New order

PINDEX H323Capabilities::SetCapability | ( | PINDEX | descriptorNum,
|  | PINDEX | simultaneous,
|  | H323Capability * | cap |
| ) |  |  |

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.

Parameters:

  descriptorNum | The member of the capabilityDescriptor to add
  simultaneous | The member of the SimultaneousCapabilitySet to add
  cap | New capability specification

## Field Documentation

PStringSet H323Capabilities::m_mediaPacketizations `[protected]`

H323CapabilitiesSet H323Capabilities::set `[protected]`

H323CapabilitiesList H323Capabilities::table `[protected]`

The documentation for this class was generated from the following file:

- h323caps.h