LCOV - code coverage report
Current view: top level - builds/gnutls/coverage/gnutls-git/lib - compress.c (source / functions) Hit Total Coverage
Test: GnuTLS-3.6.14 Code Coverage Lines: 6 9 66.7 %
Date: 2020-10-30 04:50:48 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2017 Red Hat, Inc.
       3             :  *
       4             :  * Author: Nikos Mavrogiannopoulos
       5             :  *
       6             :  * This file is part of GnuTLS.
       7             :  *
       8             :  * The GnuTLS is free software; you can redistribute it and/or
       9             :  * modify it under the terms of the GNU Lesser General Public License
      10             :  * as published by the Free Software Foundation; either version 2.1 of
      11             :  * the License, or (at your option) any later version.
      12             :  *
      13             :  * This library is distributed in the hope that it will be useful, but
      14             :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16             :  * Lesser General Public License for more details.
      17             :  *
      18             :  * You should have received a copy of the GNU Lesser General Public License
      19             :  * along with this program.  If not, see <https://www.gnu.org/licenses/>
      20             :  *
      21             :  */
      22             : 
      23             : #include "gnutls_int.h"
      24             : #include "c-strcase.h"
      25             : 
      26             : /* Compatibility compression functions */
      27             : 
      28             : /**
      29             :  * gnutls_compression_get_name:
      30             :  * @algorithm: is a Compression algorithm
      31             :  *
      32             :  * Convert a #gnutls_compression_method_t value to a string.
      33             :  *
      34             :  * Returns: a pointer to a string that contains the name of the
      35             :  *   specified compression algorithm, or %NULL.
      36             :  **/
      37          41 : const char *gnutls_compression_get_name(gnutls_compression_method_t
      38             :                                         algorithm)
      39             : {
      40          41 :         if (algorithm == GNUTLS_COMP_NULL)
      41          41 :                 return "NULL";
      42             : 
      43             :         return NULL;
      44             : }
      45             : 
      46             : /**
      47             :  * gnutls_compression_get_id:
      48             :  * @name: is a compression method name
      49             :  *
      50             :  * The names are compared in a case insensitive way.
      51             :  *
      52             :  * Returns: an id of the specified in a string compression method, or
      53             :  *   %GNUTLS_COMP_UNKNOWN on error.
      54             :  **/
      55           0 : gnutls_compression_method_t gnutls_compression_get_id(const char *name)
      56             : {
      57           0 :         if (c_strcasecmp(name, "NULL") == 0)
      58           0 :                 return GNUTLS_COMP_NULL;
      59             : 
      60             :         return GNUTLS_COMP_UNKNOWN;
      61             : }
      62             : 
      63             : /**
      64             :  * gnutls_compression_list:
      65             :  *
      66             :  * Get a list of compression methods.
      67             :  *
      68             :  * Returns: a zero-terminated list of #gnutls_compression_method_t
      69             :  *   integers indicating the available compression methods.
      70             :  **/
      71           2 : const gnutls_compression_method_t *gnutls_compression_list(void)
      72             : {
      73           2 :         static const gnutls_compression_method_t list[2] = {GNUTLS_COMP_NULL, 0};
      74           2 :         return list;
      75             : }

Generated by: LCOV version 1.14