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