Motr  M0
capa.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_CAPA_CAPA_H__
26 #define __MOTR_CAPA_CAPA_H__
27 
28 #include "lib/atomic.h"
29 #include "net/net.h"
30 
62 };
63 
70 };
71 
72 enum {
74 };
75 
82 
83 };
84 
85 struct m0_capa_ctxt;
97 
101  void *oc_data;
103 };
104 
111 struct m0_capa_ctxt {
113 };
114 
121 M0_INTERNAL int m0_capa_ctxt_init(struct m0_capa_ctxt *ctxt);
122 
128 M0_INTERNAL void m0_capa_ctxt_fini(struct m0_capa_ctxt *ctxt);
129 
141 M0_INTERNAL int m0_capa_new(struct m0_object_capa *capa,
143  enum m0_capa_operation opcode, void *data);
144 
156 M0_INTERNAL int m0_capa_get(struct m0_capa_ctxt *ctxt,
157  struct m0_capa_issuer *owner,
158  struct m0_object_capa *capa);
159 
160 /*
161  Put Capability for an object
162 
163  @param ctxt [in]the execution context.
164  @param capa [in]capa to be released.
165 
166  Reference count will be decreased. When reference count drops to zero,
167  it will be finalized and can not be used any more.
168 */
169 M0_INTERNAL void m0_capa_put(struct m0_capa_ctxt *ctxt,
170  struct m0_object_capa *capa);
171 
172 
182 M0_INTERNAL int m0_capa_auth(struct m0_capa_ctxt *ctxt,
183  struct m0_object_capa *capa,
184  enum m0_capa_operation op);
185 
186 
189 /* __MOTR_CAPA_CAPA_H__ */
190 #endif
191 
192 /*
193  * Local variables:
194  * c-indentation-style: "K&R"
195  * c-basic-offset: 8
196  * tab-width: 8
197  * fill-column: 80
198  * scroll-step: 1
199  * End:
200  */
M0_INTERNAL int m0_capa_auth(struct m0_capa_ctxt *ctxt, struct m0_object_capa *capa, enum m0_capa_operation op)
Definition: capa.c:75
struct m0_capa_issuer * oc_owner
Definition: capa.h:93
enum m0_capa_operation oc_opcode
Definition: capa.h:95
m0_capa_operation
Definition: capa.h:67
struct m0_atomic64 oc_ref
Definition: capa.h:96
void * oc_data
Definition: capa.h:101
struct m0_bufvec data
Definition: di.c:40
M0_INTERNAL int m0_capa_ctxt_init(struct m0_capa_ctxt *ctxt)
Definition: capa.c:83
op
Definition: libdemo.c:64
M0_INTERNAL void m0_capa_put(struct m0_capa_ctxt *ctxt, struct m0_object_capa *capa)
Definition: capa.c:66
int opcode
Definition: crate.c:301
m0_capa_entity_type
Definition: capa.h:58
M0_INTERNAL int m0_capa_new(struct m0_object_capa *capa, enum m0_capa_entity_type type, enum m0_capa_operation opcode, void *data)
Definition: capa.c:41
char oc_opaque[M0_CAPA_HMAC_MAX_LEN]
Definition: capa.h:102
struct m0_capa_ctxt * oc_ctxt
Definition: capa.h:91
M0_INTERNAL int m0_capa_get(struct m0_capa_ctxt *ctxt, struct m0_capa_issuer *owner, struct m0_object_capa *capa)
Definition: capa.c:54
int type
Definition: dir.c:1031
M0_INTERNAL void m0_capa_ctxt_fini(struct m0_capa_ctxt *ctxt)
Definition: capa.c:89
enum m0_capa_entity_type oc_type
Definition: capa.h:94