IoTivity-Lite
oc_acl.h File Reference
#include "oc_export.h"
#include "oc_ri.h"
#include "oc_uuid.h"
#include "util/oc_list.h"
#include <stdbool.h>
#include <stddef.h>

Data Structures

struct  oc_ace_res_t
 ACE resource information. More...
 
union  oc_ace_subject_t
 ACE subject information. More...
 
struct  oc_sec_ace_t
 Security ACE information. More...
 
struct  oc_sec_acl_s
 security access control list More...
 

Typedefs

typedef struct oc_ace_res_t oc_ace_res_t
 ACE resource information. More...
 
typedef union oc_ace_subject_t oc_ace_subject_t
 ACE subject information. More...
 
typedef bool(* oc_sec_ace_filter_t) (const oc_sec_ace_t *ace, void *user_data)
 Access control entry (ACE) filtering function. More...
 
typedef struct oc_sec_ace_t oc_sec_ace_t
 Security ACE information. More...
 
typedef struct oc_sec_acl_s oc_sec_acl_t
 security access control list More...
 
typedef void(* oc_sec_on_apply_acl_cb_t) (oc_sec_on_apply_acl_data_t data, void *user_data)
 Callback invoked with a created / updated access control entry. More...
 
typedef struct oc_sec_on_apply_acl_data_t oc_sec_on_apply_acl_data_t
 

Enumerations

enum  oc_ace_connection_type_t { OC_CONN_AUTH_CRYPT = 0 , OC_CONN_ANON_CLEAR }
 Access control connection type. More...
 
enum  oc_ace_subject_type_t { OC_SUBJECT_UUID = 0 , OC_SUBJECT_ROLE , OC_SUBJECT_CONN }
 ACE subject. More...
 
enum  oc_ace_wildcard_t { OC_ACE_NO_WC = 0 , OC_ACE_WC_ALL = 0x111 , OC_ACE_WC_ALL_SECURED = 0x01 , OC_ACE_WC_ALL_PUBLIC = 0x10 }
 ACE wild cards. More...
 

Functions

void oc_resource_set_access_in_RFOTM (oc_resource_t *resource, bool state, oc_ace_permissions_t permission)
 Specify if a resource is accessible in RFOTM state. More...
 
bool oc_sec_acl_add_bootstrap_acl (size_t device)
 Add initial access control list for core resources of a device. More...
 
void oc_sec_acl_clear (size_t device, oc_sec_ace_filter_t filter, void *user_data)
 Remove access control entries matching filter from given device. More...
 
int oc_sec_apply_acl (const oc_rep_t *rep, size_t device, oc_sec_on_apply_acl_cb_t on_apply_ace_cb, void *on_apply_ace_data)
 Parse payload and add/update access control list. More...
 
oc_sec_ace_toc_sec_get_ace_by_aceid (int aceid, size_t device)
 Get access control entry with given aceid from given device. More...
 
oc_sec_acl_toc_sec_get_acl (size_t device)
 Get access control list of a device. More...
 
void oc_sec_remove_ace (oc_sec_ace_t *ace, size_t device)
 Remove access control entry from given device. More...
 
bool oc_sec_remove_ace_by_aceid (int aceid, size_t device)
 Remove access control entry with aceid from given device. More...
 

Typedef Documentation

◆ oc_ace_res_t

typedef struct oc_ace_res_t oc_ace_res_t

ACE resource information.

◆ oc_ace_subject_t

ACE subject information.

◆ oc_sec_ace_filter_t

typedef bool(* oc_sec_ace_filter_t) (const oc_sec_ace_t *ace, void *user_data)

Access control entry (ACE) filtering function.

Parameters
aceACE to check
user_datauser data passed from the caller
Returns
true if ACE matches the filter
false otherwise

◆ oc_sec_ace_t

typedef struct oc_sec_ace_t oc_sec_ace_t

Security ACE information.

◆ oc_sec_acl_t

typedef struct oc_sec_acl_s oc_sec_acl_t

security access control list

◆ oc_sec_on_apply_acl_cb_t

typedef void(* oc_sec_on_apply_acl_cb_t) (oc_sec_on_apply_acl_data_t data, void *user_data)

Callback invoked with a created / updated access control entry.

Parameters
dataData with new/updated ACL data
user_dataUser data passed from the caller

Enumeration Type Documentation

◆ oc_ace_connection_type_t

Access control connection type.

Enumerator
OC_CONN_AUTH_CRYPT 

auth-crypt, authenticated and encrypted

OC_CONN_ANON_CLEAR 

anon-clear, not authenticated and not encrypted

◆ oc_ace_subject_type_t

ACE subject.

Enumerator
OC_SUBJECT_UUID 

DI of the device.

OC_SUBJECT_ROLE 

Security role specified as an Authority and Rolename.

OC_SUBJECT_CONN 

connection type, ACE to be matched based on the connection or message type

◆ oc_ace_wildcard_t

ACE wild cards.

Enumerator
OC_ACE_NO_WC 

no wild card

OC_ACE_WC_ALL 

all

OC_ACE_WC_ALL_SECURED 

Secured.

OC_ACE_WC_ALL_PUBLIC 

public

Function Documentation

◆ oc_resource_set_access_in_RFOTM()

void oc_resource_set_access_in_RFOTM ( oc_resource_t resource,
bool  state,
oc_ace_permissions_t  permission 
)

Specify if a resource is accessible in RFOTM state.

Parameters
[in]resourceto specify as accessible or non-accessible in RFOTM state
[in]stateif true the resource will be accessible in RFOTM state
[in]permissionthe permission of the resource in RFOTM state

◆ oc_sec_acl_add_bootstrap_acl()

bool oc_sec_acl_add_bootstrap_acl ( size_t  device)

Add initial access control list for core resources of a device.

Parameters
deviceIndex of the device
Returns
true On success
false On failure

◆ oc_sec_acl_clear()

void oc_sec_acl_clear ( size_t  device,
oc_sec_ace_filter_t  filter,
void *  user_data 
)

Remove access control entries matching filter from given device.

Parameters
deviceIndex of the device
filterFiltering function (if NULL all existing ACEs match)
user_dataUser data passed from the caller

◆ oc_sec_apply_acl()

int oc_sec_apply_acl ( const oc_rep_t *  rep,
size_t  device,
oc_sec_on_apply_acl_cb_t  on_apply_ace_cb,
void *  on_apply_ace_data 
)

Parse payload and add/update access control list.

Parameters
repPayload to parse
deviceIndex of the device
on_apply_ace_cbCallback invoked when a new access control entry is added or updated
on_apply_ace_dataUser data passed to the on_apply_ace_cb function
Returns
-1 On failure
0 Payload was successfully parsed

◆ oc_sec_get_ace_by_aceid()

oc_sec_ace_t* oc_sec_get_ace_by_aceid ( int  aceid,
size_t  device 
)

Get access control entry with given aceid from given device.

Parameters
aceidAccess control entry id
deviceIndex of the device
Returns
Access control list

◆ oc_sec_get_acl()

oc_sec_acl_t* oc_sec_get_acl ( size_t  device)

Get access control list of a device.

Parameters
deviceIndex of the device
Returns
oc_sec_creds_t* Access control list

◆ oc_sec_remove_ace()

void oc_sec_remove_ace ( oc_sec_ace_t ace,
size_t  device 
)

Remove access control entry from given device.

Parameters
aceAccess control entry to remove
deviceIndex of the device

◆ oc_sec_remove_ace_by_aceid()

bool oc_sec_remove_ace_by_aceid ( int  aceid,
size_t  device 
)

Remove access control entry with aceid from given device.

Parameters
aceidAccess control entry id
deviceIndex of the device
Returns
true Access control entry with given id was found and removed
false Otherwise