gnutls_compression_get - Linux
Overview
The gnutls_compression_get
function in GnuTLS retrieves the currently set compression algorithm.
Syntax
#include <gnutls/gnutls.h>
int gnutls_compression_get(gnutls_session_t session,
const gnutls_datum_t *data);
Options/Flags
The following options are supported:
-
session
: The GnuTLS session. -
data
: The compression algorithm (output):- For GnuTLS_COMP_NULL:
NULL
- For GnuTLS_COMP_DEFLATE:
"DEFLATE"
- For GnuTLS_COMP_ZLIB:
"ZLIB"
- For GnuTLS_COMP_NULL:
Examples
#include <stdio.h>
#include <gnutls/gnutls.h>
int main() {
gnutls_session_t session = NULL;
gnutls_datum_t data;
gnutls_compression_get(session, &data);
printf("The compression algorithm is: %s\n", data.data);
return 0;
}
Common Issues
- If the session is not initialized, the function will return
-1
. - If the compression algorithm is not set, the function will return
-1
.
Integration
The gnutls_compression_get
function can be used with other GnuTLS functions to manage compression in a TLS session.
Related Commands
gnutls_compression_set
gnutls_session_init