Add configure checks for whether netinet/in.h is available or not
[deb_libnfs.git] / examples / nfsclient-raw.c
index 7956781a1b9f62cce46e2f1df65dd6cbb35b260d..80a38f0a07944209137395477f87275ef9206438 100644 (file)
 /* Example program using the lowlevel raw interface.
  * This allow accurate control of the exact commands that are being used.
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
+#ifdef WIN32
+#include "win32_compat.h"
+#endif
 #define SERVER "10.1.1.27"
 #define EXPORT "/shared"
 
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <poll.h>
+#include "libnfs-zdr.h"
 #include "libnfs.h"
 #include "libnfs-raw.h"
 #include "libnfs-raw-mount.h"
@@ -113,11 +127,14 @@ void acl_getacl_cb(struct rpc_context *rpc _U_, int status, void *data, void *pr
 void acl_null_cb(struct rpc_context *rpc _U_, int status, void *data, void *private_data)
 {
        struct client *client = private_data;
+       GETACL3args args;
 
        printf("Got NFSACL/NULL reply\n");
        printf("Get ACL for root handle\n");
 
-       if (rpc_nfsacl_getacl_async(rpc, acl_getacl_cb, &client->rootfh, NFSACL_MASK_ACL_ENTRY|NFSACL_MASK_ACL_COUNT|NFSACL_MASK_ACL_DEFAULT_ENTRY|NFSACL_MASK_ACL_DEFAULT_COUNT, client) != 0) {
+       args.dir = client->rootfh;
+       args.mask = NFSACL_MASK_ACL_ENTRY|NFSACL_MASK_ACL_COUNT|NFSACL_MASK_ACL_DEFAULT_ENTRY|NFSACL_MASK_ACL_DEFAULT_COUNT;
+       if (rpc_nfsacl_getacl_async(rpc, acl_getacl_cb, &args, client) != 0) {
                printf("Failed to send getacl request\n");
                exit(10);
        }
@@ -320,7 +337,7 @@ void pmap_getport1_cb(struct rpc_context *rpc, int status, void *data, void *pri
        }               
 
        printf("Send getport request asking for MOUNT port\n");
-       if (rpc_pmap_getport_async(rpc, MOUNT_PROGRAM, MOUNT_V3, pmap_getport2_cb, client) != 0) {
+       if (rpc_pmap_getport_async(rpc, MOUNT_PROGRAM, MOUNT_V3, IPPROTO_TCP, pmap_getport2_cb, client) != 0) {
                printf("Failed to send getport request\n");
                exit(10);
        }
@@ -341,7 +358,7 @@ void pmap_null_cb(struct rpc_context *rpc, int status, void *data, void *private
 
        printf("Got reply from server for PORTMAP/NULL procedure.\n");
        printf("Send getport request asking for MOUNT port\n");
-       if (rpc_pmap_getport_async(rpc, RQUOTA_PROGRAM, RQUOTA_V1, pmap_getport1_cb, client) != 0) {
+       if (rpc_pmap_getport_async(rpc, RQUOTA_PROGRAM, RQUOTA_V1, IPPROTO_TCP, pmap_getport1_cb, client) != 0) {
                printf("Failed to send getport request\n");
                exit(10);
        }