Does the UPnP IGD support aotu allocating ports to UPnP CP?

"seaman" <[email protected]> Fri, 5 Sep 2003 09:20:14 +0900
Newsgroups gmane.linux.upnp-sdk.general
Message-ID <[email protected]>
Hello,everybody

    When we send "AddPortMapping" action to UPnP IGD,if I didn't specify
"NewInternalPort" and "NewExternalPort",Does the UPnP IGD aotu allocate
ports to UPnP CP? My src following :

int add_one_port (char *protocol, char *port)

{

              …………………………………..

              actionRequest = UpnpMakeAction("AddPortMapping",
igd_node_info.GateService.ServiceType,0,NULL);

              UpnpAddToAction(&actionRequest,"AddPortMapping",


igd_node_info.GateService.ServiceType,"NewRemoteHost",NULL);

              UpnpAddToAction(&actionRequest,"AddPortMapping",


igd_node_info.GateService.ServiceType,"NewExternalPort",port);//if here
port=NULL or 0,then IGD can auto allocate one port???

              UpnpAddToAction(&actionRequest,"AddPortMapping",


igd_node_info.GateService.ServiceType,"NewProtocol",protocol);

              UpnpAddToAction(&actionRequest,"AddPortMapping",


igd_node_info.GateService.ServiceType,"NewInternalPort",port);

              UpnpAddToAction(&actionRequest,"AddPortMapping",);//if here
port=NULL or 0,then IGD can auto allocate one port???

…………………………………………………..

              ret = UpnpSendAction( ctrlpt_handle,
igd_node_info.GateService.ControlURL
igd_node_info.GateService.ServiceType, igd_node_info.UDN, actionRequest,
&actionResult);

              if (ret = UPNP_E_SUCCESS) {

                            *port =
SampleUtil_GetFirstDocumentItem(actionResult, "NewInternalPort");

              }//So here we can get the port auto allocated from IGD???

              if (actionRequest) UpnpDocument_free(actionRequest);

              if (actionResult) UpnpDocument_free(actionResult);

              return ret;

}