]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/mothra/mothra.h
kernel: keep segment locked for data2txt
[plan9front.git] / sys / src / cmd / mothra / mothra.h
1 enum{
2         NWWW=64,        /* # of pages we hold in the log */
3         NXPROC=5,       /* # of parallel procs loading the pix */
4         NPIXMB=8,       /* megabytes of image data to keep arround */
5         NNAME=512,
6         NLINE=256,
7         NAUTH=128,
8         NTITLE=81,      /* length of title (including nul at end) */
9         NLABEL=50,      /* length of option name in forms */
10         NREDIR=10,      /* # of redirections we'll tolerate before declaring a loop */
11 };
12
13 typedef struct Action Action;
14 typedef struct Url Url;
15 typedef struct Www Www;
16 typedef struct Field Field;
17 struct Action{
18         char *image;
19         Field *field;
20         char *link;
21         char *name;
22         int ismap;
23         int width;
24         int height;
25 };
26 struct Url{
27         char fullname[NNAME];
28         char basename[NNAME];
29         char reltext[NNAME];
30         char tag[NNAME];
31         int map;                /* is this an image map? */
32 };
33 struct Www{
34         Url *url;
35         void *pix;
36         void *form;
37         char title[NTITLE];
38         Rtext *text;
39         int yoffs;
40         int changed;            /* reader sets this every time it updates page */
41         int finished;           /* reader sets this when done */
42         int alldone;            /* page will not change further -- used to adjust cursor */
43 };
44
45 enum{
46         PLAIN,
47         HTML,
48
49         GIF,
50         JPEG,
51         PNG,
52         BMP,
53
54         GUNZIP,
55         COMPRESS,
56         PAGE,
57 };
58
59 /*
60  *  authentication types
61  */
62 enum{
63         ANONE,
64         ABASIC,
65 };
66
67 Image *hrule, *bullet, *linespace;
68 char home[512];         /* where to put files */
69 int chrwidth;           /* nominal width of characters in font */
70 Panel *text;            /* Panel displaying the current www page */
71 int debug;              /* command line flag */
72
73 /*
74  * HTTP methods
75  */
76 enum{
77         GET=1,
78         POST,
79 };
80
81 void update(Www *w);
82 void finish(Www *w);
83 void plrdhtml(char *, int, Www *);
84 void plrdplain(char *, int, Www *);
85 void htmlerror(char *, int, char *, ...);       /* user-supplied routine */
86 void seturl(Url *, char *, char *);
87 void getpix(Rtext *, Www *);
88 ulong countpix(void *p);
89 void freepix(void *p);
90 int pipeline(char *, int);
91 int urlopen(Url *, int, char *);
92 void getfonts(void);
93 void *emalloc(int);
94 void *emallocz(int, int);
95 void freeform(void *p);
96 void message(char *, ...);
97 int snooptype(int fd);
98 void mkfieldpanel(Rtext *);
99 void geturl(char *, int, char *, int, int);
100 char version[];