29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38 /* Copyright (c) 2007, The Storage Networking Industry Association. */
39 /* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
40 /*
41 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
42 */
43
44 #ifndef _NDMP_COMMON_H
45 #define _NDMP_COMMON_H
46
47 #include <thread.h>
48 #include <synch.h>
49 #include "ndmpd_log.h"
50 #include "ndmp.h"
51 #include <unistd.h>
52 #include <sys/types.h>
53 #include <rpc/rpc.h>
54 #include <sys/stat.h>
55 #include <stdio.h>
56 #include <bsm/adt.h>
57 #include <bsm/adt_event.h>
58
59
60 #define XDR_AND_SIZE(func) (bool_t(*)(XDR*, ...))xdr_##func, sizeof (func)
61 #define AUTH_REQUIRED TRUE
62 #define AUTH_NOT_REQUIRED FALSE
63 #define NDMP_EOM_MAGIC "PRCMEOM"
64 #define KILOBYTE 1024
65
66 #define INT_MAXCMD 12
67
68 extern mutex_t ndmpd_zfs_fd_lock;
69
70 /* Connection data structure. */
71 typedef struct msg_info {
72 ndmp_header mi_hdr;
73 struct ndmp_msg_handler *mi_handler;
74 void *mi_body;
75 } msg_info_t;
76
77 typedef struct ndmp_connection {
78 int conn_sock;
79 XDR conn_xdrs;
80 ulong_t conn_my_sequence;
81 boolean_t conn_authorized;
82 boolean_t conn_eof;
83 msg_info_t conn_msginfo; /* received request or reply message */
|
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38 /* Copyright (c) 2007, The Storage Networking Industry Association. */
39 /* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
40 /*
41 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
42 */
43
44 #ifndef _NDMP_COMMON_H
45 #define _NDMP_COMMON_H
46
47 #include <thread.h>
48 #include <synch.h>
49 #include "ndmp.h"
50 #include <unistd.h>
51 #include <sys/types.h>
52 #include <rpc/rpc.h>
53 #include <sys/stat.h>
54 #include <stdio.h>
55 #include <bsm/adt.h>
56 #include <bsm/adt_event.h>
57
58
59 #define XDR_AND_SIZE(func) (bool_t(*)(XDR*, ...))xdr_##func, sizeof (func)
60 #define AUTH_REQUIRED TRUE
61 #define AUTH_NOT_REQUIRED FALSE
62 #define NDMP_EOM_MAGIC "PRCMEOM"
63 #define NDMP_RCF_BASENAME "NdmpBackup"
64 #define KILOBYTE 1024
65
66 #define INT_MAXCMD 12
67
68 extern mutex_t ndmpd_zfs_fd_lock;
69
70 /* Connection data structure. */
71 typedef struct msg_info {
72 ndmp_header mi_hdr;
73 struct ndmp_msg_handler *mi_handler;
74 void *mi_body;
75 } msg_info_t;
76
77 typedef struct ndmp_connection {
78 int conn_sock;
79 XDR conn_xdrs;
80 ulong_t conn_my_sequence;
81 boolean_t conn_authorized;
82 boolean_t conn_eof;
83 msg_info_t conn_msginfo; /* received request or reply message */
|