diff options
Diffstat (limited to 'include/linux/sunrpc/clnt.h')
-rw-r--r-- | include/linux/sunrpc/clnt.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 37881f1a0bd7..2636e8ad551c 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -9,6 +9,10 @@ | |||
9 | #ifndef _LINUX_SUNRPC_CLNT_H | 9 | #ifndef _LINUX_SUNRPC_CLNT_H |
10 | #define _LINUX_SUNRPC_CLNT_H | 10 | #define _LINUX_SUNRPC_CLNT_H |
11 | 11 | ||
12 | #include <linux/socket.h> | ||
13 | #include <linux/in.h> | ||
14 | #include <linux/in6.h> | ||
15 | |||
12 | #include <linux/sunrpc/msg_prot.h> | 16 | #include <linux/sunrpc/msg_prot.h> |
13 | #include <linux/sunrpc/sched.h> | 17 | #include <linux/sunrpc/sched.h> |
14 | #include <linux/sunrpc/xprt.h> | 18 | #include <linux/sunrpc/xprt.h> |
@@ -151,5 +155,39 @@ void rpc_force_rebind(struct rpc_clnt *); | |||
151 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); | 155 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); |
152 | const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); | 156 | const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); |
153 | 157 | ||
158 | size_t rpc_ntop(const struct sockaddr *, char *, const size_t); | ||
159 | size_t rpc_pton(const char *, const size_t, | ||
160 | struct sockaddr *, const size_t); | ||
161 | char * rpc_sockaddr2uaddr(const struct sockaddr *); | ||
162 | size_t rpc_uaddr2sockaddr(const char *, const size_t, | ||
163 | struct sockaddr *, const size_t); | ||
164 | |||
165 | static inline unsigned short rpc_get_port(const struct sockaddr *sap) | ||
166 | { | ||
167 | switch (sap->sa_family) { | ||
168 | case AF_INET: | ||
169 | return ntohs(((struct sockaddr_in *)sap)->sin_port); | ||
170 | case AF_INET6: | ||
171 | return ntohs(((struct sockaddr_in6 *)sap)->sin6_port); | ||
172 | } | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static inline void rpc_set_port(struct sockaddr *sap, | ||
177 | const unsigned short port) | ||
178 | { | ||
179 | switch (sap->sa_family) { | ||
180 | case AF_INET: | ||
181 | ((struct sockaddr_in *)sap)->sin_port = htons(port); | ||
182 | break; | ||
183 | case AF_INET6: | ||
184 | ((struct sockaddr_in6 *)sap)->sin6_port = htons(port); | ||
185 | break; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | #define IPV6_SCOPE_DELIMITER '%' | ||
190 | #define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn") | ||
191 | |||
154 | #endif /* __KERNEL__ */ | 192 | #endif /* __KERNEL__ */ |
155 | #endif /* _LINUX_SUNRPC_CLNT_H */ | 193 | #endif /* _LINUX_SUNRPC_CLNT_H */ |