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 2015 Nexenta Systems, Inc.  All rights reserved.
  14  */
  15 
  16 #ifndef _KRRP_PROTOCOL_H
  17 #define _KRRP_PROTOCOL_H
  18 
  19 #ifdef __cplusplus
  20 extern "C" {
  21 #endif
  22 
  23 #define KRRP_CTRL_OPCODE_MASK   0x1000
  24 
  25 /* Data PDU opcodes */
  26 #define KRRP_OPCODES_DATA_MAP(X)        \
  27         X(DATA_WRITE)                                   \
  28 
  29 /* Ctrl PDU opcodes */
  30 #define KRRP_OPCODES_CTRL_MAP(X)        \
  31         X(ERROR)                                                \
  32         X(ATTACH_SESS)                                  \
  33         X(PING)                                                 \
  34         X(PONG)                                                 \
  35         X(FL_CTRL_UPDATE)                               \
  36         X(TXG_ACK)                                              \
  37         X(TXG_ACK2)                                             \
  38         X(SEND_DONE)                                    \
  39         X(SHUTDOWN)                                             \
  40 
  41 #define KRRP_OPCODE_EXPAND(enum_name) KRRP_OPCODE_##enum_name,
  42 typedef enum {
  43         KRRP_OPCODE_DATA_FIRST = 0,
  44         KRRP_OPCODES_DATA_MAP(KRRP_OPCODE_EXPAND)
  45 
  46         KRRP_OPCODE_CTRL_FIRST = KRRP_CTRL_OPCODE_MASK,
  47         KRRP_OPCODES_CTRL_MAP(KRRP_OPCODE_EXPAND)
  48         KRRP_OPCODE_DATA_LAST
  49 } krrp_opcode_t;
  50 #undef KRRP_OPCODE_EXPAND
  51 
  52 const char *krrp_protocol_opcode_str(krrp_opcode_t);
  53 
  54 #ifdef __cplusplus
  55 }
  56 #endif
  57 
  58 #endif /* _KRRP_PROTOCOL_H */