1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  14  */
  15 
  16 #ifndef _KRRP_IOCTL_COMMON_H
  17 #define _KRRP_IOCTL_COMMON_H
  18 
  19 #include <sys/types.h>
  20 
  21 #ifdef __cplusplus
  22 extern "C" {
  23 #endif
  24 
  25 #define KRRP_IOCTL_FLAG_RESULT  0x00000001
  26 #define KRRP_IOCTL_FLAG_ERROR   0x00000002
  27 
  28 /*
  29  * Do not forget to bump the version
  30  * if the order in KRRP_IOCTL_MAP
  31  * needs to be changed
  32  */
  33 #define KRRP_IOCTL_VERSION 0x04
  34 
  35 #define KRRP_IOCTL_MAP(X) \
  36         X(SVC_ENABLE) \
  37         X(SVC_DISABLE) \
  38         X(SVC_STATE) \
  39         X(SVC_GET_CONFIG) \
  40         X(SVC_SET_CONFIG) \
  41         X(SESS_LIST) \
  42         X(SESS_STATUS) \
  43         X(SESS_CREATE) \
  44         X(SESS_DESTROY) \
  45         X(SESS_CREATE_CONN) \
  46         X(SESS_CREATE_PDU_ENGINE) \
  47         X(SESS_CREATE_READ_STREAM) \
  48         X(SESS_CREATE_WRITE_STREAM) \
  49         X(SESS_RUN) \
  50         X(SESS_SEND_STOP) \
  51         X(SESS_CONN_THROTTLE) \
  52         X(SESS_SET_PRIVATE_DATA) \
  53         X(SESS_GET_PRIVATE_DATA) \
  54         X(SESS_GET_CONN_INFO) \
  55 
  56 #define KRRP_IOCTL_EXPAND(enum_name) KRRP_IOCTL_##enum_name,
  57 typedef enum {
  58         KRRP_IOCTL_FIRST = (KRRP_IOCTL_VERSION << 24 | 'K' << 16 | 'R' << 8),
  59         KRRP_IOCTL_MAP(KRRP_IOCTL_EXPAND)
  60         KRRP_IOCTL_LAST
  61 } krrp_ioctl_cmd_t;
  62 #undef KRRP_IOCTL_EXPAND
  63 
  64 typedef struct krrp_ioctl_data_s {
  65         uint32_t        buf_size;
  66         uint32_t        data_size;
  67         uint32_t        in_flags;
  68         uint32_t        out_flags;
  69         char            buf[1];
  70 } krrp_ioctl_data_t;
  71 
  72 const char *krrp_ioctl_cmd_to_str(krrp_ioctl_cmd_t cmd);
  73 
  74 #ifdef __cplusplus
  75 }
  76 #endif
  77 
  78 #endif /* _KRRP_IOCTL_COMMON_H */