Change how we handle the Ssh_gss_buf type. Previously, we defined it
[sgt/putty] / unix / unix.h
CommitLineData
f7f27309 1#ifndef PUTTY_UNIX_H
2#define PUTTY_UNIX_H
3
76d3a838 4#ifdef HAVE_CONFIG_H
5# include "uxconfig.h" /* Space to hide it from mkfiles.pl */
6#endif
7
9a30e26b 8#include <stdio.h> /* for FILENAME_MAX */
2dc6356a 9#include "charset.h"
10
9a30e26b 11struct Filename {
12 char path[FILENAME_MAX];
13};
c6940f12 14FILE *f_open(struct Filename, char const *, int);
9a30e26b 15
16struct FontSpec {
17 char name[256];
18};
19
f7f27309 20typedef void *Context; /* FIXME: probably needs changing */
21
f7f9fb5c 22typedef int OSSocket;
23#define OSSOCKET_DEFINED /* stop network.h using its default */
24
1709795f 25extern Backend pty_backend;
26
e6346999 27/*
28 * Under GTK, we send MA_CLICK _and_ MA_2CLK, or MA_CLICK _and_
29 * MA_3CLK, when a button is pressed for the second or third time.
30 */
31#define MULTICLICK_ONLY_EVENT 0
32
33/*
d9b15094 34 * Under GTK, there is no context help available.
35 */
36#define HELPCTX(x) P(NULL)
37#define FILTER_KEY_FILES NULL /* FIXME */
38
39/*
e6346999 40 * Under X, selection data must not be NUL-terminated.
41 */
42#define SELECTION_NUL_TERMINATED 0
43
0f351587 44/*
45 * Under X, copying to the clipboard terminates lines with just LF.
46 */
47#define SEL_NL { 10 }
48
f7f27309 49/* Simple wraparound timer function */
50unsigned long getticks(void); /* based on gettimeofday(2) */
51#define GETTICKCOUNT getticks
39934deb 52#define TICKSPERSEC 1000 /* we choose to use milliseconds */
53#define CURSORBLINK 450 /* no standard way to set this */
2ac3322e 54/* getticks() works using gettimeofday(), so it's vulnerable to system clock
55 * changes causing chaos. Therefore, we provide a compensation mechanism. */
56#define TIMING_SYNC
57#define TIMING_SYNC_ANOW
58extern long tickcount_offset;
f7f27309 59
60#define WCHAR wchar_t
61#define BYTE unsigned char
62
86557057 63#ifndef NO_GSSAPI
64/*
65 * GSS-API stuff
66 */
67#include <gssapi/gssapi.h>
68typedef gss_buffer_desc Ssh_gss_buf;
69#define SSH_GSS_EMPTY_BUF GSS_C_EMPTY_BUFFER
70#endif
71
f7397dc6 72/*
73 * Unix-specific global flag
74 *
75 * FLAG_STDERR_TTY indicates that standard error might be a terminal and
76 * might get its configuration munged, so anything trying to output plain
77 * text (i.e. with newlines in it) will need to put it back into cooked
78 * mode first. Applications setting this flag should also call
79 * stderr_tty_init() before messing with any terminal modes, and can call
80 * premsg() before outputting text to stderr and postmsg() afterwards.
81 */
82#define FLAG_STDERR_TTY 0x1000
83
e9aef757 84/* Things pty.c needs from pterm.c */
a8327734 85char *get_x_display(void *frontend);
86int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
7af753e6 87long get_windowid(void *frontend);
755a6d84 88
5bf9955d 89/* Things gtkdlg.c needs from pterm.c */
90void *get_window(void *frontend); /* void * to avoid depending on gtk.h */
91
3f935d5b 92/* Things pterm.c needs from gtkdlg.c */
f89c3294 93int do_config_box(const char *title, Config *cfg,
94 int midsession, int protcfginfo);
3f935d5b 95void fatal_message_box(void *window, char *msg);
7718480a 96void about_box(void *window);
8eed910d 97void *eventlogstuff_new(void);
98void showeventlog(void *estuff, void *parentwin);
cbe2d68f 99void logevent_dlg(void *estuff, const char *string);
abb6895f 100int reallyclose(void *frontend);
3f935d5b 101
10705014 102/* Things pterm.c needs from {ptermm,uxputty}.c */
103char *make_default_wintitle(char *hostname);
df7c7e52 104int process_nonoption_arg(char *arg, Config *cfg, int *allow_launch);
10705014 105
f5dd8adb 106/* pterm.c needs this special function in xkeysym.c */
107int keysym_to_unicode(int keysym);
108
faec60ed 109/* Things uxstore.c needs from pterm.c */
c85623f9 110char *x_get_default(const char *key);
faec60ed 111
0ac15bdc 112/* Things uxstore.c provides to pterm.c */
113void provide_xrm_string(char *string);
114
f7397dc6 115/* Things provided by uxcons.c */
116struct termios;
117void stderr_tty_init(void);
118void premsg(struct termios *);
119void postmsg(struct termios *);
120
0ff9ea38 121/* The interface used by uxsel.c */
122void uxsel_init(void);
123typedef int (*uxsel_callback_fn)(int fd, int event);
124void uxsel_set(int fd, int rwx, uxsel_callback_fn callback);
125void uxsel_del(int fd);
c5e438ec 126int select_result(int fd, int event);
0ff9ea38 127int first_fd(int *state, int *rwx);
128int next_fd(int *state, int *rwx);
74aca06d 129/* The following are expected to be provided _to_ uxsel.c by the frontend */
130int uxsel_input_add(int fd, int rwx); /* returns an id */
131void uxsel_input_remove(int id);
c5e438ec 132
1d0d4a3b 133/* uxcfg.c */
134struct controlbox;
8a7f1392 135void unix_setup_config_box(struct controlbox *b, int midsession, int protocol);
1d0d4a3b 136
8d68f26a 137/* gtkcfg.c */
138void gtk_setup_config_box(struct controlbox *b, int midsession, void *window);
139
2dc6356a 140/*
141 * In the Unix Unicode layer, DEFAULT_CODEPAGE is a special value
142 * which causes mb_to_wc and wc_to_mb to call _libc_ rather than
143 * libcharset. That way, we can interface the various charsets
144 * supported by libcharset with the one supported by mbstowcs and
145 * wcstombs (which will be the character set in which stuff read
146 * from the command line or config files is assumed to be encoded).
147 */
148#define DEFAULT_CODEPAGE 0xFFFF
149#define CP_UTF8 CS_UTF8 /* from libcharset */
f7f27309 150
68a49acb 151#define strnicmp strncasecmp
152#define stricmp strcasecmp
153
15b5d988 154/* BSD-semantics version of signal(), and another helpful function */
0f33f9d1 155void (*putty_signal(int sig, void (*func)(int)))(int);
15b5d988 156void block_signal(int sig, int block_it);
0f33f9d1 157
db9b7dce 158/* uxmisc.c */
159int cloexec(int);
160
facd762c 161/*
162 * Exports from unicode.c.
163 */
21d2b241 164struct unicode_data;
6ac7f054 165int init_ucs(struct unicode_data *ucsdata, char *line_codepage,
166 int utf8_override, int font_charset, int vtmode);
facd762c 167
2f92b717 168/*
169 * Spare function exported directly from uxnet.c.
170 */
0a4022a1 171void *sk_getxdmdata(void *sock, int *lenp);
2f92b717 172
b51259f6 173/*
174 * General helpful Unix stuff: more helpful version of the FD_SET
175 * macro, which also handles maxfd.
176 */
177#define FD_SET_MAX(fd, max, set) do { \
178 FD_SET(fd, &set); \
179 if (max < fd + 1) max = fd + 1; \
180} while (0)
181
aef05b78 182/*
183 * Exports from winser.c.
184 */
185extern Backend serial_backend;
186
f7f27309 187#endif