xref: /freebsd/sys/fs/p9fs/p9_transport.h (revision 95eb4b873b6a8b527c5bd78d7191975dfca38998)
1 /*-
2  * Copyright (c) 2017 Juniper Networks, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  */
26 
27 /* Transport definitions */
28 #ifndef FS_P9FS_P9_TRANSPORT_H
29 #define FS_P9FS_P9_TRANSPORT_H
30 
31 #include <sys/queue.h>
32 
33 struct p9_req_t;
34 
35 /* Tranport module interface */
36 struct p9_trans_module {
37 	TAILQ_ENTRY(p9_trans_module) link;
38 	char *name;			/* name of transport */
39 	/* member function to create a new conection on this transport*/
40 	int (*create)(const char *mount_tag, void **handlep);
41 	/* member function to terminate a connection on this transport */
42 	void (*close) (void *handle);
43 	/* member function to issue a request to the transport*/
44 	int (*request) (void *handle, struct p9_req_t *req);
45 	/* member function to cancel a request if it has been sent */
46 	int (*cancel) (void *handle, struct p9_req_t *req);
47 };
48 
49 void p9_register_trans(struct p9_trans_module *m);
50 void p9_unregister_trans(struct p9_trans_module *m);
51 struct p9_trans_module *p9_get_trans_by_name(char *s);
52 
53 #endif /* FS_P9FS_P9_TRANSPORT_H */
54