Home | History | Annotate | Line # | Download | only in internal
namemap.h revision 1.1.1.1
      1  1.1  christos /*
      2  1.1  christos  * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
      3  1.1  christos  *
      4  1.1  christos  * Licensed under the Apache License 2.0 (the "License").  You may not use
      5  1.1  christos  * this file except in compliance with the License.  You can obtain a copy
      6  1.1  christos  * in the file LICENSE in the source distribution or at
      7  1.1  christos  * https://www.openssl.org/source/license.html
      8  1.1  christos  */
      9  1.1  christos 
     10  1.1  christos #include "internal/cryptlib.h"
     11  1.1  christos 
     12  1.1  christos typedef struct ossl_namemap_st OSSL_NAMEMAP;
     13  1.1  christos 
     14  1.1  christos OSSL_NAMEMAP *ossl_namemap_stored(OSSL_LIB_CTX *libctx);
     15  1.1  christos 
     16  1.1  christos OSSL_NAMEMAP *ossl_namemap_new(void);
     17  1.1  christos void ossl_namemap_free(OSSL_NAMEMAP *namemap);
     18  1.1  christos int ossl_namemap_empty(OSSL_NAMEMAP *namemap);
     19  1.1  christos 
     20  1.1  christos int ossl_namemap_add_name(OSSL_NAMEMAP *namemap, int number, const char *name);
     21  1.1  christos int ossl_namemap_add_name_n(OSSL_NAMEMAP *namemap, int number,
     22  1.1  christos                             const char *name, size_t name_len);
     23  1.1  christos 
     24  1.1  christos /*
     25  1.1  christos  * The number<->name relationship is 1<->many
     26  1.1  christos  * Therefore, the name->number mapping is a simple function, while the
     27  1.1  christos  * number->name mapping is an iterator.
     28  1.1  christos  */
     29  1.1  christos int ossl_namemap_name2num(const OSSL_NAMEMAP *namemap, const char *name);
     30  1.1  christos int ossl_namemap_name2num_n(const OSSL_NAMEMAP *namemap,
     31  1.1  christos                             const char *name, size_t name_len);
     32  1.1  christos const char *ossl_namemap_num2name(const OSSL_NAMEMAP *namemap, int number,
     33  1.1  christos                                   size_t idx);
     34  1.1  christos int ossl_namemap_doall_names(const OSSL_NAMEMAP *namemap, int number,
     35  1.1  christos                              void (*fn)(const char *name, void *data),
     36  1.1  christos                              void *data);
     37  1.1  christos 
     38  1.1  christos /*
     39  1.1  christos  * A utility that handles several names in a string, divided by a given
     40  1.1  christos  * separator.
     41  1.1  christos  */
     42  1.1  christos int ossl_namemap_add_names(OSSL_NAMEMAP *namemap, int number,
     43  1.1  christos                            const char *names, const char separator);
     44