#ifndef _ENCRYPTED_DOMAIN_H
#define _ENCRYPTED_DOMAIN_H

#include <linux/ioctl.h>

#define WIDTH_LIMIT 16
#define LENGTH_LIMIT 16

typedef struct {
  unsigned char op_type;
  unsigned char data_type;
  unsigned char width;
  unsigned char length;
  int input;
  int w;
} encrypted_domain_loading_t;

typedef struct {
  unsigned char reset;
  unsigned char done;
  unsigned char all_loaded;
} encrypted_domain_status_t;

typedef struct {
  int output_0;
  int output_1;
  int output_2;
  int output_3;
  int output_4;
  int output_5;
  int output_6;
  int output_7;
  int output_8;
  int output_9;
  int output_10;
  int output_11;
  int output_12;
  int output_13;
  int output_14;
  int output_15;
  int output;
  char output_length;
  char output_width;
  char done;
} encrypted_domain_output_t;

typedef struct {
  encrypted_domain_loading_t load_info;
  encrypted_domain_status_t status_info;
  encrypted_domain_output_t output_info;
} encrypted_domain_arg_t;

#define ENCRYPTED_DOMAIN_MAGIC 'q'

/* ioctls and their arguments */
#define ENCRYPTED_DOMAIN_WRITE _IOW(ENCRYPTED_DOMAIN_MAGIC, 1, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_WRITE_OP_TYPE _IOW(ENCRYPTED_DOMAIN_MAGIC, 2, ENCRYPTED_DOMAIN_arg_t *)
#define ENCRYPTED_DOMAIN_WRITE_DATA_TYPE _IOW(ENCRYPTED_DOMAIN_MAGIC, 3, ENCRYPTED_DOMAIN_arg_t *)
#define ENCRYPTED_DOMAIN_WRITE_WIDTH _IOW(ENCRYPTED_DOMAIN_MAGIC, 4, ENCRYPTED_DOMAIN_arg_t *)
#define ENCRYPTED_DOMAIN_WRITE_LENGTH _IOW(ENCRYPTED_DOMAIN_MAGIC, 5, ENCRYPTED_DOMAIN_arg_t *)
#define ENCRYPTED_DOMAIN_READ_0  _IOR(ENCRYPTED_DOMAIN_MAGIC, 6, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_1  _IOR(ENCRYPTED_DOMAIN_MAGIC, 7, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_2  _IOR(ENCRYPTED_DOMAIN_MAGIC, 8, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_3  _IOR(ENCRYPTED_DOMAIN_MAGIC, 9, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_4  _IOR(ENCRYPTED_DOMAIN_MAGIC, 10, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_5  _IOR(ENCRYPTED_DOMAIN_MAGIC, 11, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_6  _IOR(ENCRYPTED_DOMAIN_MAGIC, 12, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_7  _IOR(ENCRYPTED_DOMAIN_MAGIC, 13, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_8  _IOR(ENCRYPTED_DOMAIN_MAGIC, 14, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_9  _IOR(ENCRYPTED_DOMAIN_MAGIC, 15, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_10  _IOR(ENCRYPTED_DOMAIN_MAGIC, 16, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_11  _IOR(ENCRYPTED_DOMAIN_MAGIC, 17, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_12  _IOR(ENCRYPTED_DOMAIN_MAGIC, 18, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_13  _IOR(ENCRYPTED_DOMAIN_MAGIC, 19, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_14  _IOR(ENCRYPTED_DOMAIN_MAGIC, 20, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_15  _IOR(ENCRYPTED_DOMAIN_MAGIC, 21, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_WIDTH _IOR(ENCRYPTED_DOMAIN_MAGIC, 22, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_LENGTH _IOR(ENCRYPTED_DOMAIN_MAGIC, 23, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_READ_DONE _IOR(ENCRYPTED_DOMAIN_MAGIC, 24, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_WRITE_RESET _IOW(ENCRYPTED_DOMAIN_MAGIC, 25, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_WRITE_LOADED _IOW(ENCRYPTED_DOMAIN_MAGIC, 26, encrypted_domain_arg_t *)
#define ENCRYPTED_DOMAIN_WRITE_W _IOW(ENCRYPTED_DOMAIN_MAGIC, 27, encrypted_domain_arg_t *)

#endif
