summaryrefslogtreecommitdiffstats
path: root/src/cls/otp/cls_otp_ops.h
blob: 51cec3eb37bcab0558d20252a81d021599f7c441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#ifndef CEPH_CLS_OTP_OPS_H
#define CEPH_CLS_OTP_OPS_H

#include "include/types.h"
#include "include/utime.h"
#include "cls/otp/cls_otp_types.h"

struct cls_otp_set_otp_op
{
  list<rados::cls::otp::otp_info_t> entries;

  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    encode(entries, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    decode(entries, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_set_otp_op)

struct cls_otp_check_otp_op
{
  string id;
  string val;
  string token;

  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    encode(id, bl);
    encode(val, bl);
    encode(token, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    decode(id, bl);
    decode(val, bl);
    decode(token, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_check_otp_op)

struct cls_otp_get_result_op
{
  string token;

  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    encode(token, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    decode(token, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_get_result_op)

struct cls_otp_get_result_reply
{
  rados::cls::otp::otp_check_t result;

  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    encode(result, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    decode(result, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_get_result_reply)

struct cls_otp_remove_otp_op
{
  list<string> ids;

  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    encode(ids, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    decode(ids, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_remove_otp_op)

struct cls_otp_get_otp_op
{
  bool get_all{false};
  list<string> ids;

  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    encode(get_all, bl);
    encode(ids, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    decode(get_all, bl);
    decode(ids, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_get_otp_op)

struct cls_otp_get_otp_reply
{
  list<rados::cls::otp::otp_info_t> found_entries;

  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    encode(found_entries, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    decode(found_entries, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_get_otp_reply)

struct cls_otp_get_current_time_op
{
  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_get_current_time_op)

struct cls_otp_get_current_time_reply
{
  ceph::real_time time;

  void encode(bufferlist &bl) const {
    ENCODE_START(1, 1, bl);
    encode(time, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::const_iterator &bl) {
    DECODE_START(1, bl);
    decode(time, bl);
    DECODE_FINISH(bl);
  }
};
WRITE_CLASS_ENCODER(cls_otp_get_current_time_reply)

#endif