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