<commit_before>/*
 *  Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License
 */
/**
 * \file        cynara-admin.h
 * \author      <NAME> <<EMAIL>>
 * \version     1.0
 * \brief       This file contains administration APIs of cynara available with libcynara-admin.
 */


#ifndef CYNARA_ADMIN_H
#define CYNARA_ADMIN_H

/**
 * \name Return Codes
 * exported by the foundation API.
 * result codes begin with the start error code and extend into negative direction.
 * @{
*/

/*! \brief   indicating the result of the one specific API is successful or access is allowed */
#define CYNARA_ADMIN_API_SUCCESS 0

/*! \brief   indicating system is running out of memory state */
#define CYNARA_ADMIN_API_OUT_OF_MEMORY -1

/*! \brief   indicating the API's parameter is malformed */
#define CYNARA_ADMIN_API_INVALID_PARAM -2

/*! \brief   service not available */
#define CYNARA_ADMIN_API_SERVICE_NOT_AVAILABLE -3
/** @}*/

#ifdef __cplusplus
extern "C" {
#endif

//todo comment
struct cynara_admin;

//todo comment
#define CYNARA_ADMIN_WILDCARD "*"

//todo comment
#define CYNARA_ADMIN_DEFAULT_BUCKET ""

//todo comments
#define CYNARA_ADMIN_DELETE -1
#define CYNARA_ADMIN_DENY 0
#define CYNARA_ADMIN_ALLOW 1
#define CYNARA_ADMIN_BUCKET 2

//todo comments
struct cynara_admin_policy {
    char *bucket;

    char *client;
    char *user;
    char *privilege;

    int result;
    char *result_extra;
};<commit_msg>Add new libcynara-admin return codes and missing comments<commit_after>/*
 *  Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License
 */
/**
 * \file        cynara-admin.h
 * \author      <NAME> <<EMAIL>>
 * \version     1.0
 * \brief       This file contains administration APIs of cynara available with libcynara-admin.
 */


#ifndef CYNARA_ADMIN_H
#define CYNARA_ADMIN_H

/**
 * \name Return Codes
 * exported by the foundation API.
 * result codes begin with the start error code and extend into negative direction.
 * @{
*/

/*! \brief   indicating the result of the one specific API is successful or access is allowed */
#define CYNARA_ADMIN_API_SUCCESS 0

/*! \brief   indicating client process is running out of memory */
#define CYNARA_ADMIN_API_OUT_OF_MEMORY -1

/*! \brief   indicating the API's parameter is malformed */
#define CYNARA_ADMIN_API_INVALID_PARAM -2

/*! \brief   service not available (cannot connect to cynara service) */
#define CYNARA_ADMIN_API_SERVICE_NOT_AVAILABLE -3

/*! \brief   unexpected error in client library */
#define CYNARA_ADMIN_API_UNEXPECTED_CLIENT_ERROR -4

/*! \brief   cynara service does not allow to perform requested operation */
#define CYNARA_ADMIN_API_OPERATION_NOT_ALLOWED -5

/*! \brief   cynara service hasn't found requested bucket */
#define CYNARA_ADMIN_API_BUCKET_NOT_FOUND -6
/** @}*/

#ifdef __cplusplus
extern "C" {
#endif

/**
 * \name cynara_admin
 * forward declaration of structure allowing initialization of library
 * and usage of all libcynara-admin API functions
 */
struct cynara_admin;

/**
 * \name Wildcard
 * definition of WILDCARD, that can replace client, user or privilege name.
 * WILDCARD matches any string during check procedure from libcynara-client.
 */
#define CYNARA_ADMIN_WILDCARD "*"

/**
 * \name Name of Default Bucket
 * definition of name for default bucket - the one that check starts in.
 * default bucket cannot be removed, although its default policy
 * (which originaly is set to DENY) can be changed.
 */
#define CYNARA_ADMIN_DEFAULT_BUCKET ""

/**
 * \name Operation Codes
 * operation codes that define action type to be taken in below defined functions
 * they are used mosty to define policy result
 * @{
 */

/*! \brief   a policy or bucket should be removed */
#define CYNARA_ADMIN_DELETE -1

/*! \brief   set policy result or bucket's default policy to DENY */
#define CYNARA_ADMIN_DENY 0

/*! \brief   set policy result or bucket's default policy to ALLOW */
#define CYNARA_ADMIN_ALLOW 1

/*! \brief   set policy to point into another bucket */
#define CYNARA_ADMIN_BUCKET 2
/** @}*/

/**
 * \name cynara_admin_policy
 * defines single policy
 * bucket - is the name of bucket, in which policy is placed
 * client, user, privilege - defines policy key
 * result - defines result of policy
 * result_extra - not always used, may contain some additional result data
 *                like e.g. name of bucket in case result == CYNARA_ADMIN_BUCKET
 */
struct cynara_admin_policy {
    char *bucket;

    char *client;
    char *user;
    char *privilege;

    int result;
    char *result_extra;
};
{'fraction_non_alphanumeric': 0.08186309103740297, 'fraction_numerical': 0.006880733944954129, 'mean_word_length': 3.5791599353796446, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5752701', 'n_tokens_mistral': 1755, 'n_tokens_neox': 1695, 'n_words': 668}