<commit_before>/*
 * Copyright 2017 AVSystem <<EMAIL>>
 *
 * 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.
 */

#ifndef AVS_COAP_MSG_CACHE_H
#define AVS_COAP_MSG_CACHE_H

#include <stddef.h>
#include <stdint.h>

#include <avsystem/commons/coap/msg.h>
#include <avsystem/commons/coap/tx_params.h>

VISIBILITY_PRIVATE_HEADER_BEGIN

typedef struct coap_msg_cache coap_msg_cache_t;

#define AVS_COAP_MSG_CACHE_DUPLICATE -2

#ifdef WITH_AVS_COAP_MESSAGE_CACHE

/**
 * Creates a message cache object.
 *
 * @param capacity Number of bytes the cache should be able to hold.
 *
 * @return Created msg_cache object, or NULL if there is not enough memory
 *         or @p capacity is 0.
 *<commit_msg>Add extra parentheses around AVS_COAP_MSG_CACHE_DUPLICATE<commit_after>/*
 * Copyright 2017 AVSystem <<EMAIL>>
 *
 * 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.
 */

#ifndef AVS_COAP_MSG_CACHE_H
#define AVS_COAP_MSG_CACHE_H

#include <stddef.h>
#include <stdint.h>

#include <avsystem/commons/coap/msg.h>
#include <avsystem/commons/coap/tx_params.h>

VISIBILITY_PRIVATE_HEADER_BEGIN

typedef struct coap_msg_cache coap_msg_cache_t;

#define AVS_COAP_MSG_CACHE_DUPLICATE (-2)

#ifdef WITH_AVS_COAP_MESSAGE_CACHE

/**
 * Creates a message cache object.
 *
 * @param capacity Number of bytes the cache should be able to hold.
 *
 * @return Created msg_cache object, or NULL if there is not enough memory
 *         or @p capacity is 0.
 *
{'fraction_non_alphanumeric': 0.07704918032786885, 'fraction_numerical': 0.00819672131147541, 'mean_word_length': 4.2494623655913975, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1959815', 'n_tokens_mistral': 763, 'n_tokens_neox': 740, 'n_words': 282}