libnatpmp

Library for NAT port mapping using the UPnP Internet Gateway Device protocol.

brewmacoslinux
Try with needOr install directly
Source

About

NAT port mapping protocol library

Examples

map a local port to external network for incoming connections$ libnatpmp is a C library - use it in your application code or via language bindings
automatically open ports on home router without manual configuration$ include libnatpmp in your C/C++ project and call natpmp_init() to discover gateway
forward ports programmatically from inside an application$ link against libnatpmp and use sendnewportmappingrequest() to request port mappings
close port mappings when application stops$ call sendnewportmappingrequest() with lifetime 0 to remove port mapping rules
detect NAT device and get external IP address$ use natpmp_sendpublicaddressrequest() to query gateway for public facing IP