Debian Codegraph @

include/rpc_subs.h

raw
1 /* ----------------------------------------------------------------------- *
2 *
3 * rpc_subs.h - header file for rpc discovery
4 *
5 * Copyright 2004 Jeff Moyer <[email protected]> - All Rights Reserved
6 * Copyright 2004-2006 Ian Kent <[email protected]> - All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
11 * USA; either version 2 of the License, or (at your option) any later
12 * version; incorporated herein by reference.
13 *
14 * ----------------------------------------------------------------------- */
15
16 #ifndef _RPC_SUBS_H
17 #define _RPC_SUBS_H
18
19 #include <rpc/rpc.h>
20 #include <rpc/types.h>
21 #include <rpc/pmap_prot.h>
22 #include <linux/nfs.h>
23 #include <linux/nfs2.h>
24 #include <linux/nfs3.h>
25
26 #include "automount.h"
27
28 #define NFS4_VERSION 4
29
30 /* rpc helper subs */
31 #define RPC_PING_FAIL 0x0000
32 #define RPC_PING_V2 NFS2_VERSION
33 #define RPC_PING_V3 NFS3_VERSION
34 #define RPC_PING_V4 NFS4_VERSION
35 #define RPC_PING_UDP 0x0100
36 #define RPC_PING_TCP 0x0200
37 /*
38 * Close options to allow some choice in how and where the TIMED_WAIT
39 * happens.
40 */
41 #define RPC_CLOSE_DEFAULT 0x0000
42 #define RPC_CLOSE_ACTIVE RPC_CLOSE_DEFAULT
43 #define RPC_CLOSE_NOLINGER 0x0001
44
45 #define PMAP_TOUT_UDP 3
46 #define PMAP_TOUT_TCP 5
47
48 #define RPC_TOUT_UDP PMAP_TOUT_UDP
49 #define RPC_TOUT_TCP PMAP_TOUT_TCP
50
51 #define HOST_ENT_BUF_SIZE 2048
52
53 struct hostinfo {
54 char *name;
55 struct hostinfo *next;
56 };
57
58 struct exportinfo {
59 char *dir;
60 struct hostinfo *hosts;
61 struct exportinfo *next;
62 struct tree_node node;
63 };
64
65 struct conn_info {
66 const char *host;
67 struct sockaddr *addr;
68 size_t addr_len;
69 unsigned short port;
70 unsigned long program;
71 unsigned long version;
72 int proto;
73 unsigned int send_sz;
74 unsigned int recv_sz;
75 struct timeval timeout;
76 unsigned int close_option;
77 CLIENT *client;
78 };
79
80 int rpc_udp_getclient(struct conn_info *, unsigned int, unsigned int);
81 void rpc_destroy_udp_client(struct conn_info *);
82 int rpc_tcp_getclient(struct conn_info *, unsigned int, unsigned int);
83 void rpc_destroy_tcp_client(struct conn_info *);
84 int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, int, unsigned int);
85 int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *);
86 int rpc_ping_proto(struct conn_info *);
87 int rpc_ping(const char *, int, unsigned int, long, long, unsigned int);
88 double monotonic_elapsed(struct timespec, struct timespec);
89 struct exportinfo *rpc_get_exports(const char *host, long seconds, long micros, unsigned int option);
90 void rpc_exports_free(struct exportinfo *exports);
91 const char *get_addr_string(struct sockaddr *, char *, socklen_t);
92
93 #endif
94