Blame lib/compress.c

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