Partager via


IRTCPortManager::GetMapping (Windows Embedded CE 6.0)

1/6/2010

This method retrieves internal and external (on the NAT) IP addresses and port mappings when given a remote address and port type for the port. If a mapping is not available, the application should return a failure code. The operation requiring the mapping will fail.

Syntax

HRESULT GetMapping(
  BSTR bstrRemoteAddress,
  RTC_PORT_TYPE enPortType,
  BSTR* pbstrInternalLocalAddress,
  long* plInternalLocalPort,
  BSTR* pbstrExternalLocalAddress,
  long* plExternalLocalPort
);

Parameters

  • bstrRemoteAddress
    [in] 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 assume this will be an IPv4 address.
  • enPortType
    [in] An RTC_PORT_TYPE enumeration value used to inform the application of 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] Pointer to the client's internal IP address. On output, this parameter is a BSTR that will be filled with the client's internal IP address, or an empty string if there is no entry. The application is responsible for allocating the buffer. The RTC Client API is responsible for releasing this memory with SysFreeString.
  • plInternalLocalPort
    [in, out] Pointer to the client's internal port.
  • pbstrExternalLocalAddress
    [in, out] Pointer to the external IP address of the NAT. On output, this parameter is a BSTR that will be filled with the external IP address of the NAT, or an empty string if there is no entry. The application is responsible for allocating the buffer. The RTC Client API is responsible for releasing this memory with SysFreeString.
  • plExternalLocalPort
    [in, out] Pointer to the external port of the NAT.

Return Value

This method can return an RTC_E_ constant, as well as any of the standard COM and ADSI return values. The following table shows additional possible return values.

Value Description

S_OK

NAT mapping was retrieved.

E_FAIL

NAT mapping was not retrieved.

Remarks

Security Note   This method can send data over the network in unencrypted form. Therefore, someone eavesdropping on the network might be able to read the data. Before using this method in an unencrypted session, consider the security risk of sending the data in clear text. The application can encrypt an RTC session by specifying TLS in the profile used for the session.

Requirements

Header rtccore.h, rtccore.idl
Library uuid.lib
Windows Embedded CE Windows CE .NET 4.2 and later

See Also

Reference

IRTCPortManager
IRTCPortManager::ReleaseMapping
RTC_PORT_TYPE

Other Resources

SysFreeString