X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=doc%2Fudp.but;h=f7640268ee5d8a03e3c5b028d60e15c8081168b7;hb=72b659cb728b1f549c49b40d37f59b870f006fac;hp=8e425616d63e59a55d22cf90bf5840b7d6faf235;hpb=da948bc1517f1af94c774f49a831aa9ea19d18aa;p=PuTTY.git diff --git a/doc/udp.but b/doc/udp.but index 8e425616..f7640268 100644 --- a/doc/udp.but +++ b/doc/udp.but @@ -3,8 +3,6 @@ \# PuTTY's `unwritten design principles'. It has nothing to do with \# the User Datagram Protocol. -\define{versionidudp} \versionid $Id$ - \A{udp} PuTTY hacking guide This appendix lists a selection of the design principles applying to @@ -45,7 +43,10 @@ endianness-dependent operations, and so on. \e{don't} care about. In particular, we expect PuTTY to be compiled on 32-bit architectures \e{or bigger}; so it's safe to assume that \c{int} is at least 32 bits wide, not just the 16 you are guaranteed -by ANSI C.) +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 \cw{'\\n'} and \cw{'\\r'}.) \H{udp-multi-backend} Multiple backends treated equally @@ -75,21 +76,23 @@ 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. -Therefore, the platform-independent parts of PuTTY use \e{hardly -any} global variables. The very few that do exist, such as -\c{flags}, are tolerated because they are not specific to a -particular login session: instead, they define properties that are -expected to apply equally to \e{all} the sessions run by a single -PuTTY process. Any data that is specific to a particular network -session is stored in dynamically allocated data structures, and -pointers to these structures are passed around between functions. +Therefore, the platform-independent parts of PuTTY never use global +variables to store per-session data. The global variables that do +exist are tolerated because they are not specific to a particular +login session: \c{flags} defines properties that are expected to +apply equally to \e{all} the sessions run by a single PuTTY process, +the random number state in \cw{sshrand.c} and the timer list in +\cw{timing.c} serve all sessions equally, and so on. But most data +is specific to a particular network session, and is therefore stored +in dynamically allocated data structures, and pointers to these +structures are passed around between functions. Platform-specific code can reverse this decision if it likes. The Windows code, for historical reasons, stores most of its data as global variables. That's OK, because \e{on Windows} we know there is only one session per PuTTY process, so it's safe to do that. But changes to the platform-independent code should avoid introducing -any more global variables than already exist. +global variables, unless they are genuinely cross-session. \H{udp-pure-c} C, not C++