]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/mothra/mothra.h
mothra: handle relative urls in <base> tag
[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         ICO,
54
55         PAGE,
56 };
57
58 /*
59  *  authentication types
60  */
61 enum{
62         ANONE,
63         ABASIC,
64 };
65
66 Image *hrule, *bullet, *linespace;
67 char home[512];         /* where to put files */
68 int chrwidth;           /* nominal width of characters in font */
69 Panel *text;            /* Panel displaying the current www page */
70 int debug;              /* command line flag */
71
72 /*
73  * HTTP methods
74  */
75 enum{
76         GET=1,
77         POST,
78 };
79
80 void update(Www *w);
81 void finish(Www *w);
82 void plrdhtml(char *, int, Www *);
83 void plrdplain(char *, int, Www *);
84 void htmlerror(char *, int, char *, ...);       /* user-supplied routine */
85 void seturl(Url *, char *, char *);
86 Url *selurl(char *);
87 void getpix(Rtext *, Www *);
88 ulong countpix(void *p);
89 void freepix(void *p);
90 int pipeline(char *, int);
91 void getfonts(void);
92 void *emalloc(int);
93 void *emallocz(int, int);
94 void nstrcpy(char *to, char *from, int len);
95 void freeform(void *p);
96 int Ufmt(Fmt *f);
97 #pragma varargck type "U" char*
98 void message(char *, ...);
99 int filetype(int, char *, int);
100 int snooptype(int);
101 void mkfieldpanel(Rtext *);
102 void geturl(char *, int, int, int);
103 int urlpost(Url*, char*);
104 int urlget(Url*, int);
105 int urlresolve(Url *);
106 char version[];
107 Mouse mouse;