1 /* eb.h 2 * Copyright (c) Karl Dahlke, 2008 3 * This file is part of the edbrowse project, released under GPL. 4 */ 5 6 #ifndef EB_H 7 #define EB_H 1 8 9 /* the symbol DOSLIKE is used to conditionally compile those constructs 10 * that are common to DOS and NT, but not typical of Unix. */ 11 #ifdef MSDOS 12 #define DOSLIKE 1 13 #endif 14 #ifdef _WIN32 15 #define DOSLIKE 1 16 #endif 17 18 /* Define _GNU_SOURCE on Linux, so we don't have an implicit declaration 19 * of asprintf, but only if we are not compiling C++. 20 * Turns out that when compiling C++ on LInux, _GNU_SOURCE is helpfully 21 * predefined, so defining it twice generates a nasty warning. 22 */ 23 24 #if defined(EDBROWSE_ON_LINUX) && !defined(__cplusplus) 25 #define _GNU_SOURCE 26 #endif 27 28 /* seems like everybody needs these header files */ 29 #include <sys/types.h> 30 #include <sys/stat.h> 31 #include <ctype.h> 32 #include <string.h> 33 #include <memory.h> 34 #include <stdarg.h> 35 #include <stdlib.h> 36 #include <stdio.h> 37 #include <errno.h> 38 #include <fcntl.h> 39 #include <curl/curl.h> 40 #ifdef DOSLIKE 41 #include <io.h> 42 #include <direct.h> // for _mkdir, ... 43 #include <conio.h> // for _kbhit, getch, getche 44 #include <stdint.h> // for UINT32_MAX 45 #include "vsprtf.h" // for WIN32 asprintf, vasprintf, ... 46 #else 47 #include <unistd.h> 48 #endif 49 #include <pthread.h> 50 51 #ifndef O_BINARY 52 #define O_BINARY 0 53 #endif 54 #ifndef O_TEXT 55 #define O_TEXT 0 56 #endif 57 #ifndef O_SYNC 58 #define O_SYNC 0 59 #endif 60 61 /* WARNING: the following typedef is pseudo-standard in C. 62 * Some systems will define ushort in sys/types.h, others will not. 63 * Unfortunately there is no #define symbol to key on; 64 * no way to conditionally compile the following statement. */ 65 #if defined(DOSLIKE) || defined(__ANDROID__) 66 typedef unsigned short ushort; 67 #endif 68 /* sys/types.h defines unsigned char as unchar. I prefer uchar. 69 * It is consistent with ushort uint and ulong, and doesn't remind 70 * me of the uncola, a char that isn't really a char. */ 71 typedef unsigned char uchar; 72 73 /* We use unsigned char for boolean fields. */ 74 #ifndef __cplusplus 75 typedef uchar bool; 76 #define false 0 77 #define true 1 78 #endif 79 80 // Opaque indicator of an object that can be shared 81 // between edbrowse and the js engine. 82 typedef void *jsobjtype; 83 84 extern const char *jsSourceFile; // sourcefile providing the javascript 85 extern int jsLineno; // line number 86 87 /********************************************************************* 88 duktape is not threadsafe, so says the programmer's guide. 89 So javascript runs in the foreground as we push buttons etc, 90 or, there is at most one thread running javascript in the background, 91 if we choose to implement that. 92 Here is the js background thread. It is 0 if no thread is running. 93 *********************************************************************/ 94 95 extern pthread_t jsbt; 96 97 enum ej_proptype { 98 EJ_PROP_NONE, 99 EJ_PROP_STRING, 100 EJ_PROP_BOOL, 101 EJ_PROP_INT, 102 EJ_PROP_FLOAT, 103 EJ_PROP_OBJECT, 104 EJ_PROP_ARRAY, 105 EJ_PROP_FUNCTION, 106 EJ_PROP_INSTANCE, 107 EJ_PROP_NULL, 108 }; 109 110 /* ctype macros, when you're passing a byte, 111 * and you don't want to worry about whether it's char or uchar. 112 * Call the regular routines when c is an int, from fgetc etc. */ 113 #define isspaceByte(c) isspace((uchar)c) 114 #define isalphaByte(c) isalpha((uchar)c) 115 #define isalnumByte(c) isalnum((uchar)c) 116 #define islowerByte(c) islower((uchar)c) 117 #define isupperByte(c) isupper((uchar)c) 118 #define isdigitByte(c) isdigit((uchar)c) 119 #define ispunctByte(c) ispunct((uchar)c) 120 #define isprintByte(c) isprint((uchar)c) 121 122 /* http encoding, content type, content transfer encoding */ 123 enum { ENC_PLAIN, ENC_COMPRESS, ENC_GZIP, ENC_URL, ENC_MFD }; 124 enum { CT_OTHER, CT_TEXT, CT_HTML, CT_RICH, CT_APPLIC, CT_MULTI, CT_ALT }; 125 enum { CE_7BIT, CE_8BIT, CE_QP, CE_64 }; 126 127 /* This program was originally written in perl. 128 * So I got use to perl strings, which admit nulls. 129 * In our case, they will be terminated by newline. */ 130 typedef uchar *pst; /* perl string */ 131 132 /* A specific nonascii char denotes an html tag 133 * in the rendered html text. 134 * See the comments in buffers.c for the rationale. */ 135 #define InternalCodeChar '\2' 136 #define InternalCodeCharAlternate '\1' 137 #define TableCellChar '\3' 138 139 /* How long can an absolute path be? */ 140 #define ABSPATH 1024 // max length of an absolute pathname 141 #define MAXRE 512 // max length of a regular expression 142 #define MAXTTYLINE 256 // max length of an entered line 143 #define MAXHOSTLEN 400 144 #define MAXPROTLEN 12 145 #define MAXUSERPASS 80 // user name or password 146 #define MAXACCOUNT 100 // number of email accounts 147 #define MAXAGENT 50 // number of user agents 148 #define MAXMIME 40 // number of mime types 149 #define MAXPROXY 200 // number of proxy entries 150 #define MAXDBT 100 // number of configured database tables 151 #define MAXTCOLS 40 // columns in a configured table 152 #define MAXSESSION 1000 // concurrent edbrowse sessions 153 /* Allocation increment for a growing string, that we don't expect 154 * to get too large. This must be a power of 2. */ 155 #define ALLOC_GR 0x100 156 /* print a dot on download for each chunk of this size */ 157 #define CHUNKSIZE 1000000 158 159 /* alignments */ 160 #define AL_LEFT 0 161 #define AL_CENTER 1 162 #define AL_RIGHT 2 163 #define AL_BLOCK 3 164 #define AL_NO 4 165 166 /* left and top borders for dialog box, stubs. */ 167 #define DIALOG_LB 1 168 #define DIALOG_TB 1 169 #define COLOR_DIALOG_TEXT 0 170 #define G_BFU_FONT_SIZE 0 171 172 extern const char *version; // the version of edbrowse 173 extern const char *progname; // edbrowse, or the absolute path to edbrowse 174 extern const char eol[]; /* internet end of line */ 175 extern char emptyString[]; /* use this whenever you would use "" */ 176 177 /* Here are the strings you can send out to identify this browser. 178 * Most of the time we will send out the first string, edbrowse-2.15.3. 179 * But sometimes we have to lie. 180 * When you deal with clickbank, for instance, they won't let you in the 181 * door unless you are one of three approved browsers. 182 * Tell them you're Explorer, and walk right in. 183 * Anyways, this array holds up to 10 user agent strings. */ 184 extern char *userAgents[], *currentAgent; 185 extern char *newlocation; 186 extern int newloc_d; /* delay */ 187 extern bool newloc_r; /* location replaces this page */ 188 extern struct ebFrame *newloc_f; /* frame calling for new web page */ 189 extern const char *ebrc_string; /* default ebrc file */ 190 191 // Get data from the internet. Zero the structure, set the 192 // members you need, then call httpConnect. 193 struct i_get { 194 // the data returned from the internet fetch 195 char *buffer; 196 int length; 197 // in case you want the headers 198 char **headers_p; 199 const char *url; 200 char *urlcopy; 201 int urlcopy_l; 202 const char *custom_h; // custom http headers passed to curl 203 char *cfn; // changed filename 204 const char *thisfile; 205 char *referrer; 206 CURL *h; 207 int tsn; // thread sequence number 208 // State of download to disk, see http.c for state values. 209 int down_state; 210 int down_fd; /* downloading file descriptor */ 211 int down_msg; 212 const char *down_file; /* downloading filename */ 213 const char *down_file2; /* without download directory */ 214 int down_length; 215 bool down_ok; 216 uchar down_force; 217 bool uriEncoded; 218 bool foreground; 219 bool pg_ok; // watch for plugins 220 bool playonly; // only player plugins 221 bool csp; // content supresses plugins 222 bool is_http; 223 bool cacheable; 224 bool last_curlin; 225 bool move_capable; 226 char error[CURL_ERROR_SIZE + 1]; 227 long code; /* example, 404 */ 228 /* an assortment of variables that are gleaned from the incoming http headers */ 229 char *headers; 230 int headers_len; 231 /* http content type is used in many places, and isn't arbitrarily long 232 * or case sensitive, so keep our own sanitized copy. */ 233 char content[60]; 234 char *charset; /* extra content info such as charset */ 235 long long hcl; /* http content length */ 236 char *cdfn; /* http content disposition file name */ 237 time_t modtime; /* http modification time */ 238 char *etag; /* the etag in the header */ 239 char auth_realm[60]; /* WWW-Authenticate realm header */ 240 char *newloc; 241 int newloc_d; 242 }; 243 244 struct MACCOUNT { /* pop3 account */ 245 char *login, *password, *from, *reply; 246 char *inurl, *outurl; 247 int inport, outport; 248 uchar inssl, outssl; 249 bool nofetch, imap, secure; 250 }; 251 extern struct MACCOUNT accounts[]; /* all the email accounts */ 252 extern int maxAccount; /* how many email accounts specified */ 253 254 struct MIMETYPE { 255 char *type, *desc; 256 char *suffix, *prot, *program; 257 char *urlmatch; 258 char *content; 259 char outtype; 260 bool down_url, from_file; 261 }; 262 extern struct MIMETYPE mimetypes[]; 263 extern int maxMime; /* how many mime types specified */ 264 265 struct DBTABLE { 266 char *name, *shortname; 267 char *cols[MAXTCOLS]; 268 int ncols; 269 unsigned char key1, key2, key3, key4; 270 char *types; 271 char *nullable; 272 }; 273 274 // This curl handle is always open, to retain the cookie space 275 // and to accept cookies generated by javascript. 276 extern CURL *global_http_handle; 277 extern CURLSH *global_share_handle; 278 extern int debugLevel; /* 0 to 9 */ 279 extern bool debugClone, debugEvent, debugThrow, debugCSS; 280 extern bool demin; // deminimize javascript 281 extern bool uvw; // trace points 282 extern bool gotimers; // run javascript timers 283 extern int rr_interval; // rerender the screen after this many seconds 284 extern FILE *debugFile; 285 extern char *debugFileName; 286 extern char *sslCerts; /* ssl certificates to validate the secure server */ 287 extern int verifyCertificates; /* is a certificate required for the ssl connection? */ 288 extern int displayLength; // when printing a line 289 extern int formatLineLength; // when formatting html 290 extern bool formatOverflow; 291 extern int webTimeout, mailTimeout; 292 extern uchar browseLocal; 293 extern bool sqlPresent; /* Was edbrowse compiled with SQL built in? */ 294 extern bool curlActive; // is curl running? 295 extern bool ismc; /* Is the program running as a mail client? */ 296 extern bool isimap; /* Is the program running as an imap client? */ 297 extern bool down_bg; // download in background 298 extern bool down_jsbg; // download javascript in background 299 extern char whichproc; // which edbrowse-xx process 300 extern char showProgress; // feedback as a file is downloaded 301 extern char eb_language[]; /* edbrowse language, determined by $LANG */ 302 extern int eb_lang; // encoded version of the above, for languages that we recognize 303 extern bool cons_utf8; /* does the console expect utf8? */ 304 extern bool iuConvert; /* perform iso utf8 conversions automatically */ 305 extern char type8859; /* 1 through 15 */ 306 extern bool js_redirects; /* window.location = new_url */ 307 extern bool passMail; /* pass mail across the filters */ 308 extern bool errorExit; /* exit on any error, for scripting purposes */ 309 extern bool isInteractive; 310 extern volatile bool intFlag; /* set this when interrupt signal is caught */ 311 extern time_t intStart; 312 extern bool binaryDetect; 313 extern bool inputReadLine; 314 extern bool curlAuthNegotiate; /* try curl negotiate (SPNEGO) auth */ 315 extern bool listNA; /* list nonascii chars */ 316 extern bool inInput; /* reading line from standard in */ 317 extern int fileSize; /* when reading/writing files */ 318 extern char errorMsg[]; /* generated error message */ 319 extern int localAccount; /* this is the smtp server for outgoing mail */ 320 extern char *mailDir; /* move to this directory when fetching mail */ 321 extern char *mailUnread; /* place to hold fetched but unread mail */ 322 extern char *mailReply; /* file to hold reply info for each email */ 323 /* Keep a copy of unformatted mail that you probably won't need again, 324 * but you never know. Should probably live somewhere under .Trash */ 325 extern char *mailStash; 326 extern char *downDir; /* the download directory */ 327 extern char *ebTempDir; /* edbrowse temp, such as /tmp/.edbrowse */ 328 extern char *ebUserDir; /* $ebTempDir/nnn user ID appended */ 329 extern char *dbarea, *dblogin, *dbpw; /* to log into the database */ 330 extern bool fetchBlobColumns; 331 extern bool caseInsensitive, searchStringsAll, searchWrap; 332 extern bool allowRedirection; /* from http code 301, or http refresh */ 333 extern bool sendReferrer; /* in the http header */ 334 extern bool allowJS; /* javascript on */ 335 extern bool blockJS; // javascript is blocked 336 extern bool htmlGenerated; 337 extern bool ftpActive; 338 extern bool helpMessagesOn; /* no need to type h */ 339 extern bool pluginsOn; /* plugins are active */ 340 extern bool showHiddenFiles; /* during directory scan */ 341 extern bool showHover; // messages that appear when you hover 342 extern bool doColors; 343 extern int context; /* which session (buffer) are we in? */ 344 extern pst linePending; 345 extern char *changeFileName; 346 extern char *addressFile; /* your address book */ 347 extern char *serverData; 348 extern int serverDataLen; 349 extern char *breakLineResult; 350 extern char *home; /* home directory */ 351 extern char *recycleBin; /* holds deleted files */ 352 extern char *configFile, *sigFile, *sigFileEnd; 353 extern char *cookieFile; /* persistent cookies */ 354 extern char *cacheDir; /* directory for a persistent cache of http pages */ 355 extern int cacheSize; // in megabytes 356 extern int cacheCount; // number of cache files 357 358 struct listHead { 359 void *next; 360 void *prev; 361 }; 362 363 /* Macros to loop through the items in a list. */ 364 #define foreach(e,l) for((e)=(l).next; \ 365 (e) != (void*)&(l); \ 366 (e) = ((struct listHead *)e)->next) 367 #define foreachback(e,l) for((e)=(l).prev; \ 368 (e) != (void*)&(l); \ 369 (e) = ((struct listHead *)e)->prev) 370 371 /* A pointer to the text of a line, and other line attributes */ 372 struct lineMap { 373 pst text; 374 char ds1, ds2; /* directory suffix */ 375 bool gflag; /* for g// */ 376 char filler; 377 }; 378 #define LMSIZE sizeof(struct lineMap) 379 380 /* an edbrowse frame, as when there are many frames in an html page. 381 * There could be several frames in an edbrowse window or buffer, chained 382 * together in a linked list, but usually there is just one, as when editing 383 * a local file and browsing a simple web page. 384 */ 385 struct ebFrame { 386 struct ebFrame *next; 387 struct ebWindow *owner; 388 struct htmlTag *frametag; 389 int gsn; // global sequence number 390 char *fileName; /* name of file or url */ 391 char *firstURL; // before http redirection 392 char *hbase; /* base for href references */ 393 bool render1; // rendered via protocol or urlmatch 394 bool render2; // rendered via suffix 395 bool render1b; 396 bool baseset; // <base> tag has been seen 397 bool uriEncoded; // filename is url encoded 398 char *dw; /* document.write string */ 399 int dw_l; /* length of the above */ 400 // document.writes go under the body. 401 struct htmlTag *htmltag, *headtag, *bodytag; 402 /* The javascript context and window corresponding to this url or frame. 403 * If this is null then javascript is not operational for this frame. 404 * We could still be browsing however, without javascript. */ 405 jsobjtype cx; 406 jsobjtype winobj; 407 jsobjtype docobj; /* window.document */ 408 const struct MIMETYPE *mt; 409 void *cssmaster; 410 short jtmin; 411 }; 412 413 typedef struct ebFrame Frame; 414 extern Frame *cf; /* current frame */ 415 extern int gfsn; // global frame sequence number 416 417 /* single linked list for internal jump history */ 418 struct histLabel { 419 int label; /* label must be first element */ 420 struct histLabel *prev; 421 }; 422 423 /* an edbrowse window */ 424 struct ebWindow { 425 /* windows stack up as you open new files or follow hyperlinks. 426 * Use the back command to pop the stack. 427 * The back command follows this link, which is 0 if you are at the top. */ 428 struct ebWindow *prev; 429 /* This is right out of the source for ed. Current and last line numbers. */ 430 int dot, dol; 431 /* remember dot and dol for the raw text, when in browse mode */ 432 int r_dot, r_dol; 433 struct ebFrame f0; /* first frame */ 434 struct ebFrame *jdb_frame; // if in jdb mode 435 char *referrer; // another web page that brought this one to life 436 char *baseDirName; /* when scanning a directory */ 437 char *htmltitle, *htmldesc, *htmlkey; /* title, description, keywords */ 438 char *saveURL; // for the fu command 439 char *mailInfo; 440 char lhs[MAXRE], rhs[MAXRE]; /* remembered substitution strings */ 441 struct lineMap *map, *r_map; 442 /* The labels that you set with the k command, and access via 'x. 443 * Basically, that's 26 line numbers. 444 * Number 0 means the label is not set. 445 * But there's one more to mark, when background javascript 446 * adds or deletes lines and we need to keep track of dot. */ 447 #define MARKLETTERS 27 448 #define MARKDOT 26 449 int labels[MARKLETTERS], r_labels[MARKLETTERS]; 450 struct histLabel *histLabel; 451 /* Next is an array of html tags, generated by the browse command, 452 * and used thereafter for hyperlinks, fill-out forms, etc. */ 453 struct htmlTag **tags; 454 int numTags, allocTags, deadTags; 455 struct htmlTag *scriptlist, *inputlist, *optlist, *linklist; 456 bool mustrender:1; 457 bool sank:1; /* jSyncup has been run */ 458 bool lhs_yes:1; 459 bool rhs_yes:1; 460 bool binMode:1; /* binary file */ 461 bool nlMode:1; /* newline at the end */ 462 bool rnlMode:1; 463 /* Various text modes, these are incompatible with binMode */ 464 /* All modes convert to utf8, as that is what pcre understands. */ 465 bool utf8Mode:1; 466 bool utf16Mode:1; 467 bool utf32Mode:1; 468 bool bigMode:1; // big-endian 469 bool iso8859Mode:1; 470 bool dosMode:1; // \r\n 471 bool browseMode:1; /* browsing html */ 472 bool changeMode:1; /* something has changed in this file */ 473 bool quitMode:1; /* you can quit this buffer any time */ 474 bool dirMode:1; /* directory mode */ 475 bool undoable:1; /* undo is possible */ 476 bool sqlMode:1; /* accessing a table */ 477 struct DBTABLE *table; /* if in sqlMode */ 478 time_t nextrender; 479 }; 480 extern struct ebWindow *cw; /* current window */ 481 #define foregroundWindow (cw == sessionList[context].lw) 482 483 /* quickly grab a tag from the current window via its sequence number: 484 * tagList[n] */ 485 #define tagList (cw->tags) 486 487 /* js is running in the current session */ 488 #define isJSAlive (cf->cx && allowJS) 489 490 /********************************************************************* 491 Temporary cap on the number of lines, so the integer index into cw->map 492 doesn't overflow. This is basically signed int over LMSIZE. 493 The former is 2^31 on most machines, 494 the latter is at most 12 on a 64-bit machine. 495 If ints are larger then I don't even use this constant. 496 *********************************************************************/ 497 498 #define MAXLINES 170000000 499 500 /* An edit session */ 501 struct ebSession { 502 struct ebWindow *fw, *lw; /* first window, last window */ 503 }; 504 extern struct ebSession sessionList[]; 505 extern struct ebSession *cs; /* current session */ 506 extern int maxSession; 507 508 /* The information on an html tag */ 509 #define MAXTAGNAME 20 510 struct tagInfo { 511 const char name[MAXTAGNAME]; 512 const char *desc; 513 int action; 514 uchar para; /* paragraph and line breaks */ 515 ushort bits; /* a bunch of boolean attributes */ 516 }; 517 extern const struct tagInfo availableTags[]; 518 519 /* Information on tagInfo->bits */ 520 /* support innerHTML */ 521 #define TAG_INNERHTML 1 522 /* You won't see the text between <foo> and </fooo> */ 523 #define TAG_INVISIBLE 2 524 /* sometimes </foo> means nothing. */ 525 #define TAG_NOSLASH 4 526 527 /* The structure for an html tag. 528 * These tags are at times linked with js objects, 529 * or even created by js objects. */ 530 struct htmlTag { 531 /* maintain a tree structure */ 532 struct htmlTag *parent, *firstchild, *sibling; 533 /* connect <foo> and </foo> */ 534 struct htmlTag *balance; 535 struct htmlTag *same; // same action 536 struct ebFrame *f0; /* frame that owns this tag */ 537 struct ebFrame *f1; /* subordinate frame if this is a <frame> tag */ 538 jsobjtype jv; /* corresponding javascript variable */ 539 jsobjtype style; // style object 540 int seqno; 541 int gsn; // global sequence number, for rooting 542 char *js_file; 543 int js_ln; /* line number of javascript */ 544 int lic; /* list item count, highly overloaded */ 545 int slic; /* start list item count */ 546 int action; 547 const struct tagInfo *info; 548 char *textval; /* for text tags only */ 549 const char **attributes; 550 const char **atvals; 551 /* the form that owns this input tag */ 552 struct htmlTag *controller; 553 pthread_t loadthread; 554 long hcode; 555 bool loadsuccess; 556 uchar step; // prerender, decorate, load script, runscript 557 bool slash:1; /* as in </A> */ 558 bool textin:1; /* <a> some text </a> */ 559 bool deleted:1; /* deleted from the current buffer */ 560 bool dead:1; // removed by garbage collection 561 bool contracted:1; /* frame is contracted */ 562 bool multiple:1; 563 bool async:1; // asynchronous script 564 bool intimer:1; // asynchronous script in timer 565 bool inxhr:1; // script is really an xhr 566 bool rdonly:1; 567 bool disabled:1; 568 bool clickable:1; /* but not an input field */ 569 bool secure:1; 570 bool scriptgen:1; // script generated, not from source 571 bool checked:1; 572 bool rchecked:1; /* for reset */ 573 bool post:1; /* post, rather than get */ 574 bool javapost:1; // post by calling javascript 575 bool jslink:1; // linked to a js object 576 bool mime:1; /* encode as mime, rather than url encode */ 577 bool bymail:1; /* send by mail, rather than http */ 578 bool submitted:1; 579 bool onclick:1; 580 bool onchange:1; 581 bool onsubmit:1; 582 bool onreset:1; 583 bool onload:1; 584 bool onunload:1; 585 bool doorway:1; /* doorway to javascript */ 586 bool visited:1; 587 bool masked:1; 588 bool iscolor:1; 589 char subsup; /* span turned into sup or sub */ 590 uchar itype; // input type = 591 uchar itype_minor; 592 #define DIS_INVISIBLE 1 593 #define DIS_HOVER 2 594 #define DIS_COLOR 3 595 #define DIS_TRANSPARENT 4 596 #define DIS_HOVERCOLOR 5 597 uchar disval; // displayable value for the node 598 int ninp; /* number of nonhidden inputs */ 599 // class is reserved word in c++, so use jclass for javascript class 600 char *name, *id, *jclass, *nodeName, *value, *href; 601 const char *rvalue; /* for reset */ 602 char *innerHTML; /* the html string under this tag */ 603 int inner; /* for inner html */ 604 int highspec; // specificity of a selector that matches this node 605 }; 606 607 typedef struct htmlTag Tag; 608 609 /* htmlTag.action */ 610 enum { 611 TAGACT_HTML, TAGACT_A, TAGACT_INPUT, TAGACT_TITLE, TAGACT_TA, 612 TAGACT_BUTTON, TAGACT_SELECT, TAGACT_OPTION, TAGACT_LABEL, 613 TAGACT_NOP, TAGACT_JS, TAGACT_H, TAGACT_SUB, TAGACT_SUP, TAGACT_OVB, 614 TAGACT_OL, TAGACT_UL, TAGACT_DL, TAGACT_TEXT, 615 TAGACT_BODY, TAGACT_HEAD, TAGACT_DOC, TAGACT_FRAG, TAGACT_COMMENT, 616 TAGACT_MUSIC, TAGACT_IMAGE, TAGACT_BR, TAGACT_IBR, TAGACT_P, 617 TAGACT_BASE, TAGACT_META, TAGACT_LINK, TAGACT_PRE, 618 TAGACT_TBODY, TAGACT_THEAD, TAGACT_TFOOT, 619 TAGACT_DT, TAGACT_DD, TAGACT_LI, TAGACT_TABLE, TAGACT_TR, TAGACT_TD, 620 TAGACT_DIV, TAGACT_SPAN, TAGACT_HR, TAGACT_OBJECT, TAGACT_FOOTER, 621 TAGACT_HEADER, // <header> tag, not the same as <head> tag 622 TAGACT_FORM, TAGACT_FRAME, TAGACT_STYLE, 623 TAGACT_MAP, TAGACT_AREA, TAGACT_SCRIPT, TAGACT_NOSCRIPT, TAGACT_EMBED, 624 TAGACT_OBJ, TAGACT_UNKNOWN, 625 }; 626 627 /* htmlTag.itype */ 628 /* Warning - the order of these is important! */ 629 /* Corresponds to inp_types in decorate.c */ 630 enum { 631 INP_RESET, INP_BUTTON, INP_IMAGE, INP_SUBMIT, 632 INP_HIDDEN, INP_TEXT, INP_FILE, 633 INP_SELECT, INP_TA, INP_RADIO, INP_CHECKBOX, 634 }; 635 extern const char *const inp_types[]; 636 637 /* htmlTag.itype_minor */ 638 /* The order corresponds to inp_others in decorate.c */ 639 enum { 640 INP_NO_MINOR, INP_DATE, INP_DATETIME, INP_DATETIME_LOCAL, 641 INP_MONTH, INP_WEEK, INP_TIME, INP_EMAIL, INP_RANGE, 642 INP_SEARCH, INP_TEL, INP_URL, INP_NUMBER, INP_PW, 643 }; 644 extern const char *const inp_others[]; 645 646 /* For traversing a tree of html nodes, this is the callback function */ 647 typedef void (*nodeFunction) (struct htmlTag * node, bool opentag); 648 extern nodeFunction traverse_callback; 649 650 /* Return codes for base64Decode() */ 651 #define GOOD_BASE64_DECODE 0 652 #define BAD_BASE64_DECODE 1 653 #define EXTRA_CHARS_BASE64_DECODE 2 654 655 #ifdef DOSLIKE 656 /* windows mkdir takes only one argument */ 657 #define mkdir(a,b) _mkdir(a) 658 // give the above we probably don't need rwx mode but here we go 659 #define MODE_rw 0600 660 #define MODE_rwx 0700 661 #define MODE_private 0600 662 #else 663 #define MODE_rw 0666 664 #define MODE_rwx 0777 665 #define MODE_private 0600 666 #endif 667 668 /* function prototypes */ 669 #include "ebprot.h" 670 671 /* Symbolic constants for language independent messages */ 672 #include "messages.h" 673 674 #endif 675