if_utun_crypto_dtls.h [plain text]
#ifndef _NET_IF_UTUN_CRYPTO_DTLS_H_
#define _NET_IF_UTUN_CRYPTO_DTLS_H_
#define UTUN_CRYPTO_DTLS_HANDLE_INVALID -1
#ifdef KERNEL_PRIVATE
#include <sys/systm.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/if_types.h>
#include <sys/mbuf.h>
#include <netinet/in.h>
#include <netinet6/in6_var.h>
#include <netinet6/in6_var.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/ip_var.h>
#include <net/if_utun.h>
#include <net/if_utun_crypto.h>
#include <sys/kernel_types.h>
#include <net/kpi_interface.h>
#define utun_cleanup_all_crypto_dtls(pcb) utun_ctl_disable_crypto_dtls(pcb)
void
utun_ctl_init_crypto_dtls(void);
errno_t
utun_ctl_register_dtls (utun_crypto_kpi_reg_t *reg);
void
utun_cleanup_all_crypto_dtls (struct utun_pcb *pcb);
void
utun_ctl_enable_crypto_dtls(struct utun_pcb *pcb, utun_crypto_args_t *args);
void
utun_ctl_disable_crypto_dtls(struct utun_pcb *pcb);
int
utun_ctl_config_crypto_dtls_framer(utun_crypto_ctx_t *crypto_ctx, utun_crypto_framer_args_t *args);
int
utun_ctl_unconfig_crypto_dtls_framer(utun_crypto_ctx_t *crypto_ctx, utun_crypto_framer_args_t *args);
void
utun_ctl_start_datatraffic_crypto_dtls(struct utun_pcb *pcb);
void
utun_ctl_stop_datatraffic_crypto_dtls(struct utun_pcb *pcb);
int
utun_pkt_dtls_output(struct utun_pcb *pcb, mbuf_t *pkt);
int
utun_pkt_dtls_input(struct utun_pcb *pcb, mbuf_t *pkt, protocol_family_t family);
static inline protocol_family_t
utun_crypto_framer_inner_type_to_protocol_family (utun_crypto_framer_inner_type_t type)
{
if (type == UTUN_CRYPTO_INNER_TYPE_IPv4) {
return PF_INET;
} else {
return PF_INET6;
}
}
static inline utun_crypto_framer_inner_type_t
utun_crypto_framer_protocol_family_to_inner_type (protocol_family_t family)
{
if (family == PF_INET) {
return UTUN_CRYPTO_INNER_TYPE_IPv4;
} else {
return UTUN_CRYPTO_INNER_TYPE_IPv6;
}
}
#endif // KERNEL_PRIVATE
#endif // _NET_IF_UTUN_CRYPTO_DTLS_H_