"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.17.5/lib/isc/pk11_result.c" (4 Sep 2020, 1772 Bytes) of package /linux/misc/dns/bind9/9.17.5/bind-9.17.5.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "pk11_result.c" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 #include <stddef.h>
   13 
   14 #include <isc/once.h>
   15 #include <isc/util.h>
   16 
   17 #include <pk11/result.h>
   18 
   19 static const char *text[PK11_R_NRESULTS] = {
   20     "PKCS#11 initialization failed", /*%< 0 */
   21     "no PKCS#11 provider",       /*%< 1 */
   22     "PKCS#11 no random service",     /*%< 2 */
   23     "PKCS#11 no digist service",     /*%< 3 */
   24     "PKCS#11 no AES service",    /*%< 4 */
   25 };
   26 
   27 static const char *ids[PK11_R_NRESULTS] = {
   28     "PK11_R_INITFAILED",      "PK11_R_NOPROVIDER",
   29     "PK11_R_NORANDOMSERVICE", "PK11_R_NODIGESTSERVICE",
   30     "PK11_R_NOAESSERVICE",
   31 };
   32 
   33 #define PK11_RESULT_RESULTSET 2
   34 
   35 static isc_once_t once = ISC_ONCE_INIT;
   36 
   37 static void
   38 initialize_action(void) {
   39     isc_result_t result;
   40 
   41     result = isc_result_register(ISC_RESULTCLASS_PK11, PK11_R_NRESULTS,
   42                      text, PK11_RESULT_RESULTSET);
   43     if (result != ISC_R_SUCCESS) {
   44         UNEXPECTED_ERROR(__FILE__, __LINE__,
   45                  "isc_result_register() failed: %u", result);
   46     }
   47 
   48     result = isc_result_registerids(ISC_RESULTCLASS_PK11, PK11_R_NRESULTS,
   49                     ids, PK11_RESULT_RESULTSET);
   50     if (result != ISC_R_SUCCESS) {
   51         UNEXPECTED_ERROR(__FILE__, __LINE__,
   52                  "isc_result_registerids() failed: %u", result);
   53     }
   54 }
   55 
   56 static void
   57 initialize(void) {
   58     RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
   59 }
   60 
   61 const char *
   62 pk11_result_totext(isc_result_t result) {
   63     initialize();
   64 
   65     return (isc_result_totext(result));
   66 }
   67 
   68 void
   69 pk11_result_register(void) {
   70     initialize();
   71 }