•
D.2 Multiple backends treated equally
•
D.3 Multiple sessions per process on some platforms
•
D.4 C, not C++
•
D.5 Security-conscious coding
•
D.6 Independence of specific compiler
•
D.7 Small code size
•
D.8 Single-threaded code
•
D.9 Keystrokes sent to the server wherever possible
•
D.10 640×480 friendliness in configuration panels
•
D.11 Automatically generated Makefile s
•
D.12 Coroutines in ssh.c
•
D.13 Single compilation of each source file
•
D.14 Do as we say, not as we do
D.1 Cross-OS portability
Despite Windows being its main area of fame, PuTTY is no longer a Windows-only application suite. It has a working Unix port; a Mac port is in progress; more ports may or may not happen at a later date.
Therefore, embedding Windows-specific code in core modules such as ssh.c is not acceptable. We went to great lengths to remove all the Windows-specific stuff from our core modules, and to shift it out into Windows-specific modules. Adding large amounts of Windows-specific stuff in parts of the code that should be portable is almost guaranteed to make us reject a contribution.
The PuTTY source base is divided into platform-specific modules and platform-generic modules. The Unix-specific modules are all in the unix subdirectory; the Mac-specific modules are in the mac subdirectory; the Windows-specific modules are in the windows subdirectory.
All the modules in the main source directory - notably all of the code for the various back ends - are platform-generic. We want to keep them that way.
This also means you should stick to what you are guaranteed by ANSI/ISO C (that is, the original C89/C90 standard, not C99). Try not to make assumptions about the precise size of basic types such as int and long int; don't use pointer casts to do endianness-dependent operations, and so on.
(There are one or two aspects of ANSI C portability which we don't care about. In particular, we expect PuTTY to be compiled on 32-bit architectures or bigger; so it's safe to assume that int is at least 32 bits wide, not just the 16 you are guaranteed by ANSI C. Similarly, we assume that the execution character encoding is a superset of the printable characters of ASCII, though we don't assume the numeric values of control characters, particularly '\n' and '\r'.)
D.2 Multiple backends treated equally
PuTTY is not an SSH client with some other stuff tacked on the side. PuTTY is a generic, multiple-backend, remote VT-terminal client which happens to support one backend which is larger, more popular and more useful than the rest. Any extra feature which can possibly be general across all backends should be so: localising features unnecessarily into the SSH back end is a design error. (For example, we had several code submissions for proxy support which worked by hacking ssh.c. Clearly this is completely wrong: the network.h abstraction is the place to put it, so that it will apply to all back ends equally, and indeed we eventually put it there after another contributor sent a better patch.)
The rest of PuTTY should try to avoid knowing anything about specific back ends if at all possible. To support a feature which is only available in one network protocol, for example, the back end interface should be extended in a general manner such that any back end which is able to provide that feature can do so. If it so happens that only one back end actually does, that's just the way it is, but it shouldn't be relied upon by any code.
D.3 Multiple sessions per process on some platforms
Some ports of PuTTY - notably the in-progress Mac port - are constrained by the operating system to run as a single process potentially managing multiple sessions.