PMAP: allow to ask for tcp/udp port, dont assume users only ever want the tcp port
[deb_libnfs.git] / portmap / portmap.c
index 431fb1560b9e0d94a636f779bfc07b24d447cab6..d2ec4b883cba60c7401379a1faa2012c96451829 100644 (file)
    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
-
-#if defined(WIN32)
-#include <winsock2.h>
-#endif
+#ifdef WIN32
+#include "win32_compat.h"
+#endif/*WIN32*/
 
 #include <stdio.h>
 #include <rpc/rpc.h>
@@ -47,7 +46,7 @@ int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
        return 0;
 }
 
-int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, rpc_cb cb, void *private_data)
+int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data)
 {
        struct rpc_pdu *pdu;
        struct pmap_mapping m;
@@ -60,7 +59,7 @@ int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, rp
 
        m.prog = program;
        m.vers = version;
-       m.prot = IPPROTO_TCP;
+       m.prot = protocol;
        m.port = 0;
        if (xdr_pmap_mapping(&pdu->xdr, &m) == 0) {
                rpc_set_error(rpc, "XDR error: Failed to encode data for portmap/getport call");