From 1cda097031b2f1a5131e9a7750d37840cd70a16e Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 22 Sep 2008 01:22:28 -0700 Subject: [PATCH] oops, anyconnect.h too --- anyconnect.h | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 anyconnect.h diff --git a/anyconnect.h b/anyconnect.h new file mode 100644 index 0000000..df364d3 --- /dev/null +++ b/anyconnect.h @@ -0,0 +1,100 @@ +/* + * Open AnyConnect (SSL + DTLS) client + * + * © 2008 David Woodhouse + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted, provided + * that the above copyright notice and this permission notice appear + * in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include + +struct pkt { + int type; + int len; + struct pkt *next; + unsigned char hdr[8]; + unsigned char data[]; +}; + +struct vpn_option { + const char *option; + const char *value; + struct vpn_option *next; +}; + +struct anyconnect_info { + const char *localname; + const char *hostname; + const char *cert; + + const char *cookie; + struct vpn_option *cstp_options; + struct vpn_option *dtls_options; + + SSL_CTX *https_ctx; + SSL *https_ssl; + int ssl_keepalive; + time_t last_ssl_tx; + + z_stream inflate_strm; + z_stream deflate_strm; + + unsigned char dtls_secret[48]; + SSL_CTX *dtls_ctx; + SSL *dtls_ssl; + int ssl_pfd; + + int mtu; + + struct pollfd *pfds; + int nfds; + + int tun_fd; + int ssl_fd; + int dtls_fd; + + struct pkt *incoming_queue; + struct pkt *outgoing_queue; + + struct sockaddr *peer_addr; + + int deflate; + const char *useragent; +}; + +/* tun.c */ +int setup_tun(struct anyconnect_info *vpninfo); +int tun_mainloop(struct anyconnect_info *vpninfo, int *timeout); + +/* dtls.c */ +int setup_dtls(struct anyconnect_info *vpninfo); +int dtls_mainloop(struct anyconnect_info *vpninfo, int *timeout); + +/* ssl.c */ +int make_ssl_connection(struct anyconnect_info *vpninfo); +void vpn_init_openssl(void); +int ssl_mainloop(struct anyconnect_info *vpninfo, int *timeout); +int ssl_bye(struct anyconnect_info *vpninfo, char *reason); + +/* main.c */ +extern int verbose; + +/* mainloop.c */ +int vpn_add_pollfd(struct anyconnect_info *vpninfo, int fd, short events); +int vpn_mainloop(struct anyconnect_info *vpninfo); +int queue_new_packet(struct pkt **q, int type, void *buf, int len); + -- 2.7.4