]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Reorganize #include
authorDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Tue, 29 Jun 2021 09:50:16 +0000 (11:50 +0200)
committerDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Wed, 30 Jun 2021 23:09:37 +0000 (01:09 +0200)
- Reorder header files as suggested here:
  https://stackoverflow.com/questions/2762568/c-c-include-header-file-order
  https://softwareengineering.stackexchange.com/questions/325549/c-header-file-order
- Remove duplicates
- Remove unused headers files
- Change "config.h" to <config.h>
- Include <winsock2.h> before openconnect.h, which is not entirely self-contained.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
61 files changed:
COPYING.LGPL
array.c
auth-common.c
auth-globalprotect.c
auth-html.c
auth-juniper.c
auth.c
compat.c
cstp.c
digest.c
dtls.c
esp-seqno.c
esp.c
f5.c
fortinet.c
gnutls-dtls.c
gnutls-esp.c
gnutls.c
gnutls.h
gnutls_tpm.c
gnutls_tpm2.c
gnutls_tpm2_esys.c
gnutls_tpm2_ibm.c
gpst.c
gssapi.c
http-auth.c
http.c
iconv.c
jni.c
jsondump.c
library.c
lzo.c
lzs.c
main.c
mainloop.c
mtucalc.c
ntlm.c
nullppp.c
oath.c
oidc.c
oncp.c
openconnect-internal.h
openconnect.h
openconnect.rc
openssl-dtls.c
openssl-esp.c
openssl-pkcs11.c
openssl.c
ppp.c
pulse.c
script.c
ssl.c
sspi.c
stoken.c
textbuf.c
tun-win32.c
tun.c
win32-ipicmp.h
wintun.c
xml.c
yubikey.c

index 602bfc94635ddf8f1bf2b00419a85ead645a5b67..551cb4acb9d8ce4270b11c8267704c2fb447f22b 100644 (file)
@@ -500,5 +500,3 @@ necessary.  Here is a sample; alter the names:
   Ty Coon, President of Vice
 
 That's all there is to it!
-
-
diff --git a/array.c b/array.c
index 195de40b603a43909babc3bd2605ba7f4f1e750b..e6f7bf7125b7ddfe6fa793566de013195335b7c1 100644 (file)
--- a/array.c
+++ b/array.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include "json.h"
+
 #include <unistd.h>
 #include <fcntl.h>
-#include <time.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <sys/types.h>
-#include <stdarg.h>
-#include <sys/types.h>
-
 #ifdef _WIN32
 #include "win32-ipicmp.h"
 #else
 /* The BSDs require the first two headers before netinet/ip.h
  * (Linux and macOS already #include them within netinet/ip.h)
  */
-#include <sys/types.h>
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>
 #include <netinet/icmp6.h>
 #endif
 
-#include "json.h"
-
-#include "openconnect-internal.h"
+#include <time.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 static struct oc_auth_form *plain_auth_form(void)
 {
@@ -1309,4 +1307,3 @@ int array_bye(struct openconnect_info *vpninfo, const char *reason)
        free(res_buf);
        return ret;
 }
-
index 8d7ea39d23ad1de6a915c8f21e9fb417ca847d68..40ce666be77eb71182ebb308f18c5aacbe8c071b 100644 (file)
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/types.h>
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <stdarg.h>
 
-#include "openconnect-internal.h"
-
 int xmlnode_is_named(xmlNode *xml_node, const char *name)
 {
        return !strcmp((char *)xml_node->name, name);
index 6e8f9c44822a684c1816a188187a4a45d1c75d80..6282f96f928146382ddf937b9f6ac9cbe23ef665 100644 (file)
 
 #include <config.h>
 
-#include <ctype.h>
-#include <errno.h>
+#include "openconnect-internal.h"
 
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
-#include "openconnect-internal.h"
+#include <ctype.h>
+#include <errno.h>
 
 struct login_context {
        char *username;                         /* Username that has already succeeded in some form */
index 9bf268e02e92a2a40e2b9e85b0f9608e17360632..eecfd74a7b5d01427d835f640edc0cf4f36e4cec 100644 (file)
 
 #include <config.h>
 
-#include <errno.h>
+#include "openconnect-internal.h"
 
 #include <libxml/HTMLparser.h>
 #include <libxml/HTMLtree.h>
 
-#include "openconnect-internal.h"
+#include <errno.h>
 
 xmlNodePtr htmlnode_next(xmlNodePtr top, xmlNodePtr node)
 {
index a535604505481ae8fcbbb035e8f5978ed7cf43f9..b8be3d2b0871de2ee36ab0fdd0fa697e1158708f 100644 (file)
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include <libxml/HTMLparser.h>
+#include <libxml/HTMLtree.h>
+
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/types.h>
+#ifndef _WIN32
+#include <sys/wait.h>
+#endif
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <stdarg.h>
-#include <sys/types.h>
-#ifndef _WIN32
-#include <sys/wait.h>
-#endif
-
-#include <libxml/HTMLparser.h>
-#include <libxml/HTMLtree.h>
-
-#include "openconnect-internal.h"
 
 /* XX: This is actually a lot of duplication with the CSTP version. */
 void oncp_common_headers(struct openconnect_info *vpninfo, struct oc_text_buf *buf)
diff --git a/auth.c b/auth.c
index 49947d76ffa8979535bbd4641ab0c01cdfff0489..a77e09792243ab44eaa85128a6e1991271763171 100644 (file)
--- a/auth.c
+++ b/auth.c
 
 #include <config.h>
 
-#include <stdio.h>
+#include "openconnect-internal.h"
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
 #include <unistd.h>
 #include <fcntl.h>
-#include <time.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #ifndef _WIN32
 #include <grp.h>
 #endif
 
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
-#include "openconnect-internal.h"
+#include <stdio.h>
+#include <time.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
 
 static int xmlpost_append_form_opts(struct openconnect_info *vpninfo,
                                    struct oc_auth_form *form, struct oc_text_buf *body);
index c0d1a4dc0eae6c8a4e128403fad3f01c8a952794..5ddb97e95a853f7e649c970f7601e0dad91eb77e 100644 (file)
--- a/compat.c
+++ b/compat.c
@@ -17,6 +17,8 @@
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <string.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -41,8 +43,6 @@ errno_t _putenv_s(
 #endif
 #endif
 
-#include "openconnect-internal.h"
-
 #ifdef HAVE_SUNOS_BROKEN_TIME
 /*
  * On SunOS, time() goes backwards. Thankfully, gethrtime() doesn't.
diff --git a/cstp.c b/cstp.c
index d9ac12def8e6323cf9f949bb419426aed766864c..2c85d4e2a492287ed2d62f34b42f9f33a3e632bd 100644 (file)
--- a/cstp.c
+++ b/cstp.c
 
 #include <config.h>
 
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <stdarg.h>
+#include "openconnect-internal.h"
+
 #ifdef HAVE_LZ4
 #include <lz4.h>
 #ifndef HAVE_LZ4_COMPRESS_DEFAULT
 #endif
 #endif
 
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
 #if defined(__linux__)
 /* For TCP_INFO */
 # include <linux/tcp.h>
 #endif
 
-#include "openconnect-internal.h"
+#include <time.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 /*
  * Data packets are encapsulated in the SSL stream as follows:
index a860ab87721a207e34453699b036a188425507b0..c91fc2a144b728cc6b4e6a03f2c6ed1290f4aa42 100644 (file)
--- a/digest.c
+++ b/digest.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <errno.h>
 #include <string.h>
 #include <ctype.h>
 
-#include "openconnect-internal.h"
-
 #define ALGO_MD5       0
 #define ALGO_MD5_SESS  1
 
diff --git a/dtls.c b/dtls.c
index 6fd1d19c3cd0a02b75a49af0290ff97fcdc36613..894a9687a92fa233a717d826a134c05c3a70b1b3 100644 (file)
--- a/dtls.c
+++ b/dtls.c
 
 #include <config.h>
 
-#include <errno.h>
-#include <sys/types.h>
+#include "openconnect-internal.h"
+
 #include <unistd.h>
+#include <sys/types.h>
 #include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
 #ifndef _WIN32
 #include <netinet/in.h>
 #include <sys/socket.h>
 #endif
 
-#include "openconnect-internal.h"
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 /*
  * The master-secret is generated randomly by the client. The server
index d366bc2c80fe92ae6d95491a99d53794444696ff..3ba2bf3363d7dcf2bd1ca1cfe4d818ff29b37d54 100644 (file)
 
 #include <config.h>
 
-#include <stdint.h>
+#include "openconnect-internal.h"
+
 #include <inttypes.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <errno.h>
 
-#include "openconnect-internal.h"
-
 #define DTLS_EMPTY_BITMAP              (0xFFFFFFFFFFFFFFFFULL)
 
 /* Eventually we're going to have to have more than one incoming ESP
@@ -139,4 +139,3 @@ int verify_packet_seqno(struct openconnect_info *vpninfo,
                }
        }
 }
-
diff --git a/esp.c b/esp.c
index 87d872645fd8508cb14d58b3281fbeedcf58a89c..56190b17d999e8fae121f9d4b92b6acefdf8d51a 100644 (file)
--- a/esp.c
+++ b/esp.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include "lzo.h"
+
+#include <unistd.h>
+
 #include <stdio.h>
 #include <stdint.h>
-#include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
 
-#include "openconnect-internal.h"
-#include "lzo.h"
-
 int print_esp_keys(struct openconnect_info *vpninfo, const char *name, struct esp *esp)
 {
        int i;
diff --git a/f5.c b/f5.c
index 6daae59bc30e3b8a9fb9804d4f22c14c24719a83..dc094ab3172696a05a13ffe978504b57e66c4567 100644 (file)
--- a/f5.c
+++ b/f5.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include "ppp.h"
+
+#include <libxml/HTMLparser.h>
+#include <libxml/HTMLtree.h>
+
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/types.h>
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <stdarg.h>
-#include <sys/types.h>
-
-#include <libxml/HTMLparser.h>
-#include <libxml/HTMLtree.h>
-
-#include "openconnect-internal.h"
-#include "ppp.h"
 
 #define XCAST(x) ((const xmlChar *)(x))
 
index 31895bc3da4e373695e4aad2a49562ece810d7c2..fa9fc7983d46a0d8e7a4e4563c49b590bafaa4fc 100644 (file)
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include "ppp.h"
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/types.h>
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <stdarg.h>
-#include <sys/types.h>
-
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
-#include "openconnect-internal.h"
-#include "ppp.h"
 
 /* clthello/svrhello strings for Fortinet DTLS initialization.
  * NB: C string literals implicitly add a final \0 (which is correct for these).
index 67d97a239e679513200c1bdc54036e955f006040..57e2fc9f515c66915b3c0c3fa996fc677e3169bc 100644 (file)
 
 #include <config.h>
 
-#include <errno.h>
-#include <sys/types.h>
+#include "gnutls.h"
+
+#include <gnutls/dtls.h>
+
 #include <unistd.h>
 #include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
+#include <sys/types.h>
 #ifndef _WIN32
 #include <netinet/in.h>
 #include <sys/socket.h>
 #endif
 
-
-#include <gnutls/dtls.h>
-#include "gnutls.h"
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 #if GNUTLS_VERSION_NUMBER < 0x030400
 # define GNUTLS_CIPHER_CHACHA20_POLY1305 23
index ce2c84565a7ab8f10c17a413fb2a2e82d40f9d97..e350ff79bc8bea9b25602be103939d786f47b69c 100644 (file)
 
 #include <config.h>
 
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
+#include "openconnect-internal.h"
 
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
 
-#include "openconnect-internal.h"
+#include <unistd.h>
+
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
 
 void destroy_esp_ciphers(struct esp *esp)
 {
index 488dabdc71bf549e5edb181f817528aea33e482e..afa5d91794cd8b8f188a06cd54965dd68f4c9487 100644 (file)
--- a/gnutls.c
+++ b/gnutls.c
 
 #include <config.h>
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdlib.h>
+#include "openconnect-internal.h"
+
+#include "gnutls.h"
 
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 #include <p11-kit/pin.h>
 #endif
 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
 #if defined(HAVE_P11KIT) || defined(HAVE_GNUTLS_SYSTEM_KEYS)
 static int gnutls_pin_callback(void *priv, int attempt, const char *uri,
                               const char *token_label, unsigned int flags,
                               char *pin, size_t pin_max);
 #endif /* HAVE_P11KIT || HAVE_GNUTLS_SYSTEM_KEYS */
 
-#include "gnutls.h"
-#include "openconnect-internal.h"
-
 /* GnuTLS 2.x lacked this. But GNUTLS_E_UNEXPECTED_PACKET_LENGTH basically
  * does the same thing.
  * https://lists.infradead.org/pipermail/openconnect-devel/2014-March/001726.html
index 3ce7f8777f6e05682f832727391199d24289dff2..94262cfa0569004db5f05d5e039340605105496d 100644 (file)
--- a/gnutls.h
+++ b/gnutls.h
 #ifndef __OPENCONNECT_GNUTLS_H__
 #define __OPENCONNECT_GNUTLS_H__
 
+#include "openconnect-internal.h"
+
 #include <gnutls/gnutls.h>
 #include <gnutls/pkcs12.h>
 #include <gnutls/abstract.h>
 
-#include "openconnect-internal.h"
-
 int load_tpm1_key(struct openconnect_info *vpninfo, struct cert_info *certinfo,
                  gnutls_datum_t *fdata, gnutls_privkey_t *pkey, gnutls_datum_t *pkey_sig);
 void release_tpm1_ctx(struct openconnect_info *info, struct cert_info *certinfo);
index 9eaf932709f38e1205e2ea7ae8710c7f8d484b17..605bb752b217b1629a4ba70c62463422246cc473 100644 (file)
 
 #include <config.h>
 
-#include <errno.h>
-#include <string.h>
-
-#include <gnutls/gnutls.h>
 #include "openconnect-internal.h"
 
 #include "gnutls.h"
 
+#include <gnutls/gnutls.h>
+
+#include <errno.h>
+#include <string.h>
+
 #ifdef HAVE_TROUSERS
 #include <trousers/tss.h>
 #include <trousers/trousers.h>
index 1f0f09462b097615242116a34465d67d8bba6198..5e1d7b4c3c87059c15fed7deeaaac29da22c6155 100644 (file)
 
 #include <config.h>
 
-#include <errno.h>
-#include <string.h>
-
-#include <gnutls/gnutls.h>
 #include "openconnect-internal.h"
+
 #include "gnutls.h"
 
+#include <gnutls/gnutls.h>
+
+#include <errno.h>
+#include <string.h>
+
 #ifdef HAVE_TSS2
 
 #include <libtasn1.h>
index 3adcb54494f274a666a20075fe27e55d3b453c56..203c5c151c8847d49758adbd02d3f7630eeb64d4 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  ******************************************************************************/
 
-#include "config.h"
+#include <config.h>
 
 #include "openconnect-internal.h"
-#include "gnutls.h"
 
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
+#include "gnutls.h"
 
 #include <tss2/tss2_mu.h>
 #include <tss2/tss2_esys.h>
 #include <tss2/tss2_tctildr.h>
 
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
 struct oc_tpm2_ctx {
        TSS2_TCTI_CONTEXT *tcti_ctx;
        TPM2B_PUBLIC pub;
index 7ff6670c9a66bb0aea1cf2611e075154f7fe859d..f5186c7b18ddfc208b186bdfa1d6823ec6ee42c7 100644 (file)
  * Lesser General Public License for more details.
  */
 
-#include "config.h"
+#include <config.h>
 
 #include "openconnect-internal.h"
+
 #include "gnutls.h"
 
 #include <stdio.h>
diff --git a/gpst.c b/gpst.c
index 0bdaf85f91d9eb39430116e9f1acf697b0545ba4..a8d4c2feec0ad997b4eff40f949428e890d956bf 100644 (file)
--- a/gpst.c
+++ b/gpst.c
 
 #include <config.h>
 
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#ifndef _WIN32
-#include <sys/wait.h>
-#endif
-#include <stdarg.h>
+#include "openconnect-internal.h"
+
 #ifdef HAVE_LZ4
 #include <lz4.h>
 #endif
 
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
 #ifdef _WIN32
 #include "win32-ipicmp.h"
 #else
+#include <sys/wait.h>
 /* The BSDs require the first two headers before netinet/ip.h
  * (Linux and macOS already #include them within netinet/ip.h)
  */
-#include <sys/types.h>
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>
 # include <linux/tcp.h>
 #endif
 
-#include "openconnect-internal.h"
+#include <time.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 /*
  * Data packets are encapsulated in the SSL stream as follows:
index 6f9171494d2a1e017a55379ae83cc9ea2dff69a3..cf5df1e3685b8c2187cc73580ceb56802986fb1b 100644 (file)
--- a/gssapi.c
+++ b/gssapi.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <errno.h>
 #include <string.h>
 
-#include "openconnect-internal.h"
-
 static void print_gss_err(struct openconnect_info *vpninfo, const char *where,
                          gss_OID mech, OM_uint32 err_maj, OM_uint32 err_min)
 {
index fe142000efae0a681c42a4ded21ee6215ea5a0fe..cf263f5bec8d5f1a190a7b77d3a4809d73ec462e 100644 (file)
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <unistd.h>
 #include <fcntl.h>
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
@@ -27,8 +30,6 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-#include "openconnect-internal.h"
-
 static int basic_authorization(struct openconnect_info *vpninfo, int proxy,
                               struct http_auth_state *auth_state,
                               struct oc_text_buf *hdrbuf)
diff --git a/http.c b/http.c
index aef75f04a5ca8c25e7f0fc72a4391077a61acf3e..d49943471455490312e59d5f23d7e2b88dea0fcf 100644 (file)
--- a/http.c
+++ b/http.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include <libxml/uri.h>
+
 #include <unistd.h>
 #include <fcntl.h>
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdarg.h>
 
-#include <libxml/uri.h>
-
-#include "openconnect-internal.h"
-
 static int proxy_write(struct openconnect_info *vpninfo, char *buf, size_t len);
 static int proxy_read(struct openconnect_info *vpninfo, char *buf, size_t len);
 
diff --git a/iconv.c b/iconv.c
index 30208300275fb6de27507df8239881042a78cbf7..f9b6deb28e31b62738e94f365146b639379e48b6 100644 (file)
--- a/iconv.c
+++ b/iconv.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <iconv.h>
+
 #include <errno.h>
 #include <string.h>
 
-#include "openconnect-internal.h"
-
 static char *convert_str(struct openconnect_info *vpninfo, iconv_t ic,
                         char *instr)
 
diff --git a/jni.c b/jni.c
index 4bf9fac1b2a3337174154d5d6f2228450a85155b..549247f9f29c2fe8f8dead4abefc36bfe0efc634 100644 (file)
--- a/jni.c
+++ b/jni.c
 
 #include <config.h>
 
+#include "openconnect.h"
+
+#include <jni.h>
+
+#include <unistd.h>
+#include <sys/types.h>
+
 #include <errno.h>
 #include <stdarg.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <jni.h>
-#include "openconnect.h"
 
 struct libctx {
        JNIEnv *jenv;
index f2dfd23596142fda1a3c4ba2c6dd628484b7eaab..e0e7c713377cebacaa5bcc3971d0492c6c030f9c 100644 (file)
 
 #include <config.h>
 
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
+#include "openconnect-internal.h"
 
 #include "json.h"
 
-#include "openconnect-internal.h"
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
 
 /*
  * Copyright (C) 2015 Mirko Pasqualetti  All rights reserved.
@@ -150,4 +150,3 @@ void dump_json(struct openconnect_info *vpninfo, int lvl, json_value *value)
        dump_json_value(vpninfo, lvl, buf, value, 0);
        buf_free(buf);
 }
-
index dbd376371b032e24c88e918004f03aaf391a1576..8900944dc670252e2a51bfb24ece97a10f9d5dc8 100644 (file)
--- a/library.c
+++ b/library.c
 
 #include <config.h>
 
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <ctype.h>
+#include "openconnect-internal.h"
+
+#if defined(OPENCONNECT_GNUTLS)
+#include "gnutls.h"
+#endif
 
 #ifdef HAVE_LIBSTOKEN
 #include <stoken.h>
 #include <libxml/tree.h>
 #include <zlib.h>
 
-#include "openconnect-internal.h"
-
-#if defined(OPENCONNECT_GNUTLS)
-#include "gnutls.h"
-#endif
-
 #if defined(OPENCONNECT_OPENSSL)
 #include <openssl/bio.h>
 #endif
 
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <ctype.h>
+
 struct openconnect_info *openconnect_vpninfo_new(const char *useragent,
                                                 openconnect_validate_peer_cert_vfn validate_peer_cert,
                                                 openconnect_write_new_config_vfn write_new_config,
diff --git a/lzo.c b/lzo.c
index c3c2d06753b1de27526b1110e3236e32da95d29f..8fbd6b7e8b8e350fc523b74bfc5fa97586e7d29f 100644 (file)
--- a/lzo.c
+++ b/lzo.c
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <string.h>
-#include <limits.h>
-
 //#include "avutil.h"
 //#include "avassert.h"
 //#include "common.h"
 //#include "intreadwrite.h"
 #include "lzo.h"
 
+#include <string.h>
+#include <limits.h>
+
 /// Define if we may write up to 12 bytes beyond the output buffer.
 #define OUTBUF_PADDED 1
 /// Define if we may read up to 8 bytes beyond the input buffer.
diff --git a/lzs.c b/lzs.c
index 4967b74c59680c6b36dd2c4cf6856c5610bf4915..05409fa774a825aa161842e0934948d7d1a0d8f1 100644 (file)
--- a/lzs.c
+++ b/lzs.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <errno.h>
 #include <string.h>
 #include <stdint.h>
 
-#include "openconnect-internal.h"
-
 #define GET_BITS(bits)                                                 \
 do {                                                                   \
        /* Strictly speaking, this check ought to be on                 \
diff --git a/main.c b/main.c
index ba0d44ab0ab62805f7796baffc6b043eda0c647d..1a4455a8a1642d76043f8eb0226097280469ee10 100644 (file)
--- a/main.c
+++ b/main.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #ifdef HAVE_GETLINE
 /* Various BSD systems require this for getline() to be visible */
 #define _WITH_GETLINE
 #endif
 
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#include <errno.h>
+#include <getopt.h>
+
 #include <fcntl.h>
 #include <unistd.h>
 #include <inttypes.h>
 #include <sys/types.h>
-#include <getopt.h>
-#include <time.h>
 #include <locale.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
 
 #ifdef LIBPROXY_HDR
 #include LIBPROXY_HDR
 #endif
 
-#include "openconnect-internal.h"
-
 #ifdef _WIN32
 #include <shlwapi.h>
 #include <wtypes.h>
 #include <termios.h>
 #endif
 
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+
 #ifdef HAVE_NL_LANGINFO
 #include <langinfo.h>
 
index 9205587db9f7134e3f02e4fdbb93115cc8a339f9..0d57db261697a63ffa8b284876dffb24efdf3d9a 100644 (file)
 
 #include <config.h>
 
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
+#include "openconnect-internal.h"
+
 #include <unistd.h>
-#include <string.h>
 #ifndef _WIN32
 /* for setgroups() */
 # include <sys/types.h>
 # include <grp.h>
 #endif
 
-#include "openconnect-internal.h"
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
 
 int queue_new_packet(struct openconnect_info *vpninfo,
                     struct pkt_q *q, void *buf, int len)
index 7da9ebffe29f3ef65b23218246bd801dd05b0052..0b96be05cd723c2a7bed0542bcbc5c9636d18e2a 100644 (file)
--- a/mtucalc.c
+++ b/mtucalc.c
@@ -16,6 +16,7 @@
  */
 
 #include <config.h>
+
 #include "openconnect-internal.h"
 
 #if defined(__linux__)
diff --git a/ntlm.c b/ntlm.c
index d7e249c423cd5b3602f1ca5daeca70cc8c089cd1..01f0aff8be91b6041fdee500349c2b01f35ed47b 100644 (file)
--- a/ntlm.c
+++ b/ntlm.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <unistd.h>
 #include <fcntl.h>
-#include <time.h>
-#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <ctype.h>
 #ifdef HAVE_ALLOCA_H
 #include <alloca.h>
 #endif
 #include <sys/wait.h>
 #endif
 
-#include "openconnect-internal.h"
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <ctype.h>
 
 #define NTLM_SSO_REQ           2       /* SSO type1 packet sent */
 #define NTLM_MANUAL            3       /* SSO challenge/response sent or skipped; manual next */
index ca13d1baa48f6a2793ebefa0d33eb792bc847969..3e5cac6fc9f2a610ebda2bc70430bf7ea17ab31b 100644 (file)
--- a/nullppp.c
+++ b/nullppp.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+#include "ppp.h"
+
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/types.h>
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <stdarg.h>
-#include <sys/types.h>
-
-#include "openconnect-internal.h"
-#include "ppp.h"
 
 int nullppp_obtain_cookie(struct openconnect_info *vpninfo)
 {
diff --git a/oath.c b/oath.c
index de553f75de20664225d891e3fc93c6c39dc78678..8730f64b8bbba5ffb0449fa96f009d568a1309f8 100644 (file)
--- a/oath.c
+++ b/oath.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "openconnect-internal.h"
-
 static int b32_char(char in)
 {
        if (in >= 'A' && in <= 'Z')
diff --git a/oidc.c b/oidc.c
index 115593258c978d6ab8dcde672ddcd708500866be..555c35a6b8cd7f518b48fff83a2bee3e89aa4054 100644 (file)
--- a/oidc.c
+++ b/oidc.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "openconnect-internal.h"
-
 int set_oidc_token(struct openconnect_info *vpninfo, const char *token_str)
 {
        int ret;
@@ -52,5 +52,3 @@ int set_oidc_token(struct openconnect_info *vpninfo, const char *token_str)
        vpninfo->token_mode = OC_TOKEN_MODE_OIDC;
        return 0;
 }
-
-
diff --git a/oncp.c b/oncp.c
index 92bf9ccdae62240670f175a4f5b21e1e9377d9b3..206134eb11b89b1716eb3de383828c52d03a500d 100644 (file)
--- a/oncp.c
+++ b/oncp.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/types.h>
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <stdarg.h>
-#include <sys/types.h>
-
-#include "openconnect-internal.h"
 
 static void buf_append_tlv(struct oc_text_buf *buf, uint16_t val, uint32_t len, void *data)
 {
index e03b2ee97413645b8071b7d853660e1a9ad2799e..cb67bf6bbc601262d4e73530e7f0b23bd77a54f8 100644 (file)
 
 #define __OPENCONNECT_PRIVATE__
 
+/*
+ * We need to include <winsock2.h> or <winsock.h> before openconnect.h.
+ * Indeed openconnect.h is specifically intended not to be self-sufficient,
+ * so that end-users can choose between <winsock.h> and <winsock2.h>.
+ */
 #ifdef _WIN32
 #include <winsock2.h>
-#include <ws2tcpip.h>
-#ifndef SECURITY_WIN32
-#define SECURITY_WIN32 1
-#endif
-#include <security.h>
-
-#ifndef _Out_cap_c_
-#define _Out_cap_c_(sz)
-#endif
-#ifndef _Ret_bytecount_
-#define _Ret_bytecount_(sz)
-#endif
-#include "wintun.h"
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <fcntl.h>
 #endif
 
 #include "openconnect.h"
 
-/* Equivalent of "/dev/null" on Windows.
- * See https://stackoverflow.com/a/44163934
- */
-#ifdef _WIN32
-#define DEVNULL "NUL:"
-#else
-#define DEVNULL "/dev/null"
-#endif
+#include "json.h"
 
 #if defined(OPENCONNECT_OPENSSL)
 #include <openssl/ssl.h>
@@ -67,7 +44,7 @@
 #else
 #define method_const
 #endif
-#endif /* OPENSSL */
+#endif
 
 #if defined(OPENCONNECT_GNUTLS)
 #include <gnutls/gnutls.h>
 #include <iconv.h>
 #endif
 
-#include <zlib.h>
-#include <stdint.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
 #ifdef LIBPROXY_HDR
 #include LIBPROXY_HDR
 #endif
 #define N_(s) s
 
 #include <libxml/tree.h>
+#include <zlib.h>
 
-#include <json.h>
+#ifdef _WIN32
+#ifndef _Out_cap_c_
+#define _Out_cap_c_(sz)
+#endif
+#ifndef _Ret_bytecount_
+#define _Ret_bytecount_(sz)
+#endif
+#include "wintun.h"
+
+#include <ws2tcpip.h>
+#ifndef SECURITY_WIN32
+#define SECURITY_WIN32 1
+#endif
+#include <security.h>
+#else
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <fcntl.h>
+#endif
+
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+
+/* Equivalent of "/dev/null" on Windows.
+ * See https://stackoverflow.com/a/44163934
+ */
+#ifdef _WIN32
+#define DEVNULL "NUL:"
+#else
+#define DEVNULL "/dev/null"
+#endif
 
 #define SHA512_SIZE 64
 #define SHA384_SIZE 48
@@ -314,86 +322,6 @@ struct http_auth_state {
        };
 };
 
-struct vpn_proto {
-       const char *name;
-       const char *pretty_name;
-       const char *description;
-       const char *secure_cookie;
-       const char *udp_protocol;
-       int proto;
-       unsigned int flags;
-       int (*vpn_close_session)(struct openconnect_info *vpninfo, const char *reason);
-
-       /* This does the full authentication, calling back as appropriate */
-       int (*obtain_cookie)(struct openconnect_info *vpninfo);
-
-       /* Establish the TCP connection (and obtain configuration) */
-       int (*tcp_connect)(struct openconnect_info *vpninfo);
-
-       int (*tcp_mainloop)(struct openconnect_info *vpninfo, int *timeout, int readable);
-
-       /* Add headers common to each HTTP request */
-       void (*add_http_headers)(struct openconnect_info *vpninfo, struct oc_text_buf *buf);
-
-       /* Set up the UDP (DTLS) connection. Doesn't actually *start* it. */
-       int (*udp_setup)(struct openconnect_info *vpninfo);
-
-       /* This will actually complete the UDP connection setup/handshake on the wire,
-          as well as transporting packets */
-       int (*udp_mainloop)(struct openconnect_info *vpninfo, int *timeout, int readable);
-
-       /* Close the connection but leave the session setup so it restarts */
-       void (*udp_close)(struct openconnect_info *vpninfo);
-
-       /* Close and destroy the (UDP) session */
-       void (*udp_shutdown)(struct openconnect_info *vpninfo);
-
-       /* Send probe packets to start or maintain the (UDP) session */
-       int (*udp_send_probes)(struct openconnect_info *vpninfo);
-
-       /* Catch probe packet confirming the (UDP) session */
-       int (*udp_catch_probe)(struct openconnect_info *vpninfo, struct pkt *p);
-};
-
-struct pkt_q {
-       struct pkt *head;
-       struct pkt **tail;
-       int count;
-};
-
-static inline struct pkt *dequeue_packet(struct pkt_q *q)
-{
-       struct pkt *ret = q->head;
-
-       if (ret) {
-               q->head = ret->next;
-               if (!--q->count)
-                       q->tail = &q->head;
-       }
-       return ret;
-}
-
-static inline void requeue_packet(struct pkt_q *q, struct pkt *p)
-{
-       p->next = q->head;
-       q->head = p;
-       if (!q->count++)
-               q->tail = &p->next;
-}
-
-static inline int queue_packet(struct pkt_q *q, struct pkt *p)
-{
-       *(q->tail) = p;
-       p->next = NULL;
-       q->tail = &p->next;
-       return ++q->count;
-}
-
-static inline void init_pkt_queue(struct pkt_q *q)
-{
-       q->tail = &q->head;
-}
-
 #define TLS_OVERHEAD 5 /* packet + header */
 #define DTLS_OVERHEAD (1 /* packet + header */ + 13 /* DTLS header */ + \
         20 /* biggest supported MAC (SHA1) */ +  32 /* biggest supported IV (AES-256) */ + \
@@ -419,6 +347,8 @@ struct oc_pcsc_ctx;
 struct oc_tpm1_ctx;
 struct oc_tpm2_ctx;
 
+struct openconnect_info;
+
 struct cert_info {
        struct openconnect_info *vpninfo;
        char *cert;
@@ -432,6 +362,14 @@ struct cert_info {
 #endif
 };
 
+struct pkt_q {
+       struct pkt *head;
+       struct pkt **tail;
+       int count;
+};
+
+struct vpn_proto;
+
 struct openconnect_info {
        const struct vpn_proto *proto;
 
@@ -799,6 +737,79 @@ struct openconnect_info {
        int (*ssl_write)(struct openconnect_info *vpninfo, char *buf, size_t len);
 };
 
+struct vpn_proto {
+       const char *name;
+       const char *pretty_name;
+       const char *description;
+       const char *secure_cookie;
+       const char *udp_protocol;
+       int proto;
+       unsigned int flags;
+       int (*vpn_close_session)(struct openconnect_info *vpninfo, const char *reason);
+
+       /* This does the full authentication, calling back as appropriate */
+       int (*obtain_cookie)(struct openconnect_info *vpninfo);
+
+       /* Establish the TCP connection (and obtain configuration) */
+       int (*tcp_connect)(struct openconnect_info *vpninfo);
+
+       int (*tcp_mainloop)(struct openconnect_info *vpninfo, int *timeout, int readable);
+
+       /* Add headers common to each HTTP request */
+       void (*add_http_headers)(struct openconnect_info *vpninfo, struct oc_text_buf *buf);
+
+       /* Set up the UDP (DTLS) connection. Doesn't actually *start* it. */
+       int (*udp_setup)(struct openconnect_info *vpninfo);
+
+       /* This will actually complete the UDP connection setup/handshake on the wire,
+          as well as transporting packets */
+       int (*udp_mainloop)(struct openconnect_info *vpninfo, int *timeout, int readable);
+
+       /* Close the connection but leave the session setup so it restarts */
+       void (*udp_close)(struct openconnect_info *vpninfo);
+
+       /* Close and destroy the (UDP) session */
+       void (*udp_shutdown)(struct openconnect_info *vpninfo);
+
+       /* Send probe packets to start or maintain the (UDP) session */
+       int (*udp_send_probes)(struct openconnect_info *vpninfo);
+
+       /* Catch probe packet confirming the (UDP) session */
+       int (*udp_catch_probe)(struct openconnect_info *vpninfo, struct pkt *p);
+};
+
+static inline struct pkt *dequeue_packet(struct pkt_q *q)
+{
+       struct pkt *ret = q->head;
+
+       if (ret) {
+               q->head = ret->next;
+               if (!--q->count)
+                       q->tail = &q->head;
+       }
+       return ret;
+}
+
+static inline void requeue_packet(struct pkt_q *q, struct pkt *p)
+{
+       p->next = q->head;
+       q->head = p;
+       if (!q->count++)
+               q->tail = &p->next;
+}
+
+static inline int queue_packet(struct pkt_q *q, struct pkt *p)
+{
+       *(q->tail) = p;
+       p->next = NULL;
+       q->tail = &p->next;
+       return ++q->count;
+}
+
+static inline void init_pkt_queue(struct pkt_q *q)
+{
+       q->tail = &q->head;
+}
 
 static inline struct pkt *alloc_pkt(struct openconnect_info *vpninfo, int len)
 {
index 35c3de732b689f4a11beae48796015a8690b9eb3..210481de906c86dd0581b07d2c77ef07ea321c2e 100644 (file)
@@ -20,9 +20,9 @@
 #ifndef __OPENCONNECT_H__
 #define __OPENCONNECT_H__
 
-#include <stdint.h>
 #include <sys/types.h>
-#include <unistd.h>
+
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
index c4165a0d92db74b09ae851464ee4d978d3692841..9a7d7f1ad7681202da9efa4bf50620c74d7598e8 100644 (file)
@@ -1,3 +1,2 @@
 // application icon
 IDI_ICON1       ICON    DISCARDABLE     "openconnect.ico"
-
index 04d132464e14a2ddc0f76528c552824343de56c5..76bcd2f1a7cf412fd46b7a29eaa2f6f50226aa69 100644 (file)
 
 #include <config.h>
 
-#include <errno.h>
-#include <sys/types.h>
+#include "openconnect-internal.h"
+
 #include <unistd.h>
+#include <sys/types.h>
 #include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
 #ifndef _WIN32
 #include <netinet/in.h>
 #include <sys/socket.h>
 #endif
 
-#include "openconnect-internal.h"
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 /* In the very early days there were cases where this wasn't found in
  * the header files but it did still work somehow. I forget the details
index 0cb654448dd97fbcbefbc4da16b48b3f5c91353a..459e8c09ca21881a0b15eb58db4243149a6a19fd 100644 (file)
 
 #include <config.h>
 
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-
 #include "openconnect-internal.h"
 
 #include <openssl/evp.h>
 #include <openssl/rand.h>
 
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
 
 #define EVP_CIPHER_CTX_free(c) do {                            \
index b6ef792b620ebee8c7cc09d585fbfbb226944524..f7eb3adc6f370ab9b8f5c8fa0a6a2f7bdc623f79 100644 (file)
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include <openssl/rand.h>
+
+#include <sys/types.h>
+
 #include <errno.h>
 #include <string.h>
-#include <sys/types.h>
 #include <ctype.h>
 
-#include "openconnect-internal.h"
-#include <openssl/rand.h>
-
 #ifdef HAVE_LIBP11 /* And p11-kit */
 
 #include <libp11.h>
index 0c3936d072c9d9687f760a765690cf69a3b25e94..095e29f3bf6d9f8baee48487d6875649e311ac1f 100644 (file)
--- a/openssl.c
+++ b/openssl.c
 
 #include <config.h>
 
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <ctype.h>
-
 #include "openconnect-internal.h"
 
 #include <openssl/crypto.h>
 #include <openssl/ui.h>
 #include <openssl/rsa.h>
 
+#include <sys/types.h>
+
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+
 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
 #define X509_up_ref(x)         CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509)
 #define X509_get0_notAfter(x) X509_get_notAfter(x)
diff --git a/ppp.c b/ppp.c
index 21f33eeda1c39b7278f96e6609122e2dd1169328..721431aed7dcb66fbdc7e34c0530bbc38339ee16 100644 (file)
--- a/ppp.c
+++ b/ppp.c
 
 #include <config.h>
 
-#include <errno.h>
-
 #include "openconnect-internal.h"
 #include "ppp.h"
 
+#include <errno.h>
+
 static const uint16_t fcstab[256] = {
        0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
        0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
diff --git a/pulse.c b/pulse.c
index b3dd8e4ff07159efb3305715cbb7c484c1b951af..d2d818ab149e9823b45db152bd5aaa99fc5ed108 100644 (file)
--- a/pulse.c
+++ b/pulse.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/types.h>
+
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/types.h>
 #include <stdarg.h>
-#include <sys/types.h>
-
-#include "openconnect-internal.h"
 
 #define VENDOR_JUNIPER 0xa4c
 #define VENDOR_JUNIPER2 0x583
index 6d1ec72fa1e8bf029bb9ac149cfff8757b67de5f..7d1864d4b63fac493851ac834ab0fc13a728704a 100644 (file)
--- a/script.c
+++ b/script.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <string.h>
 #include <fcntl.h>
-#include <unistd.h>
 #ifndef _WIN32
 #include <sys/wait.h>
 #endif
+
 #include <errno.h>
 #include <ctype.h>
+#include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "openconnect-internal.h"
-
 int script_setenv(struct openconnect_info *vpninfo,
                  const char *opt, const char *val, int trunc, int append)
 {
diff --git a/ssl.c b/ssl.c
index 1f60d5c0047abb772c1a18b48c1e2507a2131931..fa9e106156604f6df1cdf24fe859440100c64c6b 100644 (file)
--- a/ssl.c
+++ b/ssl.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <inttypes.h>
 #include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <time.h>
 #if defined(__linux__) || defined(__ANDROID__)
 #include <sys/vfs.h>
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__APPLE__)
 #include <sys/socket.h>
 #endif
 
-#include "openconnect-internal.h"
-
 #ifdef ANDROID_KEYSTORE
 #include <sys/un.h>
 #endif
 
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <time.h>
+
 /* OSX < 1.6 doesn't have AI_NUMERICSERV */
 #ifndef AI_NUMERICSERV
 #define AI_NUMERICSERV 0
diff --git a/sspi.c b/sspi.c
index f0edbb0f49bcc9caa45a7a3339d8d5da23ab8b4a..adc443607467e785d6ba21f08177a1c4e9d765cf 100644 (file)
--- a/sspi.c
+++ b/sspi.c
 
 #include <config.h>
 
-#include <errno.h>
-#include <string.h>
-
 #include "openconnect-internal.h"
 
+#include <errno.h>
+#include <string.h>
 
 static int sspi_setup(struct openconnect_info *vpninfo, struct http_auth_state *auth_state, const char *service, int proxy)
 {
index d01dedd0cc74fc7237e3e2f2467ecb5418b77a2d..00a676254bbdea9c526c61ecd4f07c83efdc4e9e 100644 (file)
--- a/stoken.c
+++ b/stoken.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include <stoken.h>
+
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include <stoken.h>
-
-#include "openconnect-internal.h"
-
 #ifndef STOKEN_CHECK_VER
 #define STOKEN_CHECK_VER(x,y) 0
 #endif
@@ -333,4 +333,3 @@ int do_gen_stoken_code(struct openconnect_info *vpninfo,
                return -ENOMEM;
        return 0;
 }
-
index 05d0bcc2e8799df67c20366d3476483f3436a360..760d36020c09e1b4ba7d78bdeff47bc1c42ce4b0 100644 (file)
--- a/textbuf.c
+++ b/textbuf.c
@@ -18,6 +18,8 @@
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <unistd.h>
 #include <string.h>
 #include <ctype.h>
@@ -28,8 +30,6 @@
 #include <limits.h>
 #include <stdarg.h>
 
-#include "openconnect-internal.h"
-
 #define BUF_CHUNK_SIZE 4096
 #define OC_BUF_MAX ((unsigned)(16*1024*1024))
 
index a9191d0ffad1dc38636c2110ed82b1b9fc9be4a0..1d27bb7f0e760358e4970a4192ae5bbc2e2ad02e 100644 (file)
@@ -17,6 +17,8 @@
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <winioctl.h>
@@ -25,8 +27,6 @@
 #include <errno.h>
 #include <stdio.h>
 
-#include "openconnect-internal.h"
-
 /*
  * TAP-Windows support inspired by http://i3.cs.berkeley.edu/ (v0.2) with
  * permission.
diff --git a/tun.c b/tun.c
index 43a2a5181ce99f95fa628470b512a08318d9073e..e5b8a49df183011ff53213ab78fb4ea8a807d075 100644 (file)
--- a/tun.c
+++ b/tun.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <string.h>
 #include <fcntl.h>
-#include <unistd.h>
-#include <signal.h>
 #include <sys/wait.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <netinet/ip.h>
 #include <net/if.h>
 #include <arpa/inet.h>
-#include <errno.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
 #if defined(__APPLE__) && defined(HAVE_NET_UTUN_H)
 #include <sys/kern_control.h>
 #include <sys/sys_domain.h>
 #include <net/if_utun.h>
 #endif
-
-#include "openconnect-internal.h"
+#include <errno.h>
+#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 /*
  * If an if_tun.h include file was found anywhere (by the Makefile), it's
index b31daa2834305ba84c24491da7d4c551c6580fde..5c8ebfca93604bda1b6b941ba899b3b97d67af4e 100644 (file)
@@ -16,8 +16,8 @@
 #ifndef __OPENCONNECT_WIN32_IPICMP_H__
 #define __OPENCONNECT_WIN32_IPICMP_H__
 
-#include <stdint.h>
 #include <ws2tcpip.h>
+#include <stdint.h>
 
 /* IPv4 header and flags used in gpst.c */
 
index b4738a5844a5a33bd81f1a08dfb70bdb57486d7f..426481020451948e9de99159f1b9bdd0567621d1 100644 (file)
--- a/wintun.c
+++ b/wintun.c
@@ -17,6 +17,8 @@
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <winioctl.h>
@@ -28,8 +30,6 @@
 #include <errno.h>
 #include <stdio.h>
 
-#include "openconnect-internal.h"
-
 static WINTUN_CREATE_ADAPTER_FUNC WintunCreateAdapter;
 static WINTUN_DELETE_ADAPTER_FUNC WintunDeleteAdapter;
 static WINTUN_DELETE_POOL_DRIVER_FUNC WintunDeletePoolDriver;
diff --git a/xml.c b/xml.c
index 462194262cc6a33a8ded6022b4b4e632d0d5e67e..bfb87627b1ac387ea50a330e724fd4054a5172b4 100644 (file)
--- a/xml.c
+++ b/xml.c
 
 #include <config.h>
 
-#include <stdio.h>
-#include <stdlib.h>
+#include "openconnect-internal.h"
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/types.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
+
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
-
-#include "openconnect-internal.h"
+#include <stdio.h>
+#include <stdlib.h>
 
 static char *fetch_and_trim(xmlNode *node)
 {
index 9d63e03a95623a6ffd02f949916539965acbcd21..024bb7491649a51bc600be1d1bf0a33db8f634cc 100644 (file)
--- a/yubikey.c
+++ b/yubikey.c
 
 #include <config.h>
 
+#include "openconnect-internal.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "openconnect-internal.h"
-
 #define NAME_TAG       0x71
 #define NAME_LIST_TAG  0x72
 #define KEY_TAG                0x73