|
Packit Service |
4684c1 |
/*
|
|
Packit Service |
4684c1 |
* Copyright (C) 2017 Red Hat, Inc.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Author: Nikos Mavrogiannopoulos
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* This file is part of GnuTLS.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* The GnuTLS is free software; you can redistribute it and/or
|
|
Packit Service |
4684c1 |
* modify it under the terms of the GNU Lesser General Public License
|
|
Packit Service |
4684c1 |
* as published by the Free Software Foundation; either version 2.1 of
|
|
Packit Service |
4684c1 |
* the License, or (at your option) any later version.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* This library is distributed in the hope that it will be useful, but
|
|
Packit Service |
4684c1 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
4684c1 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
4684c1 |
* Lesser General Public License for more details.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
4684c1 |
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include "gnutls_int.h"
|
|
Packit Service |
4684c1 |
#include "c-strcase.h"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* Compatibility compression functions */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* gnutls_compression_get_name:
|
|
Packit Service |
4684c1 |
* @algorithm: is a Compression algorithm
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Convert a #gnutls_compression_method_t value to a string.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Returns: a pointer to a string that contains the name of the
|
|
Packit Service |
4684c1 |
* specified compression algorithm, or %NULL.
|
|
Packit Service |
4684c1 |
**/
|
|
Packit Service |
4684c1 |
const char *gnutls_compression_get_name(gnutls_compression_method_t
|
|
Packit Service |
4684c1 |
algorithm)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
if (algorithm == GNUTLS_COMP_NULL)
|
|
Packit Service |
4684c1 |
return "NULL";
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
return NULL;
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* gnutls_compression_get_id:
|
|
Packit Service |
4684c1 |
* @name: is a compression method name
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* The names are compared in a case insensitive way.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Returns: an id of the specified in a string compression method, or
|
|
Packit Service |
4684c1 |
* %GNUTLS_COMP_UNKNOWN on error.
|
|
Packit Service |
4684c1 |
**/
|
|
Packit Service |
4684c1 |
gnutls_compression_method_t gnutls_compression_get_id(const char *name)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
if (c_strcasecmp(name, "NULL") == 0)
|
|
Packit Service |
4684c1 |
return GNUTLS_COMP_NULL;
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
return GNUTLS_COMP_UNKNOWN;
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/**
|
|
Packit Service |
4684c1 |
* gnutls_compression_list:
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Get a list of compression methods.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Returns: a zero-terminated list of #gnutls_compression_method_t
|
|
Packit Service |
4684c1 |
* integers indicating the available compression methods.
|
|
Packit Service |
4684c1 |
**/
|
|
Packit Service |
4684c1 |
const gnutls_compression_method_t *gnutls_compression_list(void)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
static const gnutls_compression_method_t list[2] = {GNUTLS_COMP_NULL, 0};
|
|
Packit Service |
4684c1 |
return list;
|
|
Packit Service |
4684c1 |
}
|