SMJS: Use JS_THIS_OBJECT and JS_CALLEE, not argv[-1] and argv[-2]
[elinks/elinks-j605.git] / src / protocol / protocol.h
blobaa99417200747243bc057d16feec9ef0a2413702
1 #ifndef EL__PROTOCOL_PROTOCOL_H
2 #define EL__PROTOCOL_PROTOCOL_H
4 #include "main/module.h"
6 struct connection;
7 struct session;
8 struct terminal;
9 struct uri;
11 enum protocol {
12 PROTOCOL_ABOUT,
13 PROTOCOL_BITTORRENT,
14 PROTOCOL_BITTORRENT_PEER,
15 PROTOCOL_DATA,
16 PROTOCOL_FILE,
17 PROTOCOL_FINGER,
18 PROTOCOL_FSP,
19 PROTOCOL_FTP,
20 PROTOCOL_GOPHER,
21 PROTOCOL_HTTP,
22 PROTOCOL_HTTPS,
23 PROTOCOL_JAVASCRIPT,
24 PROTOCOL_MAILCAP,
25 PROTOCOL_NEWS,
26 PROTOCOL_NNTP,
27 PROTOCOL_NNTPS,
28 PROTOCOL_PROXY,
29 PROTOCOL_SMB,
30 PROTOCOL_SNEWS,
32 /* Keep these last! */
33 PROTOCOL_UNKNOWN,
34 PROTOCOL_USER,
35 PROTOCOL_LUA,
37 /* For protocol backend index checking */
38 PROTOCOL_BACKENDS,
41 /* Besides the session an external handler also takes the url as an argument */
42 typedef void (protocol_handler_T)(struct connection *);
43 typedef void (protocol_external_handler_T)(struct session *, struct uri *);
45 /* Accessors for the protocol backends. */
47 int get_protocol_port(enum protocol protocol);
48 int get_protocol_need_slashes(enum protocol protocol);
49 int get_protocol_keep_double_slashes(enum protocol protocol);
50 int get_protocol_need_slash_after_host(enum protocol protocol);
51 int get_protocol_free_syntax(enum protocol protocol);
52 int get_protocol_need_ssl(enum protocol protocol);
54 protocol_handler_T *get_protocol_handler(enum protocol protocol);
55 protocol_external_handler_T *get_protocol_external_handler(struct terminal *, struct uri *);
57 /* Resolves the given protocol @name with length @namelen to a known protocol,
58 * PROTOCOL_UNKOWN or PROTOCOL_INVALID if no protocol part could be identified.
59 * User defined protocols (configurable via protocol.user) takes precedence. */
60 enum protocol get_protocol(unsigned char *name, int namelen);
62 extern struct module protocol_module;
64 #endif