mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
net/credman : Move 'CREDMAN_MAX_CREDENTIALS' to 'CONFIG_'
This commit is contained in:
parent
60def88929
commit
774c18ea79
@ -37,8 +37,8 @@ extern "C" {
|
||||
/**
|
||||
* @brief Maximum number of credentials in credential pool
|
||||
*/
|
||||
#ifndef CREDMAN_MAX_CREDENTIALS
|
||||
#define CREDMAN_MAX_CREDENTIALS (2)
|
||||
#ifndef CONFIG_CREDMAN_MAX_CREDENTIALS
|
||||
#define CONFIG_CREDMAN_MAX_CREDENTIALS (2)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -173,7 +173,7 @@ void credman_delete(credman_tag_t tag, credman_type_t type);
|
||||
/**
|
||||
* @brief Gets the number of credentials currently in the credential pool
|
||||
*
|
||||
* Maximum number of allowed credentials is defined by CREDMAN_MAX_CREDENTIALS
|
||||
* Maximum number of allowed credentials is defined by CONFIG_CREDMAN_MAX_CREDENTIALS
|
||||
*
|
||||
* @return number of credentials currently in the credential pool
|
||||
*/
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
static mutex_t _mutex = MUTEX_INIT;
|
||||
|
||||
static credman_credential_t credentials[CREDMAN_MAX_CREDENTIALS];
|
||||
static credman_credential_t credentials[CONFIG_CREDMAN_MAX_CREDENTIALS];
|
||||
static unsigned used = 0;
|
||||
|
||||
static int _find_credential_pos(credman_tag_t tag, credman_type_t type,
|
||||
@ -129,7 +129,7 @@ int credman_get_used_count(void)
|
||||
static int _find_credential_pos(credman_tag_t tag, credman_type_t type,
|
||||
credman_credential_t **empty)
|
||||
{
|
||||
for (unsigned i = 0; i < CREDMAN_MAX_CREDENTIALS; i++) {
|
||||
for (unsigned i = 0; i < CONFIG_CREDMAN_MAX_CREDENTIALS; i++) {
|
||||
credman_credential_t *c = &credentials[i];
|
||||
if ((c->tag == tag) && (c->type == type)) {
|
||||
return i;
|
||||
@ -148,7 +148,7 @@ void credman_reset(void)
|
||||
{
|
||||
mutex_lock(&_mutex);
|
||||
memset(credentials, 0,
|
||||
sizeof(credman_credential_t) * CREDMAN_MAX_CREDENTIALS);
|
||||
sizeof(credman_credential_t) * CONFIG_CREDMAN_MAX_CREDENTIALS);
|
||||
used = 0;
|
||||
mutex_unlock(&_mutex);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ static void test_credman_add(void)
|
||||
|
||||
/* fill the pool */
|
||||
memcpy(&credential.params.psk, &exp_psk_params, sizeof(psk_params_t));
|
||||
while (credman_get_used_count() < CREDMAN_MAX_CREDENTIALS) {
|
||||
while (credman_get_used_count() < CONFIG_CREDMAN_MAX_CREDENTIALS) {
|
||||
/* increase tag number so that it is not recognized as duplicate */
|
||||
credential.tag++;
|
||||
TEST_ASSERT_EQUAL_INT(CREDMAN_OK, credman_add(&credential));
|
||||
@ -176,7 +176,7 @@ static void test_credman_delete_random_order(void)
|
||||
};
|
||||
TEST_ASSERT_EQUAL_INT(0, credman_get_used_count());
|
||||
|
||||
/* fill the credential pool, assume CREDMAN_MAX_CREDENTIALS is 2 */
|
||||
/* fill the credential pool, assume CONFIG_CREDMAN_MAX_CREDENTIALS is 2 */
|
||||
TEST_ASSERT_EQUAL_INT(CREDMAN_OK, credman_add(&in_credential));
|
||||
in_credential.tag = tag2;
|
||||
TEST_ASSERT_EQUAL_INT(CREDMAN_OK, credman_add(&in_credential));
|
||||
|
Loading…
Reference in New Issue
Block a user