Upgrade libgit2
[TortoiseGit.git] / src / TortoisePlink / be_list.c
blob94659585f98a21a9f6c0c7f7bb6985e0d3fbc3b1
1 /*
2 * Source file that is rebuilt per application, and provides the list
3 * of backends, the default protocol, and the application name.
5 * This file expects the build system to provide some per-application
6 * definitions on the compiler command line. So you don't just add it
7 * directly to the sources list for an application. Instead you call
8 * the be_list() function defined in setup.cmake, e.g.
10 * be_list(target-name AppName [SSH] [SERIAL] [OTHERBACKENDS])
12 * This translates into the following command-line macro definitions
13 * used by the code below:
15 * - APPNAME should be defined to the name of the program, in
16 * user-facing capitalisation (e.g. PuTTY rather than putty).
17 * Unquoted: it's easier to stringify it in the preprocessor than
18 * to persuade cmake to put the right quotes on the command line on
19 * all build platforms.
21 * - The following macros should each be defined to 1 if a given set
22 * of backends should be added to the backends[] list, or 0 if they
23 * should not be:
25 * * SSH: the two SSH backends (SSH proper, and bare-ssh-connection)
27 * * SERIAL: the serial port backend
29 * * OTHERBACKENDS: the non-cryptographic network protocol backends
30 * (Telnet, Rlogin, SUPDUP, Raw)
33 #include <stdio.h>
34 #include "putty.h"
36 const char *const appname = STR(APPNAME);
39 * Define the default protocol for the application. This is always a
40 * network backend (serial ports come second behind network, in every
41 * case). Applications that don't have either (such as pterm) don't
42 * need this variable anyway, so just set it to -1.
44 #if SSH
45 const int be_default_protocol = PROT_SSH;
46 #elif OTHERBACKENDS
47 const int be_default_protocol = PROT_TELNET;
48 #else
49 const int be_default_protocol = -1;
50 #endif
53 * List all the configured backends, in the order they should appear
54 * in the config box.
56 const struct BackendVtable *const backends[] = {
58 * Start with the most-preferred network-remote-login protocol.
59 * That's SSH if present, otherwise Telnet if present.
61 #if SSH
62 &ssh_backend,
63 #elif OTHERBACKENDS
64 &telnet_backend, /* Telnet at the top if SSH is absent */
65 #endif
68 * Second on the list is the serial-port backend, if available.
70 #if SERIAL
71 &serial_backend,
72 #endif
75 * After that come the remaining network protocols: Telnet if it
76 * hasn't already appeared above, and Rlogin, SUPDUP and Raw.
78 #if OTHERBACKENDS && SSH
79 &telnet_backend, /* only if SSH displaced it at the top */
80 #endif
81 #if OTHERBACKENDS
82 &rlogin_backend,
83 &supdup_backend,
84 &raw_backend,
85 #endif
88 * Bare ssh-connection / PSUSAN is a niche protocol and goes well
89 * down the list.
91 #if SSH
92 &sshconn_backend,
93 #endif
96 * Done. Null pointer to mark the end of the list.
98 NULL
102 * Number of backends at the start of the above list that should have
103 * radio buttons in the config UI.
105 * The rule is: the most-preferred network backend, and Serial, each
106 * get a radio button if present.
108 * The rest will be relegated to a dropdown list.
110 const size_t n_ui_backends =
112 #if SSH || OTHERBACKENDS
114 #endif
115 #if SERIAL
117 #endif