]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - putty.h
Removing one bug, and hunting another
[PuTTY.git] / putty.h
diff --git a/putty.h b/putty.h
index 4c78be66f12e74feec76f1b3d7c0bc675f5737f5..99961fdafc4ddd428173991efbc490423875eafe 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -13,7 +13,6 @@
 #include <Controls.h>
 #include <Windows.h>
 typedef UInt32 DWORD;
-struct mac_session;
 #endif /* macintosh */
 
 #ifndef TRUE
@@ -48,13 +47,6 @@ struct mac_session;
 #define ATTR_MASK    0xFFFFFF00UL
 #define CHAR_MASK    0x000000FFUL
 
-#ifdef macintosh
-struct mac_session;
-typedef struct mac_session *Context;
-#else /* not macintosh */
-typedef HDC Context;
-#endif /* not macintosh */
-
 #ifdef macintosh
 #define SEL_NL { 13 }
 #else
@@ -98,20 +90,63 @@ typedef enum {
 } VT_Mode;
 
 typedef struct Session Session;
+typedef struct Socket Socket;
+
+/* Types of network event */
+
+typedef enum {
+    NE_NULL,   /* Nothing happened */
+    NE_OPEN,   /* Connection successfully opened */
+    NE_NOHOST, /* DNS lookup failed for some reason */
+    NE_REFUSED,        /* Port unreachable */
+    NE_NOOPEN, /* Connection failed to open for some other reason */
+    NE_DATA,   /* Incoming normal data */
+    NE_URGENT, /* Incoming urgent data */
+    NE_SENT,   /* Used internally by Mac network stack */
+    NE_CLOSING,        /* Connection closed by remote host */
+    NE_CLOSED, /* Connection close completed */
+    NE_TIMEOUT,        /* Remote host vanished */
+    NE_ABORT,  /* Remote host reset connection */
+    NE_DIED,   /* Connection has failed for some other reason */
+} Net_Event_Type;
 
-typedef struct {
 #ifdef macintosh
-       char *(*init) (Session *, char *host, int port, char **realhost);
-       int (*msg)(Session *);
-#else /* not macintosh */
-    char *(*init) (HWND hwnd, char *host, int port, char **realhost);
-    int (*msg) (WPARAM wParam, LPARAM lParam);
-#endif /* not macintosh */
+typedef void *SOCKET;
+#define INVALID_SOCKET NULL
+#endif
+
+typedef struct {
+    char *(*init) (Session *);
+    int (*msg)(Session *, SOCKET, Net_Event_Type);
     void (*send) (Session *, char *buf, int len);
     void (*size) (Session *);
     void (*special) (Session *, Telnet_Special code);
+    void (*shutdown) (Session *);
 } Backend;
 
+#ifdef macintosh
+typedef struct {
+    int (*init)(void);
+    SOCKET (*open)(Session *, char const *, int);
+    int (*recv)(SOCKET, void *, int, int);
+    int (*send)(SOCKET, void *, int, int);
+    void (*poll)(void);
+    void (*close)(SOCKET);
+    void (*destroy)(SOCKET);
+    void (*shutdown)(void);
+} Network_Stack;
+
+GLOBAL Network_Stack *net_stack;
+
+#define net_open(s, h, p)      ((*net_stack->open)((s), (h), (p)))
+#define net_recv(s, b, l, f)   ((*net_stack->recv)((s), (b), (l), (f)))
+#define net_send(s, b, l, f)   ((*net_stack->send)((s), (b), (l), (f)))
+#define net_poll()             ((*net_stack->poll)())
+#define net_close(s)           ((*net_stack->close)(s))
+#define net_destroy(s)         ((*net_stack->destroy)(s))
+#define net_shutdown()         ((*net_stack->shutdown)())
+#endif
+
 typedef struct {
     /* Basic options */
     char host[512];
@@ -120,6 +155,7 @@ typedef struct {
     int close_on_exit;
     /* SSH options */
     int nopty;
+    enum { CIPHER_3DES, CIPHER_BLOWFISH } cipher;
     /* Telnet options */
     char termtype[32];
     char termspeed[32];
@@ -252,6 +288,7 @@ typedef struct Session {
     short              fontnum;
     int                        font_ascent;
     int                        font_leading;
+    int                        font_boldadjust;
     WindowPtr          window;
     PaletteHandle      palette;
     ControlHandle      scrollbar;
@@ -259,6 +296,7 @@ typedef struct Session {
 #endif
 } Session;
 
+typedef struct Socket Socket;
 
 /*
  * Exports from display system
@@ -272,15 +310,31 @@ extern void pre_paint(Session *);
 extern void post_paint(Session *);
 extern void palette_set(Session *, int, int, int, int);
 extern void palette_reset(Session *);
-void write_clip (void *, int);
-void get_clip (void **, int *);
+extern void write_clip (void *, int);
+extern void get_clip (void **, int *);
 extern void do_scroll(Session *, int, int, int);
-void fatalbox (const char *, ...);
+extern void fatalbox(const char *, ...);
 #ifdef macintosh
 #pragma noreturn (fatalbox)
 #endif
-extern void beep (Session *s);
-#define OPTIMISE_IS_SCROLL 1
+extern void beep(Session *s);
+extern void lognegot(const char *);
+
+/*
+ * Exports from the network system
+ */
+
+#ifndef macintosh
+extern Socket *net_open(Session *, char *host, int port);
+extern char *net_realname(Socket *);
+extern int net_recv(Socket *, void *, int, int);
+extern int net_send(Socket *, void *, int, int);
+extern void net_close(Socket *); /* ask the remote end to close */
+extern void net_destroy(Socket *); /* Tidy up */
+#endif
+#define SEND_PUSH 0x01
+#define SEND_URG 0x02
+
 
 /*
  * Exports from noise.c.