IRTCPortManager::GetMapping

The GetMapping method returns internal and external (on the NAT) IP address and port mappings given a remote address and port type for the port. If a mapping is not available, the application should return an error result and the operation requiring the mapping will fail.

HRESULT GetMapping(BSTRbstrRemoteAddress,
RTC_PORT_TYPEenPortType,
BSTR*pbstrInternalLocalAddress,
long*plInternalLocalPort,
BSTR*pbstrExternalLocalAddress,
long*plExternalLocalPort);

Parameters

  • bstrRemoteAddress
    [in] A string that contains the IP address of the remote endpoint for which the NAT mapping is required. Currently, this parameter will contain an IPv4 dotted address. However, in the future an IPv6 address may also be entered in this parameter. The application must not, therefore, assume this will be an IPv4 address.
  • enPortType
    [in] The RTC_PORT_TYPE enumeration is used to inform the application which type of UDP port is required. Initially this will only be audio RTP and RTCP. When PC-to-PC calls are allowed, this will also include video RTP and RTCP.
  • pbstrInternalLocalAddress
    [in, out] When the method returns, this should contain a pointer to a string that contains the client's internal IP address. The application is responsible for allocating the BSTR and the RTC Client API is responsible for releasing the BSTR.
  • plInternalLocalPort
    [in, out] When the method returns, this should contain the client's internal port.
  • pbstrExternalLocalAddress
    [in, out] When the method returns this should contain a pointer to a string that contains the NAT's external IP address. The application is responsible for allocating the BSTR and the RTC Client API is responsible for releasing the BSTR.
  • plExternalLocalPort
    [in, out] When the method returns, this should contain the NAT's external port.

Return Values

RTC methods may return an RTC_E_ constant as well as any of the standard COM and ADSI return values.

Return code Description
S_OK The NAT mapping has been returned.
E_FAIL The NAT mapping has not been returned.

Requirements

Client: Requires Windows XP SP1.
Server: Requires Windows Server 2003.
Redistributable: Requires Rtcdll.dll on Windows 2000, Windows XP, and Windows Me/98.
Header: Declared in Rtccore.h.
Library: Included as a resource in Rtcdll.dll.
GUID: IID_IRTCPortManager is defined as DA77C14B-6208-43ca-8DDF-5B60A0A69FAC.

See Also

IRTCSessionPortManagement, IRTCPortManager, IRTCPortManager::ReleaseMapping