X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=include%2Flibnfs-private.h;h=a083b37031100b82fafea1d85b2267ebcb8b18a9;hb=e01ed6a239175772baf904d66105766f825fc1d4;hp=b7399acaab42ce45d6e20dc2d75e005b2d714405;hpb=1896d37bfaae78bfa0e6ee3e3fb19b0a92bb1adb;p=deb_libnfs.git
diff --git a/include/libnfs-private.h b/include/libnfs-private.h
index b7399ac..a083b37 100644
--- a/include/libnfs-private.h
+++ b/include/libnfs-private.h
@@ -14,8 +14,15 @@
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see .
*/
+#include
#include
+struct rpc_fragment {
+ struct rpc_fragment *next;
+ uint64_t size;
+ char *data;
+};
+
struct rpc_context {
int fd;
int is_connected;
@@ -33,11 +40,24 @@ struct rpc_context {
int encodebuflen;
struct rpc_pdu *outqueue;
+ struct sockaddr_storage udp_src;
struct rpc_pdu *waitpdu;
- int insize;
int inpos;
+ int insize;
char *inbuf;
+
+ /* special fields for UDP, which can sometimes be BROADCASTed */
+ int is_udp;
+ struct sockaddr *udp_dest;
+ int is_broadcast;
+
+ /* track the address we connect to so we can auto-reconnect on session failure */
+ struct sockaddr_storage s;
+ int auto_reconnect;
+
+ /* fragment reassembly */
+ struct rpc_fragment *fragments;
};
struct rpc_pdu {
@@ -68,4 +88,19 @@ void rpc_error_all_pdus(struct rpc_context *rpc, char *error);
void rpc_set_error(struct rpc_context *rpc, char *error_string, ...);
void nfs_set_error(struct nfs_context *nfs, char *error_string, ...);
+const char *nfs_get_server(struct nfs_context *nfs);
+const char *nfs_get_export(struct nfs_context *nfs);
+
+/* we dont want to expose UDP to normal applications/users this is private to libnfs to use exclusively for broadcast RPC */
+int rpc_bind_udp(struct rpc_context *rpc, char *addr, int port);
+int rpc_set_udp_destination(struct rpc_context *rpc, char *addr, int port, int is_broadcast);
+struct rpc_context *rpc_init_udp_context(void);
+struct sockaddr *rpc_get_recv_sockaddr(struct rpc_context *rpc);
+
+void rpc_set_autoreconnect(struct rpc_context *rpc);
+void rpc_unset_autoreconnect(struct rpc_context *rpc);
+
+int rpc_add_fragment(struct rpc_context *rpc, char *data, uint64_t size);
+void rpc_free_all_fragments(struct rpc_context *rpc);
+const struct nfs_fh3 *nfs_get_rootfh(struct nfs_context *nfs);