Commit 43a16bb0 authored by Nikos Mavrogiannopoulos's avatar Nikos Mavrogiannopoulos Committed by David Woodhouse

Added openconnect_get_dtls_compression and openconnect_get_cstp_compression

Signed-off-by: default avatarNikos Mavrogiannopoulos <nmav@redhat.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent d3438551
......@@ -143,6 +143,8 @@ public abstract class LibOpenConnect {
public synchronized native IPInfo getIPInfo();
public synchronized native String getCSTPCipher();
public synchronized native String getDTLSCipher();
public synchronized native String getCSTPCompression();
public synchronized native String getDTLSCompression();
/* certificate info */
......
......@@ -1074,6 +1074,22 @@ JNIEXPORT jstring JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_getDT
RETURN_STRING_END
}
JNIEXPORT jstring JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_getDTLSCompression(
JNIEnv *jenv, jobject jobj)
{
RETURN_STRING_START
buf = openconnect_get_dtls_compression(ctx->vpninfo);
RETURN_STRING_END
}
JNIEXPORT jstring JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_getCSTPCompression(
JNIEnv *jenv, jobject jobj)
{
RETURN_STRING_START
buf = openconnect_get_cstp_compression(ctx->vpninfo);
RETURN_STRING_END
}
JNIEXPORT jstring JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_getCSTPCipher(
JNIEnv *jenv, jobject jobj)
{
......
......@@ -76,6 +76,8 @@ OPENCONNECT_5_2 {
OPENCONNECT_5_3 {
global:
openconnect_override_getaddrinfo;
openconnect_get_cstp_compression;
openconnect_get_dtls_compression;
} OPENCONNECT_5_2;
OPENCONNECT_PRIVATE {
......
......@@ -794,6 +794,28 @@ int openconnect_setup_tun_device(struct openconnect_info *vpninfo,
return openconnect_setup_tun_fd(vpninfo, tun_fd);
}
static const char *compr_name_map[] = {
[COMPR_DEFLATE] = "Deflate",
[COMPR_LZS] = "LZS",
[COMPR_LZ4] = "LZ4"
};
const char *openconnect_get_cstp_compression(struct openconnect_info * vpninfo)
{
if (vpninfo->cstp_compr <= 0 || vpninfo->cstp_compr > COMPR_MAX)
return NULL;
return compr_name_map[vpninfo->cstp_compr];
}
const char *openconnect_get_dtls_compression(struct openconnect_info * vpninfo)
{
if (vpninfo->dtls_compr <= 0 || vpninfo->dtls_compr > COMPR_MAX)
return NULL;
return compr_name_map[vpninfo->dtls_compr];
}
const char *openconnect_get_dtls_cipher(struct openconnect_info *vpninfo)
{
#if defined(DTLS_GNUTLS)
......
......@@ -161,6 +161,7 @@ struct pkt {
#define COMPR_DEFLATE (1<<0)
#define COMPR_LZS (1<<1)
#define COMPR_LZ4 (1<<2)
#define COMPR_MAX COMPR_LZ4
#ifdef HAVE_LZ4
#define COMPR_STATELESS (COMPR_LZS | COMPR_LZ4)
......
......@@ -34,6 +34,8 @@
/*
* API version 5.3:
* - Add openconnect_override_getaddrinfo().
* - Add openconnect_get_cstp_compression().
* - Add openconnect_get_dtls_compression().
*
* API version 5.2:
* - Add openconnect_set_http_auth(), openconnect_set_protocol().
......@@ -365,6 +367,11 @@ int openconnect_init_ssl(void);
const char *openconnect_get_cstp_cipher(struct openconnect_info *);
const char *openconnect_get_dtls_cipher(struct openconnect_info *);
/* These return a descriptive string of the compression algorithm
* in use (LZS, LZ4, ...). If no compression then NULL is returned. */
const char *openconnect_get_cstp_compression(struct openconnect_info *);
const char *openconnect_get_dtls_compression(struct openconnect_info *);
const char *openconnect_get_hostname(struct openconnect_info *);
int openconnect_set_hostname(struct openconnect_info *, const char *);
char *openconnect_get_urlpath(struct openconnect_info *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment