WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJNATH Reference

Simple UPnP Client

A simple UPnP client implementation. More...

Data Structures

struct  pj_upnp_init_param
 

Functions

pj_status_t pj_upnp_init (const pj_upnp_init_param *param)
 
pj_status_t pj_upnp_deinit (void)
 
pj_status_t pj_upnp_add_port_mapping (unsigned sock_cnt, const pj_sock_t sock[], unsigned ext_port[], pj_sockaddr mapped_addr[])
 
pj_status_t pj_upnp_del_port_mapping (const pj_sockaddr *mapped_addr)
 

Detailed Description

This is a simple implementation of UPnP client. Its main function is to request a port mapping from an Internet Gateway Device (IGD), which will redirect communication received on a specified external port to a local socket.

Function Documentation

◆ pj_upnp_add_port_mapping()

pj_status_t pj_upnp_add_port_mapping ( unsigned  sock_cnt,
const pj_sock_t  sock[],
unsigned  ext_port[],
pj_sockaddr  mapped_addr[] 
)

This is the main function to request a port mapping. If successful, the Internet Gateway Device will redirect communication received on the specified external ports to the local sockets.

Parameters
sock_cntNumber of sockets in the socket array.
sockArray of local UDP sockets that will be mapped.
ext_port(Optional) Array of external port numbers. If NULL, the external port numbers requested will be identical to the sockets' local port numbers.
mapped_addrArray to receive the mapped public addresses and ports of the local UDP sockets, when the function returns PJ_SUCCESS.
Returns
PJ_SUCCESS on success, or the appropriate error status.

◆ pj_upnp_deinit()

pj_status_t pj_upnp_deinit ( void  )

Deinitialize UPnP library.

Returns
PJ_SUCCESS on success, or the appropriate error status.

◆ pj_upnp_del_port_mapping()

pj_status_t pj_upnp_del_port_mapping ( const pj_sockaddr mapped_addr)

Send request to delete a port mapping.

Parameters
mapped_addrThe public address and external port mapping to be deleted.
Returns
PJ_SUCCESS on success, or the appropriate error status.

References PJ_END_DECL.

◆ pj_upnp_init()

pj_status_t pj_upnp_init ( const pj_upnp_init_param param)

Initialize UPnP library and initiate the search for valid Internet Gateway Devices (IGD) in the network.

Parameters
paramThe UPnP initialization parameter.
Returns
PJ_SUCCESS on success, or the appropriate error status.

 


PJNATH - Open Source NAT traversal helper library supporting STUN, TURN, and ICE
Copyright (C) 2006-2009 Teluu Inc.