capType policy

Returns the name of the resource type (<resource-type>) from the configuration of the ocap family instance.

The capType policy can be used before init and initR policies to help initialize the capability based on the numerical identifier of the resource type.

Type: attr policy.

Syntax

capType(in TypeId typeId);

Parameters

typeId

Identifier of the type of capability (integer). Corresponds to the value specified in the typeid parameter from the family instance configuration.

Returned value

Resource type from the ocap, family instance configuration corresponding to the passed typeId identifier. If a specified value of typeId is not found, the returned value will correspond to the value "{ocap:invalid}".

Example

...

use family ocapi = ocap {

FS: {

typeid: 202,

rights: {

Open: 1,

Read: 2,

Write: 4

}

},

Other: {typeid: 303, rights: {"": 1}}

};

entity HandleManager {

execute call main = grant;

security call onInitialize(caller, handle,

typeId, rights)[self] =

choice(ocapi.capType(typeId)) {

FS: ocapi.init {type: FS} (caller, handle, rights);

{ocap:invalid}: deny;

_: deny;

};

...

}

Page top